wordwatcher tweak

This commit is contained in:
Erik 2021-06-12 16:47:53 +03:00
parent 287bcd6cf4
commit e77f3c6254
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16

View File

@ -321,7 +321,7 @@ module.exports = class AutoModeration extends Observer {
for (const reg of words) { for (const reg of words) {
match = content.match(new RegExp(` ${reg} `, 'iu')); match = content.match(new RegExp(`(?:^|\\s)${reg}`, 'iu'));
if (match) break; if (match) break;
@ -337,7 +337,7 @@ module.exports = class AutoModeration extends Observer {
`, // ** User:** <@${ author.id }> `, // ** User:** <@${ author.id }>
color: 15120384, color: 15120384,
fields: context.reverse().reduce((acc, val) => { 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({ acc.push({
name: `${val.author.tag} (${val.author.id}) - ${val.id}`, name: `${val.author.tag} (${val.author.id}) - ${val.id}`,
value: text.length < 1024 ? text : text.substring(0, 1013) + '...' value: text.length < 1024 ? text : text.substring(0, 1013) + '...'