aboutsummaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
authorUnknown <jtsshieh@outlook.com>2018-02-24 10:09:22 -0500
committerUnknown <jtsshieh@outlook.com>2018-02-24 10:09:22 -0500
commitabd6d61c3ce05ef2c59e14b0a3ee67d96ca777f1 (patch)
tree67c7cbadff327e3bf21e8bf71546821bc9aba2d2 /commands
parentb38df9dd1048f794e861531973734e64e7695c53 (diff)
downloadPokeBot-abd6d61c3ce05ef2c59e14b0a3ee67d96ca777f1.tar.gz
PokeBot-abd6d61c3ce05ef2c59e14b0a3ee67d96ca777f1.tar.bz2
PokeBot-abd6d61c3ce05ef2c59e14b0a3ee67d96ca777f1.zip
Purge
Diffstat (limited to 'commands')
-rw-r--r--commands/ban.js2
-rw-r--r--commands/kick.js2
-rw-r--r--commands/purge.js26
-rw-r--r--commands/softban.js2
4 files changed, 29 insertions, 3 deletions
diff --git a/commands/ban.js b/commands/ban.js
index 5e784e9..69a78f6 100644
--- a/commands/ban.js
+++ b/commands/ban.js
@@ -19,6 +19,6 @@ exports.conf = {
exports.help = {
name: 'ban',
description: 'Ban a user from this server.',
- usage: '@<User> <...reason>',
+ usage: '@<user> <...reason>',
category: 'Moderation',
};
diff --git a/commands/kick.js b/commands/kick.js
index 034a003..5ed7942 100644
--- a/commands/kick.js
+++ b/commands/kick.js
@@ -19,6 +19,6 @@ exports.conf = {
exports.help = {
name: 'kick',
description: 'Kick a user out of the server.',
- usage: '@<User> <...reason>',
+ usage: '@<user> <...reason>',
category: 'Moderation',
};
diff --git a/commands/purge.js b/commands/purge.js
new file mode 100644
index 0000000..007e850
--- /dev/null
+++ b/commands/purge.js
@@ -0,0 +1,26 @@
+exports.run = async (bot, msg, args) => {
+ msg.delete();
+ 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 > 98 || amount < 2) return msg.reply('Choose an amount less than 98 and greater than 1');
+ 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',
+};
diff --git a/commands/softban.js b/commands/softban.js
index 25abf4e..b942b3e 100644
--- a/commands/softban.js
+++ b/commands/softban.js
@@ -20,6 +20,6 @@ exports.conf = {
exports.help = {
name: 'softban',
description: 'Kick the user and delete their messages.',
- usage: '@<User> <...reason>',
+ usage: '@<user> <...reason>',
category: 'Moderation',
};