few changes
diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts
index ccaacb8..f0f5e00 100644
--- a/src/events/messageDelete.ts
+++ b/src/events/messageDelete.ts
@@ -1,38 +1,45 @@
export const event = 'messageDelete'
export async function callback(client, message) {
- if (message.author.id == client.user.id) return;
- const { log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = message.channel.client.logger
- message.reference = message.reference || {}
- let content = message.cleanContent
- if (content.length > 256) content = content.substring(0, 253) + '...'
- let data = {
- meta: {
- type: 'messageDelete',
- displayName: 'Message Deleted',
- calculateType: 'messageDelete',
- color: NucleusColors.red,
- emoji: 'MESSAGE.DELETE',
- timestamp: new Date().getTime()
- },
- separate: {
- start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
- },
- list: {
- id: entry(message.id, `\`${message.id}\``),
- sentBy: entry(message.author.id, renderUser(message.author)),
- sentIn: entry(message.channel.id, renderChannel(message.channel)),
- deleted: entry(new Date(message.createdTimestamp), renderDelta(new Date(message.createdTimestamp))),
- mentions: message.mentions.users.size,
- attachments: message.attachments.size,
- repliedTo: entry(
- message.reference.messageId || null,
- message.reference.messageId ? `[[Jump to message]](https://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.reference.messageId})` : "None"
- )
- },
- hidden: {
- guild: message.channel.guild.id
+ try {
+ if (message.author.id == client.user.id) return;
+ const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = message.channel.client.logger
+ let auditLog = await getAuditLog(message.guild, 'MEMBER_BAN_ADD')
+ let audit = auditLog.entries.filter(entry => entry.target.id == message.author.id).first();
+ if (audit) {
+ if (audit.createdAt - 100 < new Date().getTime()) return;
}
- }
- log(data, client);
+ message.reference = message.reference || {}
+ let content = message.cleanContent
+ if (content.length > 256) content = content.substring(0, 253) + '...'
+ let data = {
+ meta: {
+ type: 'messageDelete',
+ displayName: 'Message Deleted',
+ calculateType: 'messageDelete',
+ color: NucleusColors.red,
+ emoji: 'MESSAGE.DELETE',
+ timestamp: new Date().getTime()
+ },
+ separate: {
+ start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
+ },
+ list: {
+ id: entry(message.id, `\`${message.id}\``),
+ sentBy: entry(message.author.id, renderUser(message.author)),
+ sentIn: entry(message.channel.id, renderChannel(message.channel)),
+ deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ mentions: message.mentions.users.size,
+ attachments: message.attachments.size,
+ repliedTo: entry(
+ message.reference.messageId || null,
+ message.reference.messageId ? `[[Jump to message]](https://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.reference.messageId})` : "None"
+ )
+ },
+ hidden: {
+ guild: message.channel.guild.id
+ }
+ }
+ log(data, client);
+ } catch {}
}