aboutsummaryrefslogtreecommitdiff
path: root/src/lib/common/AutoMod.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/common/AutoMod.ts')
-rw-r--r--src/lib/common/AutoMod.ts15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/lib/common/AutoMod.ts b/src/lib/common/AutoMod.ts
index 312beb3..5f0b8a0 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,15 @@ 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 +247,7 @@ interface BadWordDetails {
ignoreSpaces: boolean;
ignoreCapitalization: boolean;
reason: string;
+ regex: boolean;
}
export interface BadWords {