From cb221b1e5e22a5eee782f63e83de95dfb57835a7 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Fri, 29 Apr 2022 00:32:34 +0300 Subject: [PATCH] trying to weed out false positives --- src/constants/FilterPresets.json | 1 + src/structure/components/observers/Automoderation.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/constants/FilterPresets.json b/src/constants/FilterPresets.json index 8983002..6fb31ec 100644 --- a/src/constants/FilterPresets.json +++ b/src/constants/FilterPresets.json @@ -509,6 +509,7 @@ "nightmares", "nightcore", "nightclub", + "nighttime", "pingers", "nigeria", "nigel", diff --git a/src/structure/components/observers/Automoderation.js b/src/structure/components/observers/Automoderation.js index b6f8ce0..a279cf6 100644 --- a/src/structure/components/observers/Automoderation.js +++ b/src/structure/components/observers/Automoderation.js @@ -183,10 +183,15 @@ module.exports = class AutoModeration extends Observer { try { // This is for debugging only inWL = this.whitelist.find(fullWord); } 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; + 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}`; filterResult = { match: fullWord,