From 4934b8fad9589a6956429c312dd0bbcb3dd52155 Mon Sep 17 00:00:00 2001 From: Navy Date: Wed, 23 Jun 2021 11:49:59 +0300 Subject: [PATCH] improvements to regex filter --- structure/client/components/observers/Automoderation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/structure/client/components/observers/Automoderation.js b/structure/client/components/observers/Automoderation.js index 18ca420..9ddf8ee 100644 --- a/structure/client/components/observers/Automoderation.js +++ b/structure/client/components/observers/Automoderation.js @@ -116,7 +116,7 @@ module.exports = class AutoModeration extends Observer { // _matcher: locally used variable for which word in the list triggered it | // type: which detection type matched it let filterResult = { filter: 'word', match: null, matched: false, matcher: null, _matcher: null, preset: false }; - const words = content.toLowerCase().split(' ').filter((elem) => elem.length); + const words = content.toLowerCase().replace(/[,?.!]/gu, '').split(' ').filter((elem) => elem.length); // Remove any potential bypass characters //const _words = words.map((word) => word.replace(/[.'*_?+"#%&=-]/gu, ''));