blob: 0431bda49a6a4a6fea23aeaef20808588cff5c93 [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');
pineafane23c4ec2022-07-27 21:56:27 +01007 let audit = auditLog.entries.filter(entry => entry.target.id === emoji.id).first();
8 if (audit.executor.id === client.user.id) return;
pineafanda6e5342022-07-03 10:03:16 +01009 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}