regex tweak + promise catching

This commit is contained in:
Erik 2021-06-15 23:46:50 +03:00
parent fb06170380
commit 5870b68712
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16
2 changed files with 8 additions and 4 deletions

View File

@ -321,7 +321,7 @@ module.exports = class AutoModeration extends Observer {
for (const reg of words) {
match = content.match(new RegExp(`(?:^|\\s)${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 ? Util.escapeMarkdown(val.content).replace(match, '**__$&__**') : '**NO CONTENT**';
const text = val.content.length ? Util.escapeMarkdown(val.content).replace(match[1], '**__$&__**') : '**NO CONTENT**';
acc.push({
name: `${val.author.tag} (${val.author.id}) - ${val.id}`,
value: text.length < 1024 ? text : text.substring(0, 1013) + '...'
@ -350,7 +350,9 @@ module.exports = class AutoModeration extends Observer {
}, [])
};
const sent = await logChannel.send({ embed });
const sent = await logChannel.send({ embed }).catch((err) => {
this.client.logger.error('Error in message flag:\n' + err.stack);
});
}

View File

@ -219,7 +219,9 @@ class GuildLogger extends Observer {
}
hook.send({ embeds: [embed], files: uploadedFiles });
await hook.send({ embeds: [embed], files: uploadedFiles }).catch((err) => {
this.client.logger.error('Error in message delete:\n' + err.stack);
});
/*
if(message.attachments.size > 0) {