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