diff --git a/src/commands/automod.command.ts b/src/commands/automod.command.ts index c7d4ea2b..164abec6 100644 --- a/src/commands/automod.command.ts +++ b/src/commands/automod.command.ts @@ -134,9 +134,11 @@ export default new Command({ await getList(false, message, client) } if (subcommand === "add") { - const word = args.consume("word") + let word = args.consume("word") if (!word) return await message.sendErrorMessage("invalidWord") + word = word.toLowerCase() + await message.continue() const punishment = args.consume("punishment").toUpperCase() if (word.length > 99) { @@ -161,8 +163,6 @@ export default new Command({ ) return await message.sendErrorMessage("specifyDuration") const isAlreadyThere = client.filterWordsCached.banned.get(word) - console.log(client.filterWordsCached.banned) - console.log(client.filterWordsCached.banned.get(word)) if (isAlreadyThere != undefined) return await message.sendErrorMessage("wordAlreadyBanned") diff --git a/src/entities/BannedWord.entity.ts b/src/entities/BannedWord.entity.ts index a8518d1e..cb45d338 100644 --- a/src/entities/BannedWord.entity.ts +++ b/src/entities/BannedWord.entity.ts @@ -29,7 +29,7 @@ export default class BannedWord extends typeorm.BaseEntity { client: Client ): Promise { const created = new BannedWord() - if (options.word !== undefined) created.word = options.word + if (options.word !== undefined) created.word = options.word.toLowerCase() if (options.punishment_type !== undefined) created.punishment_type = options.punishment_type if (options.reason !== undefined) created.reason = options.reason @@ -73,8 +73,8 @@ export default class BannedWord extends typeorm.BaseEntity { const banned: bannedTypes = new Discord.Collection() const except: Array = [] values.forEach(word => { - if (word.exception) except.push(word.word) - else banned.set(word.word, word) + if (word.exception) except.push(word.word.toLowerCase()) + else banned.set(word.word.toLowerCase(), word) }) return { banned: banned, except: except } } @@ -84,7 +84,7 @@ export default class BannedWord extends typeorm.BaseEntity { client.filterWordsCached.except = client.filterWordsCached.except.filter( value => value !== this.word ) - else client.filterWordsCached.banned.delete(this.word) + else client.filterWordsCached.banned.delete(this.word.toLowerCase()) await this.remove() return }