--removeall
This commit is contained in:
parent
63781153c6
commit
ed75c7a7d3
1 changed files with 13 additions and 4 deletions
|
@ -12,20 +12,22 @@ class BannedWordsCommand extends Command {
|
||||||
{
|
{
|
||||||
id: 'word',
|
id: 'word',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
prompt: {
|
|
||||||
start: 'What word should be banned',
|
|
||||||
},
|
|
||||||
match: 'rest'
|
match: 'rest'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'remove',
|
id: 'remove',
|
||||||
match: 'flag',
|
match: 'flag',
|
||||||
flag: '--remove'
|
flag: '--remove'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'removeall',
|
||||||
|
match: 'flag',
|
||||||
|
flag: '--removeall'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
channelRestriction: 'guild',
|
channelRestriction: 'guild',
|
||||||
description: {
|
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]',
|
usage: '[word to ban]',
|
||||||
examples: ['owo']
|
examples: ['owo']
|
||||||
}
|
}
|
||||||
|
@ -33,6 +35,13 @@ class BannedWordsCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
async exec(message, args) {
|
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, '');
|
args.word = args.word.replace(/[\u0250-\ue007]/g, '');
|
||||||
const bannedWords = await BannedWords.findOne({where: {word: args.word.toLowerCase(), serverID: message.guild.id}});
|
const bannedWords = await BannedWords.findOne({where: {word: args.word.toLowerCase(), serverID: message.guild.id}});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue