diff --git a/commands/Moderation/announcement.js b/commands/Moderation/announcement.js index dc3742e2..a630fa25 100644 --- a/commands/Moderation/announcement.js +++ b/commands/Moderation/announcement.js @@ -22,10 +22,8 @@ class Announcement extends Command { if (!text) return message.error("moderation/announcement:MISSING_TEXT"); if (text.length > 1030) return message.error("moderation/announcement:TOO_LONG"); - message.delete().catch(() => {}); - let mention = null; - const msg = await message.sendT("moderation/announcement:MENTION_PROMPT"); + const msg = await message.channel.send(message.translate("moderation/announcement:MENTION_PROMPT")); const filter = m => m.author.id === message.author.id; const collector = new Discord.MessageCollector(message.channel, { @@ -38,12 +36,14 @@ class Announcement extends Command { tmsg.delete(); msg.delete(); collector.stop(true); + + message.delete(); } if (tmsg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) { tmsg.delete(); msg.delete(); - const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT"); + const tmsg1 = await message.channel.send(message.translate("moderation/announcement:MENTION_TYPE_PROMPT")); const filter = m => m.author.id === message.author.id; const c = new Discord.MessageCollector(message.channel, { @@ -65,9 +65,12 @@ class Announcement extends Command { c.stop(true); } }); + c.on("end", (collected, reason) => { if (reason === "time") return message.error("misc:TIMES_UP"); }); + + message.delete(); } }); diff --git a/commands/Moderation/ban.js b/commands/Moderation/ban.js index 8da683f5..6c23ceec 100644 --- a/commands/Moderation/ban.js +++ b/commands/Moderation/ban.js @@ -58,12 +58,12 @@ class Ban extends Command { reason }).then(() => { // Send a success message in the current channel - message.sendT("moderation/ban:BANNED", { + message.channel.send(message.translate("moderation/ban:BANNED", { username: user.tag, server: message.guild.name, moderator: message.author.tag, reason - }); + })); const caseInfo = { channel: message.channel.id, diff --git a/commands/Moderation/clear.js b/commands/Moderation/clear.js index 774d68d6..799a98cc 100644 --- a/commands/Moderation/clear.js +++ b/commands/Moderation/clear.js @@ -18,7 +18,8 @@ class Clear extends Command { async run(message, args) { if (args[0] === "all") { - message.sendT("moderation/clear:ALL_CONFIRM"); + message.channel.send(message.translate("moderation/clear:ALL_CONFIRM")); + await message.channel.awaitMessages((m) => (m.author.id === message.author.id) && (m.content === "confirm"), { max: 1, time: 20000, @@ -26,6 +27,7 @@ class Clear extends Command { }).catch(() => { return message.error("misc:TIMES_UP"); }); + const position = message.channel.position; const newChannel = await message.channel.clone(); await message.channel.delete(); diff --git a/commands/Moderation/kick.js b/commands/Moderation/kick.js index f9b06ab3..6b6019c9 100644 --- a/commands/Moderation/kick.js +++ b/commands/Moderation/kick.js @@ -47,12 +47,12 @@ class Kick extends Command { // Kick the user member.kick(reason).then(() => { // Send a success message in the current channel - message.sendT("moderation/kick:KICKED", { + message.channel.send(message.translate("moderation/kick:KICKED", { username: member.user.tag, server: message.guild.name, moderator: message.author.tag, reason - }); + })); data.guild.casesCount++; data.guild.save(); diff --git a/commands/Moderation/poll.js b/commands/Moderation/poll.js index 5c919205..bfcaf5df 100644 --- a/commands/Moderation/poll.js +++ b/commands/Moderation/poll.js @@ -22,7 +22,7 @@ class Poll extends Command { if (!question) return message.error("moderation/poll:MISSING_QUESTION"); let mention = null; - const msg = await message.sendT("moderation/announcement:MENTION_PROMPT"); + const msg = await message.channel.send(message.translate("moderation/announcement:MENTION_PROMPT")); const filter = m => m.author.id === message.author.id; const collector = new Discord.MessageCollector(message.channel, { @@ -42,7 +42,7 @@ class Poll extends Command { if (tmsg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) { tmsg.delete(); msg.delete(); - const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT"); + const tmsg1 = await message.channel.send(message.translate("moderation/announcement:MENTION_TYPE_PROMPT")); const filter = m => m.author.id === message.author.id; const c = new Discord.MessageCollector(message.channel, { diff --git a/events/messageCreate.js b/events/messageCreate.js index 35a52c63..0bb2fe8d 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -200,7 +200,7 @@ module.exports = class { try { cmd.run(message, args, data); - if (cmd.help.category === "Moderation" && data.guild.autoDeleteModCommands) message.delete(); + if (cmd.help.category === "Moderation" && data.guild.autoDeleteModCommands) setTimeout(() => message.delete(), 3000); } catch (e) { console.error(e); return message.error("misc:ERR_OCCURRED");