blob: d31b9c67e7146b2a8f95a008c4652c335ada53f6 [file] [log] [blame]
pineafan32767212022-03-14 21:27:39 +00001export const event = 'emojiDelete'
2
3export async function callback(client, emoji) {
4 const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger
5 let auditLog = await getAuditLog(emoji.guild, 'EMOJI_DELETE');
6 let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
7 if (audit.executor.id == client.user.id) return;
8 let data = {
9 meta: {
10 type: 'emojiDelete',
11 displayName: 'Emoji Deleted',
12 calculateType: 'emojiUpdate',
13 color: NucleusColors.red,
14 emoji: "GUILD.EMOJI.DELETE",
15 timestamp: audit.createdTimestamp,
16 },
17 list: {
18 id: entry(emoji.id, `\`${emoji.id}\``),
19 emoji: entry(emoji.name, renderEmoji(emoji)),
20 deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
21 created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp)),
22 deleted: entry(audit.createdTimestamp, renderDelta(audit.createdTimestamp)),
23 },
24 hidden: {
25 guild: emoji.guild.id
26 }
27 }
28 log(data, client);
29}