resetting linux lol
diff --git a/src/events/channelCreate.ts b/src/events/channelCreate.ts
index 3bde0f2..2d48255 100644
--- a/src/events/channelCreate.ts
+++ b/src/events/channelCreate.ts
@@ -55,7 +55,7 @@
timestamp: channel.createdTimestamp
},
list: {
- id: entry(channel.id, `\`${channel.id}\``),
+ channelId: entry(channel.id, `\`${channel.id}\``),
name: entry(channel.name, renderChannel(channel)),
type: entry(channel.type, readableType),
category: entry(channel.parent ? channel.parent.id : null, channel.parent ? channel.parent.name : "Uncategorised"),
diff --git a/src/events/channelDelete.ts b/src/events/channelDelete.ts
index 2188141..5c7139a 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -39,7 +39,7 @@
}
}
let list = {
- id: entry(channel.id, `\`${channel.id}\``),
+ channelIid: entry(channel.id, `\`${channel.id}\``),
name: entry(channel.id, `${channel.name}`),
topic: null,
type: entry(channel.type, readableType),
diff --git a/src/events/channelUpdate.ts b/src/events/channelUpdate.ts
index 560ca11..50a3de1 100644
--- a/src/events/channelUpdate.ts
+++ b/src/events/channelUpdate.ts
@@ -18,7 +18,7 @@
let readableType:string;
let displayName:string ;
let changes = {
- id: entry(nc.id, `\`${nc.id}\``),
+ channelId: entry(nc.id, `\`${nc.id}\``),
channel: entry(nc.id, renderChannel(nc)),
edited: entry(new Date().getTime(), renderDelta(new Date().getTime())),
editedBy: entry(audit.executor.id, renderUser((await nc.guild.members.fetch(audit.executor.id)).user)),
diff --git a/src/events/emojiCreate.ts b/src/events/emojiCreate.ts
index 1048869..25d1b62 100644
--- a/src/events/emojiCreate.ts
+++ b/src/events/emojiCreate.ts
@@ -16,7 +16,7 @@
timestamp: emoji.createdTimestamp
},
list: {
- id: entry(emoji.id, `\`${emoji.id}\``),
+ emojiId: entry(emoji.id, `\`${emoji.id}\``),
emoji: entry(emoji.name, renderEmoji(emoji)),
createdBy: entry(audit.executor.id, renderUser(audit.executor)),
created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp))
diff --git a/src/events/emojiDelete.ts b/src/events/emojiDelete.ts
index 02bec0d..2dcb685 100644
--- a/src/events/emojiDelete.ts
+++ b/src/events/emojiDelete.ts
@@ -16,7 +16,7 @@
timestamp: audit.createdTimestamp,
},
list: {
- id: entry(emoji.id, `\`${emoji.id}\``),
+ emojiId: entry(emoji.id, `\`${emoji.id}\``),
emoji: entry(emoji.name, renderEmoji(emoji)),
deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp)),
diff --git a/src/events/emojiUpdate.ts b/src/events/emojiUpdate.ts
index eb39cb9..79fb171 100644
--- a/src/events/emojiUpdate.ts
+++ b/src/events/emojiUpdate.ts
@@ -12,7 +12,7 @@
if (audit.executor.id == client.user.id) return;
let changes = {
- id: entry(ne.id, `\`${ne.id}\``),
+ emojiId: entry(ne.id, `\`${ne.id}\``),
emoji: entry(ne.id, renderEmoji(ne)),
edited: entry(ne.createdTimestamp, renderDelta(ne.createdTimestamp)),
editedBy: entry(audit.executor.id, renderUser((await ne.guild.members.fetch(audit.executor.id)).user)),
diff --git a/src/events/guildBanAdd.ts b/src/events/guildBanAdd.ts
index a1848fd..05b98ed 100644
--- a/src/events/guildBanAdd.ts
+++ b/src/events/guildBanAdd.ts
@@ -22,7 +22,7 @@
timestamp: new Date().getTime()
},
list: {
- id: entry(ban.user.id, `\`${ban.user.id}\``),
+ memberId: entry(ban.user.id, `\`${ban.user.id}\``),
name: entry(ban.user.id, renderUser(ban.user)),
banned: entry(new Date().getTime(), renderDelta(new Date().getTime())),
bannedBy: entry(audit.executor.id, renderUser(audit.executor)),
diff --git a/src/events/guildBanRemove.ts b/src/events/guildBanRemove.ts
index 59fbf7a..85dc2af 100644
--- a/src/events/guildBanRemove.ts
+++ b/src/events/guildBanRemove.ts
@@ -23,7 +23,7 @@
timestamp: new Date().getTime()
},
list: {
- id: entry(ban.user.id, `\`${ban.user.id}\``),
+ memberId: entry(ban.user.id, `\`${ban.user.id}\``),
name: entry(ban.user.id, renderUser(ban.user)),
unbanned: entry(new Date().getTime(), renderDelta(new Date().getTime())),
unbannedBy: entry(audit.executor.id, renderUser(audit.executor)),
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index 2175aaf..dab89fa 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -23,7 +23,7 @@
timestamp: new Date().getTime()
},
list: {
- id: entry(after.id, `\`${after.id}\``),
+ memberId: entry(after.id, `\`${after.id}\``),
before: entry(before.nickname, before.nickname ? before.nickname : '*None*'),
after: entry(after.nickname, after.nickname ? after.nickname : '*None*'),
updated: entry(new Date().getTime(), renderDelta(new Date().getTime())),
diff --git a/src/events/memberJoin.ts b/src/events/memberJoin.ts
index f3c4d18..2031b12 100644
--- a/src/events/memberJoin.ts
+++ b/src/events/memberJoin.ts
@@ -21,7 +21,7 @@
timestamp: member.joinedTimestamp
},
list: {
- id: entry(member.id, `\`${member.id}\``),
+ memberId: entry(member.id, `\`${member.id}\``),
name: entry(member.id, renderUser(member.user)),
joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
diff --git a/src/events/memberLeave.ts b/src/events/memberLeave.ts
index 43e78bd..b9d6e84 100644
--- a/src/events/memberLeave.ts
+++ b/src/events/memberLeave.ts
@@ -31,7 +31,7 @@
timestamp: new Date().getTime()
},
list: {
- id: entry(member.id, `\`${member.id}\``),
+ memberId: entry(member.id, `\`${member.id}\``),
name: entry(member.id, renderUser(member.user)),
joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
kicked: entry(new Date().getTime(), renderDelta(new Date().getTime())),
@@ -57,7 +57,7 @@
timestamp: new Date().getTime()
},
list: {
- id: entry(member.id, `\`${member.id}\``),
+ memberId: entry(member.id, `\`${member.id}\``),
name: entry(member.id, renderUser(member.user)),
joined: entry(member.joinedTimestamp, renderDelta(member.joinedAt)),
left: entry(new Date().getTime(), renderDelta(new Date().getTime())),
diff --git a/src/events/messageChecks.ts b/src/events/messageChecks.ts
index 4e99c61..2755ff1 100644
--- a/src/events/messageChecks.ts
+++ b/src/events/messageChecks.ts
@@ -1,9 +1,11 @@
import { LinkCheck, MalwareCheck, NSFWCheck, SizeCheck, TestString, TestImage } from '../automations/unscan.js'
import { Message } from 'discord.js'
+import client from '../utils/client.js'
export const event = 'messageCreate'
export async function callback(client, message) {
+ const { log, NucleusColors, entry, renderUser } = client.logger
if (message.author.bot) return
if (message.channel.type === 'dm') return
@@ -16,8 +18,7 @@
!message.author.roles.cache.some(role => config.filters.invite.allowed.roles.includes(role.id))
) {
if ((/(?:https?:\/\/)?discord(?:app)?\.(?:com\/invite|gg)\/[a-zA-Z0-9]+\/?/.test(content))) {
- message.delete();
- return toLog(message, 'invite', content.match(/(?:https?:\/\/)?discord(?:app)?\.(?:com\/invite|gg)\/[a-zA-Z0-9]+\/?/))
+ return message.delete();
}
}
}
@@ -34,22 +35,19 @@
if(/\.+(webp|png|jpg|jpeg|bmp)/.test(url)) {
if (config.filters.images.NSFW && !message.channel.nsfw) {
if (await NSFWCheck(url)) {
- await message.delete()
- return toLog(message, 'NSFW', url)
+ return await message.delete()
}
}
if (config.filters.images.size) {
if(!url.match(/\.+(webp|png|jpg)$/gi)) return
if(!await SizeCheck(element)) {
- await message.delete()
- return toLog(message, 'size', url)
+ return await message.delete()
}
}
}
if (config.filters.malware) {
if (!MalwareCheck(url)) {
- await message.delete()
- return toLog(message, 'malware', url)
+ return await message.delete()
}
}
}
@@ -58,15 +56,13 @@
if(!message) return;
if (await LinkCheck(message)) {
- await message.delete()
- return toLog(message, 'link')
+ return await message.delete()
}
if (config.filters.wordFilter.enabled) {
let check = TestString(content, config.filters.wordFilter.words.loose, config.filters.wordFilter.words.strict)
- if(check != "none") {
- await message.delete()
- return toLog(message, 'wordFilter', content)
+ if(check !== null) {
+ return await message.delete()
}
}
@@ -75,26 +71,19 @@
!message.author.roles.cache.some(role => config.filters.pings.allowed.roles.includes(role.id))
) {
if (config.filters.pings.everyone && message.mentions.everyone) {
- message.delete();
- return toLog(message, 'mention everyone')
+ return message.delete();
}
if (config.filters.pings.roles) {
for(let role of message.mentions.roles) {
if(!message) return;
if (!config.filters.pings.allowed.roles.includes(role.id)) {
- message.delete();
- return toLog(message, 'mention role')
+ return message.delete();
}
}
}
if(!message) return;
if (message.mentions.users.size >= config.filters.pings.mass && config.filters.pings.mass) {
- message.delete();
- return toLog(message, 'Mass Pings')
+ return message.delete();
}
}
}
-
-async function toLog(message: Message, reason: string, data?: any) {
- // log(message.guild.id, {type: reason, data: data})
-}
diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts
index 229b126..f0fbb57 100644
--- a/src/events/messageDelete.ts
+++ b/src/events/messageDelete.ts
@@ -25,7 +25,7 @@
start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : '**Message:** *Message had no content*',
},
list: {
- id: entry(message.id, `\`${message.id}\``),
+ messageId: 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())),
diff --git a/src/events/messageEdit.ts b/src/events/messageEdit.ts
index 0d42fb9..3502963 100644
--- a/src/events/messageEdit.ts
+++ b/src/events/messageEdit.ts
@@ -7,7 +7,37 @@
newMessage.reference = newMessage.reference || {}
let newContent = newMessage.cleanContent.replaceAll("`", "‘")
let oldContent = oldMessage.cleanContent.replaceAll("`", "‘")
- if (newContent == oldContent) return;
+ if (newContent == oldContent) {
+ if (!oldMessage.flags.has("CROSSPOSTED") && newMessage.flags.has("CROSSPOSTED")) {
+ let data = {
+ meta: {
+ type: 'messageAnnounce',
+ displayName: 'Message Published',
+ calculateType: 'messageAnnounce',
+ color: NucleusColors.yellow,
+ emoji: 'MESSAGE.CREATE',
+ timestamp: newMessage.editedTimestamp
+ },
+ separate: {
+ end: `[[Jump to message]](${newMessage.url})`
+ },
+ list: {
+ messageId: entry(newMessage.id, `\`${newMessage.id}\``),
+ sentBy: entry(newMessage.author.id, renderUser(newMessage.author)),
+ sentIn: entry(newMessage.channel.id, renderChannel(newMessage.channel)),
+ sent: entry(new Date(newMessage.createdTimestamp), renderDelta(new Date(newMessage.createdTimestamp))),
+ published: entry(new Date(newMessage.editedTimestamp), renderDelta(new Date(newMessage.editedTimestamp))),
+ mentions: renderNumberDelta(oldMessage.mentions.users.size, newMessage.mentions.users.size),
+ attachments: renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size)
+ },
+ hidden: {
+ guild: newMessage.channel.guild.id
+ }
+ }
+ log(data);
+ }
+ return
+ };
if (newContent.length > 256) newContent = newContent.substring(0, 253) + '...'
if (oldContent.length > 256) oldContent = oldContent.substring(0, 253) + '...'
let data = {
@@ -25,7 +55,7 @@
end: `[[Jump to message]](${newMessage.url})`
},
list: {
- id: entry(newMessage.id, `\`${newMessage.id}\``),
+ messageId: entry(newMessage.id, `\`${newMessage.id}\``),
sentBy: entry(newMessage.author.id, renderUser(newMessage.author)),
sentIn: entry(newMessage.channel.id, renderChannel(newMessage.channel)),
sent: entry(new Date(newMessage.createdTimestamp), renderDelta(new Date(newMessage.createdTimestamp))),
diff --git a/src/events/roleCreate.ts b/src/events/roleCreate.ts
index 61d0a87..6fded26 100644
--- a/src/events/roleCreate.ts
+++ b/src/events/roleCreate.ts
@@ -17,7 +17,7 @@
timestamp: role.createdTimestamp
},
list: {
- id: entry(role.id, `\`${role.id}\``),
+ roleId: entry(role.id, `\`${role.id}\``),
role: entry(role.name, renderRole(role)),
createdBy: entry(audit.executor.id, renderUser(audit.executor)),
created: entry(role.createdTimestamp, renderDelta(role.createdTimestamp))
diff --git a/src/events/roleDelete.ts b/src/events/roleDelete.ts
index b0cb0f7..6a23d9e 100644
--- a/src/events/roleDelete.ts
+++ b/src/events/roleDelete.ts
@@ -19,7 +19,7 @@
timestamp: audit.createdTimestamp,
},
list: {
- id: entry(role.id, `\`${role.id}\``),
+ roleId: entry(role.id, `\`${role.id}\``),
role: entry(role.name, role.name),
color: entry(role.hexColor, `\`${role.hexColor}\``),
showInMemberList: entry(role.hoist, role.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`),
diff --git a/src/events/roleUpdate.ts b/src/events/roleUpdate.ts
index 982d915..baf4399 100644
--- a/src/events/roleUpdate.ts
+++ b/src/events/roleUpdate.ts
@@ -11,7 +11,7 @@
if (audit.executor.id == client.user.id) return;
let changes = {
- id: entry(nr.id, `\`${nr.id}\``),
+ roleId: entry(nr.id, `\`${nr.id}\``),
role: entry(nr.id, renderRole(nr)),
edited: entry(nr.createdTimestamp, renderDelta(nr.createdTimestamp)),
editedBy: entry(audit.executor.id, renderUser((await nr.guild.members.fetch(audit.executor.id)).user)),
diff --git a/src/events/stickerCreate.ts b/src/events/stickerCreate.ts
new file mode 100644
index 0000000..b9511b0
--- /dev/null
+++ b/src/events/stickerCreate.ts
@@ -0,0 +1,30 @@
+export const event = 'stickerCreate'
+
+export async function callback(client, emoji) {
+ try {
+ const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = emoji.client.logger
+ let auditLog = await getAuditLog(emoji.guild, 'STICKER_CREATE');
+ let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
+ if (audit.executor.id == client.user.id) return;
+ let data = {
+ meta: {
+ type: 'stickerCreate',
+ displayName: 'Sticker Created',
+ calculateType: 'stickerUpdate',
+ color: NucleusColors.green,
+ emoji: "GUILD.EMOJI.CREATE",
+ timestamp: emoji.createdTimestamp
+ },
+ list: {
+ stickerId: entry(emoji.id, `\`${emoji.id}\``),
+ emoji: entry(emoji.name, `\`:${emoji.name}:\``),
+ createdBy: entry(audit.executor.id, renderUser(audit.executor)),
+ created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp))
+ },
+ hidden: {
+ guild: emoji.guild.id
+ }
+ }
+ log(data);
+ } catch {}
+}
diff --git a/src/events/stickerDelete.ts b/src/events/stickerDelete.ts
new file mode 100644
index 0000000..7490851
--- /dev/null
+++ b/src/events/stickerDelete.ts
@@ -0,0 +1,31 @@
+export const event = 'stickerDelete'
+
+export async function callback(client, emoji) {
+ try{
+ const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = emoji.client.logger
+ let auditLog = await getAuditLog(emoji.guild, 'STICKER_DELETE');
+ let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
+ if (audit.executor.id == client.user.id) return;
+ let data = {
+ meta: {
+ type: 'stickerDelete',
+ displayName: 'Sticker Deleted',
+ calculateType: 'stickerUpdate',
+ color: NucleusColors.red,
+ emoji: "GUILD.EMOJI.DELETE",
+ timestamp: audit.createdTimestamp,
+ },
+ list: {
+ stickerId:entry(emoji.id, `\`${emoji.id}\``),
+ sticker: entry(emoji.name, `\`${emoji.name}\``),
+ deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
+ created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp)),
+ deleted: entry(audit.createdTimestamp, renderDelta(audit.createdTimestamp)),
+ },
+ hidden: {
+ guild: emoji.guild.id
+ }
+ }
+ log(data);
+ } catch {}
+}
diff --git a/src/events/stickerUpdate.ts b/src/events/stickerUpdate.ts
new file mode 100644
index 0000000..7cb745f
--- /dev/null
+++ b/src/events/stickerUpdate.ts
@@ -0,0 +1,34 @@
+export const event = 'stickerUpdate';
+
+export async function callback(client, oe, ne) {
+ try {
+ const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderEmoji } = client.logger
+
+ if (oe.name == ne.name) return
+ let auditLog = await getAuditLog(ne.guild, 'EMOJI_UPDATE');
+ let audit = auditLog.entries.first();
+ if (audit.executor.id == client.user.id) return;
+
+ let changes = {
+ stickerId:entry(ne.id, `\`${ne.id}\``),
+ edited: entry(ne.createdTimestamp, renderDelta(ne.createdTimestamp)),
+ editedBy: entry(audit.executor.id, renderUser((await ne.guild.members.fetch(audit.executor.id)).user)),
+ name: entry([oe.name, ne.name], `\`:${oe.name}:\` -> \`:${ne.name}:\``),
+ }
+ let data = {
+ meta:{
+ type: 'stickerUpdate',
+ displayName: 'Sticker Edited',
+ calculateType: 'stickerUpdate',
+ color: NucleusColors.yellow,
+ emoji: "GUILD.EMOJI.EDIT",
+ timestamp: audit.createdTimestamp
+ },
+ list: changes,
+ hidden: {
+ guild: ne.guild.id
+ }
+ }
+ log(data);
+ } catch {}
+}
\ No newline at end of file
diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts
index 5c65d78..ff69e35 100644
--- a/src/events/threadCreate.ts
+++ b/src/events/threadCreate.ts
@@ -17,7 +17,7 @@
timestamp: thread.createdTimestamp
},
list: {
- id: entry(thread.id, `\`${thread.id}\``),
+ threadId:entry(thread.id, `\`${thread.id}\``),
name: entry(thread.name, renderChannel(thread)),
parentChannel: entry(thread.parentId, renderChannel(thread.parent)),
category: entry(thread.parent.parent ? thread.parent.parent.name : 'None', thread.parent.parent ? renderChannel(thread.parent.parent) : 'None'),
diff --git a/src/events/threadDelete.ts b/src/events/threadDelete.ts
index 9507469..14c5820 100644
--- a/src/events/threadDelete.ts
+++ b/src/events/threadDelete.ts
@@ -17,7 +17,7 @@
timestamp: new Date().getTime()
},
list: {
- id: entry(thread.id, `\`${thread.id}\``),
+ threadId:entry(thread.id, `\`${thread.id}\``),
name: entry(thread.name, thread.name),
parentChannel: entry(thread.parentId, renderChannel(thread.parent)),
category: entry(thread.parent.parent ? thread.parent.parent.name : 'None', thread.parent.parent ? renderChannel(thread.parent.parent) : 'None'),
diff --git a/src/events/threadUpdate.ts b/src/events/threadUpdate.ts
index f554a6c..4e13193 100644
--- a/src/events/threadUpdate.ts
+++ b/src/events/threadUpdate.ts
@@ -8,7 +8,7 @@
let audit = auditLog.entries.filter(entry => entry.target.id == after.id).first();
if (audit.executor.id == client.user.id) return;
let list = {
- id: entry(after.id, `\`${after.id}\``),
+ threadId:entry(after.id, `\`${after.id}\``),
thread: entry(after.name, renderChannel(after)),
parentChannel: entry(after.parentId, renderChannel(after.parent)),
}
diff --git a/src/events/webhookUpdate.ts b/src/events/webhookUpdate.ts
new file mode 100644
index 0000000..a20608c
--- /dev/null
+++ b/src/events/webhookUpdate.ts
@@ -0,0 +1,78 @@
+import humanizeDuration from 'humanize-duration';
+export const event = 'webhookUpdate'
+
+export async function callback(client, channel) {
+ try {
+ const { getAuditLog, log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger
+ let auditLogCreate = getAuditLog(channel.guild, 'WEBHOOK_CREATE');
+ let auditLogUpdate = getAuditLog(channel.guild, 'WEBHOOK_UPDATE');
+ let auditLogDelete = getAuditLog(channel.guild, 'WEBHOOK_DELETE');
+ [auditLogCreate, auditLogUpdate, auditLogDelete] = await Promise.all([auditLogCreate, auditLogUpdate, auditLogDelete]);
+ let auditCreate = auditLogCreate.entries.filter(entry => entry.target.channelId == channel.id).first();
+ let auditUpdate = auditLogUpdate.entries.filter(entry => entry.target.channelId == channel.id).first();
+ let auditDelete = auditLogDelete.entries.filter(entry => entry.target.channelId == channel.id).first();
+ if (!auditCreate && !auditUpdate && !auditDelete) return;
+ let audit = auditCreate;
+ let action = "Create";
+ let list = {} as any;
+ if (auditUpdate && auditUpdate.createdTimestamp > audit.createdTimestamp) {
+ let {before, after} = auditUpdate.changes.reduce(
+ (acc, change) => { acc.before[change.key] = change.old; acc.after[change.key] = change.new; return acc; },
+ {before: {}, after: {}}
+ );
+ if (before.name !== after.name) list['name'] = entry([before.name, after.name], `${before.name} -> ${after.name}`)
+ if (before.channel_id !== after.channel_id) list['channel'] = entry([before.channel_id, after.channel_id], renderChannel(await client.channels.fetch(before.channel_id)) + ` -> ` + renderChannel(await client.channels.fetch(after.channel_id)))
+ if (!(Object.keys(list)).length) return;
+ list.created = entry(auditUpdate.target.createdTimestamp, renderDelta(auditUpdate.target.createdTimestamp));
+ list.edited = entry(after.editedTimestamp, renderDelta(new Date().getTime()));
+ list.editedBy = entry(auditUpdate.executor.id, renderUser(auditUpdate.executor));
+ audit = auditUpdate;
+ action = "Update"
+ } else if (auditDelete && auditDelete.createdTimestamp > audit.createdTimestamp) {
+ let {before, after} = auditDelete.changes.reduce(
+ (acc, change) => { acc.before[change.key] = change.old; acc.after[change.key] = change.new; return acc; },
+ {before: {}, after: {}}
+ );
+ list = {
+ name: entry(before.name, `${before.name}`),
+ channel: entry(before.channel_id, renderChannel(await client.channels.fetch(before.channel_id))),
+ created: entry(auditDelete.target.createdTimestamp, renderDelta(auditDelete.target.createdTimestamp)),
+ deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ deletedBy: entry(auditDelete.executor.id, renderUser((await channel.guild.members.fetch(auditDelete.executor.id)).user)),
+ }
+ audit = auditDelete;
+ action = "Delete"
+ } else {
+ let {before, after} = auditDelete.changes.reduce(
+ (acc, change) => { acc.before[change.key] = change.old; acc.after[change.key] = change.new; return acc; },
+ {before: {}, after: {}}
+ );
+ list = {
+ name: entry(before.name, `${before.name}`),
+ channel: entry(before.channel_id, renderChannel(await client.channels.fetch(before.channel_id))),
+ createdBy: entry(auditCreate.executor.id, renderUser((await channel.guild.members.fetch(auditCreate.executor.id)).user)),
+ created: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ }
+ }
+ let cols = {
+ "Create": "green",
+ "Update": "yellow",
+ "Delete": "red",
+ }
+ let data = {
+ meta: {
+ type: 'webhook' + action,
+ displayName: `Webhook ${action}d`,
+ calculateType: 'webhookUpdate',
+ color: NucleusColors[cols[action]],
+ emoji: "WEBHOOK." + action.toUpperCase(),
+ timestamp: new Date().getTime()
+ },
+ list: list,
+ hidden: {
+ guild: channel.guild.id
+ }
+ } // TODO
+ log(data);
+ } catch(e) { console.log(e) }
+}