blob: 297e6b04ee7886392c4516a633b69f90925f908b [file] [log] [blame]
pineafan63fc5e22022-08-04 22:04:10 +01001export const event = "stickerDelete";
pineafanda6e5342022-07-03 10:03:16 +01002
3export async function callback(client, emoji) {
pineafan63fc5e22022-08-04 22:04:10 +01004 const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = emoji.client.logger;
5 const auditLog = await getAuditLog(emoji.guild, "STICKER_DELETE");
6 const audit = auditLog.entries.filter(entry => entry.target.id === emoji.id).first();
7 if (audit.executor.id === client.user.id) return;
8 const data = {
9 meta: {
10 type: "stickerDelete",
11 displayName: "Sticker Deleted",
12 calculateType: "stickerUpdate",
13 color: NucleusColors.red,
14 emoji: "GUILD.EMOJI.DELETE",
15 timestamp: audit.createdTimestamp
16 },
17 list: {
18 stickerId:entry(emoji.id, `\`${emoji.id}\``),
19 sticker: entry(emoji.name, `\`${emoji.name}\``),
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
pineafanda6e5342022-07-03 10:03:16 +010026 }
pineafan63fc5e22022-08-04 22:04:10 +010027 };
28 log(data);
pineafanda6e5342022-07-03 10:03:16 +010029}