blob: f390b5c1380f6c7ca0afe75c417e72de7ee2ea3d [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 Grey75ea9172022-08-06 10:22:23 +01004 const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } =
5 emoji.client.logger;
pineafan63fc5e22022-08-04 22:04:10 +01006 const auditLog = await getAuditLog(emoji.guild, "STICKER_DELETE");
Skyler Grey75ea9172022-08-06 10:22:23 +01007 const audit = auditLog.entries
8 .filter((entry) => entry.target.id === emoji.id)
9 .first();
pineafan63fc5e22022-08-04 22:04:10 +010010 if (audit.executor.id === client.user.id) return;
11 const data = {
12 meta: {
13 type: "stickerDelete",
14 displayName: "Sticker Deleted",
15 calculateType: "stickerUpdate",
16 color: NucleusColors.red,
17 emoji: "GUILD.EMOJI.DELETE",
18 timestamp: audit.createdTimestamp
19 },
20 list: {
Skyler Grey75ea9172022-08-06 10:22:23 +010021 stickerId: entry(emoji.id, `\`${emoji.id}\``),
pineafan63fc5e22022-08-04 22:04:10 +010022 sticker: entry(emoji.name, `\`${emoji.name}\``),
23 deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
Skyler Grey75ea9172022-08-06 10:22:23 +010024 created: entry(
25 emoji.createdTimestamp,
26 renderDelta(emoji.createdTimestamp)
27 ),
28 deleted: entry(
29 audit.createdTimestamp,
30 renderDelta(audit.createdTimestamp)
31 )
pineafan63fc5e22022-08-04 22:04:10 +010032 },
33 hidden: {
34 guild: emoji.guild.id
pineafanda6e5342022-07-03 10:03:16 +010035 }
pineafan63fc5e22022-08-04 22:04:10 +010036 };
37 log(data);
pineafanda6e5342022-07-03 10:03:16 +010038}