From c484753ee15dbe2a5ce9c6297f22fabb52ce3b7e Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 24 Feb 2018 14:59:35 -0500 Subject: New Command system --- commands/purge.js | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 commands/purge.js (limited to 'commands/purge.js') diff --git a/commands/purge.js b/commands/purge.js deleted file mode 100644 index f02cb0a..0000000 --- a/commands/purge.js +++ /dev/null @@ -1,31 +0,0 @@ -exports.run = async (bot, msg, args) => { - if (!msg.member.hasPermission('MANAGE_MESSAGES')) return msg.reply('You don\'t have permssion to manage messages.'); - if (!msg.guild.member(bot.user).hasPermission('MANAGE_MESSAGES')) return msg.reply('I don\'t have permssion to manage messages.'); - - const user = msg.mentions.users.first(); - const amount = parseInt(args[0]) ? parseInt(args[0]) : parseInt(args[1]); - - if (!amount) return msg.reply('How many message shall I delete?'); - if (!amount && !user) return msg.reply('Tell me the user and amount or the just the amount of messages to purge.'); - if (amount > 100 || amount < 3) return msg.reply('Choose an amount less than 98 and greater than 1'); - msg.delete(); - - let msgs = await msg.channel.fetchMessages({ limit: amount }); - if (user) { - const filterBy = user ? user.id : bot.user.id; - msgs = msgs.filter(m => m.author.id === filterBy).array().slice(0, amount); - } - msg.channel.bulkDelete(msgs).catch(error => console.log(error.stack)); -}; - -exports.conf = { - aliases: ['prune', 'rm'], - guildOnly: true, -}; - -exports.help = { - name: 'purge', - description: 'Get rid of messages quickly.', - usage: '@user ', - category:'Moderation', -}; -- cgit v1.2.3