Make failing word list more visible

This commit is contained in:
gnuxie 2022-07-18 16:36:56 +01:00
parent 458c621f88
commit 0ad35e43fe

View File

@ -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)) {