From e21449a031e80fa0a1c32f9ce2b8e4e90ffefef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Sun, 9 Sep 2018 21:40:45 +0200 Subject: [PATCH] prune work the correct way --- commands/admin/prune.js | 26 +++++++++++++------------- commands/owner/selftest.js | 15 --------------- index.js | 2 +- 3 files changed, 14 insertions(+), 29 deletions(-) delete mode 100644 commands/owner/selftest.js diff --git a/commands/admin/prune.js b/commands/admin/prune.js index 9f615246..e4965667 100644 --- a/commands/admin/prune.js +++ b/commands/admin/prune.js @@ -9,20 +9,20 @@ module.exports = class PruneCommand extends Command { description: 'Bulk delete messages.', clientPermissions: ['MANAGE_MESSAGES'], userPermissions: ['MANAGE_MESSAGES'], - args: [ - { - key: 'amount', - prompt: 'How many messages would you like to delete?', - type: 'integer', - } - ] }); } - async run(message, { amount }) { - if (amount < 2 || amount > 100) { - return message.reply('you need to input a number between 2 and 100.'); + async run(message, args) { + const amount = parseInt(args[0]) + 1; + + if (isNaN(amount)) { + return message.reply('that dosen\'t seem to be a valid number.'); } - message.channel.bulkDelete(amount, true); - } -}; \ No newline at end of file + 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 diff --git a/commands/owner/selftest.js b/commands/owner/selftest.js deleted file mode 100644 index 3c0a5511..00000000 --- a/commands/owner/selftest.js +++ /dev/null @@ -1,15 +0,0 @@ -const { Command } = require('discord.js-commando'); -module.exports = class YesCommand extends Command { - constructor(client) { - super(client, { - name: 'yes', - group: 'fun', - memberName: 'yes', - description: 'very yes', - }); - } - - async run(message) { - return message.say('haha very yes'); - } -}; \ No newline at end of file diff --git a/index.js b/index.js index 2bc7ca7e..e947de8b 100644 --- a/index.js +++ b/index.js @@ -6,7 +6,7 @@ const fs = require("fs"); // Prefix and ownerID and invite to support server const client = new CommandoClient({ - commandPrefix: 'h3h3', + commandPrefix: 'haha ', owner: '267065637183029248', invite: 'https://discord.gg/SsMCsVY', });