forked from Galactic/galactic-bot
bugfix?
This commit is contained in:
parent
01cc2d7a8c
commit
9d70400a30
@ -274,18 +274,20 @@ module.exports = class FilterUtility {
|
|||||||
//log += `\next reg: ${tmp}`;
|
//log += `\next reg: ${tmp}`;
|
||||||
const fullWord = words.find((word) => word.includes(match[1]));
|
const fullWord = words.find((word) => word.includes(match[1]));
|
||||||
|
|
||||||
let inWL = false;
|
if(fullWord) {
|
||||||
try { // This is for debugging only
|
let inWL = false;
|
||||||
inWL = FilterUtility.whitelist.find(fullWord);
|
try { // This is for debugging only
|
||||||
} catch (err) {
|
inWL = FilterUtility.whitelist.find(fullWord);
|
||||||
this.logger.error(`Whitelist.find error: ${fullWord} ${match[1]} ${words}`);
|
} catch (err) {
|
||||||
}
|
this.logger.error(`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);
|
const diff = Math.abs(fullWord.length - match[0].length);
|
||||||
if (diff > 3) {
|
if (diff > 3) {
|
||||||
this.logger.debug(`Match length diff: ${diff} MATCH: ${match[0]} FULL: ${fullWord}, CONTENT: ${content}`);
|
this.logger.debug(`Match length diff: ${diff} MATCH: ${match[0]} FULL: ${fullWord}, CONTENT: ${content}`);
|
||||||
continue;
|
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}`;
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user