mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-09-30 05:05:59 +00:00
Make failing word list more visible
This commit is contained in:
parent
458c621f88
commit
0ad35e43fe
@ -85,11 +85,15 @@ export class WordList extends Protection {
|
|||||||
}
|
}
|
||||||
if (this.badWords == null) {
|
if (this.badWords == null) {
|
||||||
// Create a mega-regex from all the tiny baby regexs
|
// Create a mega-regex from all the tiny baby regexs
|
||||||
this.badWords = new RegExp(
|
try {
|
||||||
"(" + mjolnir.config.protections.wordlist.words.join(")|(") + ")",
|
this.badWords = new RegExp(
|
||||||
"i"
|
"(" + mjolnir.config.protections.wordlist.words.join(")|(") + ")",
|
||||||
);
|
"i"
|
||||||
}
|
);
|
||||||
|
} catch (ex) {
|
||||||
|
await mjolnir.logMessage(LogLevel.ERROR, "WordList", `Could not produce a regex from the word list:\n${ex}.`)
|
||||||
|
}
|
||||||
|
}-
|
||||||
|
|
||||||
// Perform the test
|
// Perform the test
|
||||||
if (message && this.badWords!.test(message)) {
|
if (message && this.badWords!.test(message)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user