From e6f4a95847828ab9011027dbf52b4ac80db772c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Sun, 16 Sep 2018 21:58:14 +0200 Subject: [PATCH] Fixed prune ? i think with a stupid way --- commands/admin/prune.js | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/commands/admin/prune.js b/commands/admin/prune.js index e4965667..b366f4e8 100644 --- a/commands/admin/prune.js +++ b/commands/admin/prune.js @@ -7,22 +7,23 @@ module.exports = class PruneCommand extends Command { group: 'admin', memberName: 'prune', description: 'Bulk delete messages.', - clientPermissions: ['MANAGE_MESSAGES'], - userPermissions: ['MANAGE_MESSAGES'], + clientPermissions: ['READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'], + userPermissions: ['MANAGE_MESSAGES'], + args: [ + { + key: 'amount', + prompt: 'How many messages would you like to delete? ( choose a number between 1 & 99 )', + type: 'integer', + min: '1', + max: '99' + } + ] }); } - async run(message, args) { - const amount = parseInt(args[0]) + 1; + run(message, { amount }) { + amount = amount+1 + message.channel.bulkDelete(amount, true); + } +}; - if (isNaN(amount)) { - return message.reply('that dosen\'t seem to be a valid number.'); - } - else if (amount <= 1 || amount > 100) { - return message.reply('you need to input a number between 1 and 99.'); - } - message.channel.bulkDelete(amount, true).catch(err => { - console.error(err); - message.channel.send('there was an error trying to prune messages in this channel!'); - }); -}} \ No newline at end of file