diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-23 18:10:03 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-23 18:10:03 -0400 |
commit | 8200a4427bb5c4093e7d4f1b30a3fdd7ee3380c1 (patch) | |
tree | 77bc547b2920a7a14cd47dc06a8a2b271588b2d7 /src/lib/common | |
parent | 36ff682e742021918d134ff91a2bee3041b5a2b9 (diff) | |
parent | 9bc6ca4b2e42d8c55318710d115f3cdaeb5459eb (diff) | |
download | tanzanite-8200a4427bb5c4093e7d4f1b30a3fdd7ee3380c1.tar.gz tanzanite-8200a4427bb5c4093e7d4f1b30a3fdd7ee3380c1.tar.bz2 tanzanite-8200a4427bb5c4093e7d4f1b30a3fdd7ee3380c1.zip |
Merge branch 'master' of https://github.com/NotEnoughUpdates/bush-bot
Diffstat (limited to 'src/lib/common')
-rw-r--r-- | src/lib/common/AutoMod.ts | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/common/AutoMod.ts b/src/lib/common/AutoMod.ts index 312beb3..adc629a 100644 --- a/src/lib/common/AutoMod.ts +++ b/src/lib/common/AutoMod.ts @@ -29,7 +29,8 @@ export class AutoMod { severity: Severity.PERM_MUTE, ignoreSpaces: true, ignoreCapitalization: true, - reason: 'malicious link' + reason: 'malicious link', + regex: false }; }); @@ -67,8 +68,14 @@ export class AutoMod { const matchedWords: BadWords = {}; for (const word in words) { const wordOptions = words[word]; - if (this.format(this.message.content, wordOptions).includes(this.format(word, wordOptions))) { - matchedWords[word] = wordOptions; + if (wordOptions.regex) { + if (new RegExp(word).test(this.format(word, wordOptions))) { + matchedWords[word] = wordOptions; + } + } else { + if (this.format(this.message.content, wordOptions).includes(this.format(word, wordOptions))) { + matchedWords[word] = wordOptions; + } } } return matchedWords; @@ -239,6 +246,7 @@ interface BadWordDetails { ignoreSpaces: boolean; ignoreCapitalization: boolean; reason: string; + regex: boolean; } export interface BadWords { |