Skip to content

Commit

Permalink
Issue found
Browse files Browse the repository at this point in the history
  • Loading branch information
XboxBedrock committed Jul 12, 2024
1 parent 9e20ca7 commit 32166e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/commands/automod.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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")

Expand Down
8 changes: 4 additions & 4 deletions src/entities/BannedWord.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class BannedWord extends typeorm.BaseEntity {
client: Client
): Promise<BannedWord> {
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
Expand Down Expand Up @@ -73,8 +73,8 @@ export default class BannedWord extends typeorm.BaseEntity {
const banned: bannedTypes = new Discord.Collection<string, BannedWord>()
const except: Array<string> = []
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 }
}
Expand All @@ -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
}
Expand Down

0 comments on commit 32166e5

Please sign in to comment.