trying to weed out false positives

This commit is contained in:
Erik 2022-04-29 00:32:34 +03:00
parent 6d443fea7b
commit cb221b1e5e
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
2 changed files with 7 additions and 1 deletions

View File

@ -509,6 +509,7 @@
"nightmares", "nightmares",
"nightcore", "nightcore",
"nightclub", "nightclub",
"nighttime",
"pingers", "pingers",
"nigeria", "nigeria",
"nigel", "nigel",

View File

@ -183,10 +183,15 @@ module.exports = class AutoModeration extends Observer {
try { // This is for debugging only try { // This is for debugging only
inWL = this.whitelist.find(fullWord); inWL = this.whitelist.find(fullWord);
} catch (err) { } catch (err) {
this.logger.debug(fullWord, match[1], words); this.logger.debug(`Whitelist.find error: ${fullWord} ${match[1]} ${words}`);
} }
if (inWL || whitelist.some((word) => word === fullWord)) continue; if (inWL || whitelist.some((word) => word === fullWord)) continue;
const diff = Math.abs(fullWord.length - match[0].length);
if (diff > 3) {
this.logger.debug(`Match length diff: ${diff} MATCH: ${match[0]} FULL: ${fullWord}`);
continue;
}
log += `\nMessage matched with "${reg}" in the regex list.\nMatch: ${match[0]}, Full word: ${fullWord}\nFull content: ${content}`; log += `\nMessage matched with "${reg}" in the regex list.\nMatch: ${match[0]}, Full word: ${fullWord}\nFull content: ${content}`;
filterResult = { filterResult = {
match: fullWord, match: fullWord,