diff --git a/structure/client/components/observers/Automoderation.js b/structure/client/components/observers/Automoderation.js index 22e46f7..aa4c6d8 100644 --- a/structure/client/components/observers/Automoderation.js +++ b/structure/client/components/observers/Automoderation.js @@ -121,7 +121,7 @@ module.exports = class AutoModeration extends Observer { for (const word of words) { const sim = similarity(word, _word); const threshold = 0.93 - 0.165 * Math.log(word.length); - if (sim >= threshold) { + if (sim >= threshold && Math.abs(_word.length - word.length) < 3) { if (this.whitelist.find(word) || whitelist.some((w) => w === word) && sim < 1) continue; this.client.logger.debug(`\nMessage matched with "${_word}" in fuzzy.\nMatched word: ${word}\nFull content: ${content}\nSimilarity: ${sim}\nThreshold: ${threshold}`); filterResult = { @@ -137,7 +137,7 @@ module.exports = class AutoModeration extends Observer { } const sim = similarity(text, _word); - if (sim >= threshold) { + if (sim >= threshold && Math.abs(_word.length - text.length) < 3) { if (this.whitelist.find(text) || whitelist.some((w) => w === text) && sim < 1) continue; this.client.logger.debug(`\nMessage matched with "${_word}" in fuzzy.\nMatched word: ${text}\nFull content: ${content}\nSimilarity: ${sim}\nThreshold: ${threshold}`); filterResult = {