From ed75c7a7d30fa39bf23a0f0ee6dec2e55d4d6c46 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Thu, 30 Jan 2020 12:02:27 +0100 Subject: [PATCH] --removeall --- commands/admin/banword.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/commands/admin/banword.js b/commands/admin/banword.js index d268004a..ade44367 100644 --- a/commands/admin/banword.js +++ b/commands/admin/banword.js @@ -12,20 +12,22 @@ class BannedWordsCommand extends Command { { id: 'word', type: 'string', - prompt: { - start: 'What word should be banned', - }, match: 'rest' }, { id: 'remove', match: 'flag', flag: '--remove' + }, + { + id: 'removeall', + match: 'flag', + flag: '--removeall' } ], channelRestriction: 'guild', description: { - content: 'Ban word on the server. --remove to delete a banned word', + content: 'Ban word on the server. --remove to delete a banned word. --removeaall to remove every banned word', usage: '[word to ban]', examples: ['owo'] } @@ -33,6 +35,13 @@ class BannedWordsCommand extends Command { } async exec(message, args) { + if (args.removeall) { + BannedWords.destroy({where: {serverID: message.guild.id}}); + return message.channel.send('The banned word have been reset.'); + } + + if (!args.word) return message.channel.send('Please specify a word to ban!'); + args.word = args.word.replace(/[\u0250-\ue007]/g, ''); const bannedWords = await BannedWords.findOne({where: {word: args.word.toLowerCase(), serverID: message.guild.id}});