aboutsummaryrefslogtreecommitdiff
path: root/commands/purge.js
diff options
context:
space:
mode:
authorUnknown <jtsshieh@outlook.com>2018-02-24 14:59:35 -0500
committerUnknown <jtsshieh@outlook.com>2018-02-24 14:59:35 -0500
commitc484753ee15dbe2a5ce9c6297f22fabb52ce3b7e (patch)
tree93fd74f30abbd3c8206321b9d9c20b2571ed84ca /commands/purge.js
parent3d36bcf0591f2694c3a2472a157ecca0de8d35fc (diff)
downloadPokeBot-c484753ee15dbe2a5ce9c6297f22fabb52ce3b7e.tar.gz
PokeBot-c484753ee15dbe2a5ce9c6297f22fabb52ce3b7e.tar.bz2
PokeBot-c484753ee15dbe2a5ce9c6297f22fabb52ce3b7e.zip
New Command system
Diffstat (limited to 'commands/purge.js')
-rw-r--r--commands/purge.js31
1 files changed, 0 insertions, 31 deletions
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 <messages>',
- category:'Moderation',
-};