From e77f3c6254397a2355e05c087d3210aa08926b19 Mon Sep 17 00:00:00 2001 From: Navy Date: Sat, 12 Jun 2021 16:47:53 +0300 Subject: [PATCH] wordwatcher tweak --- structure/client/components/observers/Automoderation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/structure/client/components/observers/Automoderation.js b/structure/client/components/observers/Automoderation.js index 5d72679..0680a6c 100644 --- a/structure/client/components/observers/Automoderation.js +++ b/structure/client/components/observers/Automoderation.js @@ -321,7 +321,7 @@ module.exports = class AutoModeration extends Observer { for (const reg of words) { - match = content.match(new RegExp(` ${reg} `, 'iu')); + match = content.match(new RegExp(`(?:^|\\s)${reg}`, 'iu')); if (match) break; @@ -337,7 +337,7 @@ module.exports = class AutoModeration extends Observer { `, // ** User:** <@${ author.id }> color: 15120384, fields: context.reverse().reduce((acc, val) => { - const text = val.content.length ? val.content.replace(match, '**__$&__**') : '**NO CONTENT**'; + const text = val.content.length ? Util.escapeMarkdown(val.content).replace(match, '**__$&__**') : '**NO CONTENT**'; acc.push({ name: `${val.author.tag} (${val.author.id}) - ${val.id}`, value: text.length < 1024 ? text : text.substring(0, 1013) + '...'