blob: 7ac17cec821b838749f3056dc2893966515ae31e [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) {
Skyler Grey11236ba2022-08-08 21:13:33 +01004 const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = emoji.client.logger;
pineafan63fc5e22022-08-04 22:04:10 +01005 const auditLog = await getAuditLog(emoji.guild, "STICKER_DELETE");
Skyler Grey11236ba2022-08-08 21:13:33 +01006 const audit = auditLog.entries.filter((entry) => entry.target.id === emoji.id).first();
pineafan63fc5e22022-08-04 22:04:10 +01007 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: {
Skyler Grey75ea9172022-08-06 10:22:23 +010018 stickerId: entry(emoji.id, `\`${emoji.id}\``),
pineafan63fc5e22022-08-04 22:04:10 +010019 sticker: entry(emoji.name, `\`${emoji.name}\``),
20 deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
Skyler Grey11236ba2022-08-08 21:13:33 +010021 created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp)),
22 deleted: entry(audit.createdTimestamp, renderDelta(audit.createdTimestamp))
pineafan63fc5e22022-08-04 22:04:10 +010023 },
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}