regex tweak + promise catching
This commit is contained in:
parent
fb06170380
commit
5870b68712
@ -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(`(?:^|\\s)${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 ? Util.escapeMarkdown(val.content).replace(match, '**__$&__**') : '**NO CONTENT**';
|
const text = val.content.length ? Util.escapeMarkdown(val.content).replace(match[1], '**__$&__**') : '**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) + '...'
|
||||||
@ -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);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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) {
|
if(message.attachments.size > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user