blob: 662f98118549a7a16bef835676dc8fca7b6a86e0 [file] [log] [blame]
pineafan63fc5e22022-08-04 22:04:10 +01001export const event = "stickerUpdate";
pineafanda6e5342022-07-03 10:03:16 +01002
3export async function callback(client, oe, ne) {
Skyler Grey11236ba2022-08-08 21:13:33 +01004 const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = client.logger;
pineafanda6e5342022-07-03 10:03:16 +01005
pineafan63fc5e22022-08-04 22:04:10 +01006 if (oe.name === ne.name) return;
7 const auditLog = await getAuditLog(ne.guild, "EMOJI_UPDATE");
8 const audit = auditLog.entries.first();
9 if (audit.executor.id === client.user.id) return;
pineafanda6e5342022-07-03 10:03:16 +010010
pineafan63fc5e22022-08-04 22:04:10 +010011 const changes = {
Skyler Grey75ea9172022-08-06 10:22:23 +010012 stickerId: entry(ne.id, `\`${ne.id}\``),
pineafan63fc5e22022-08-04 22:04:10 +010013 edited: entry(ne.createdTimestamp, renderDelta(ne.createdTimestamp)),
Skyler Grey11236ba2022-08-08 21:13:33 +010014 editedBy: entry(audit.executor.id, renderUser((await ne.guild.members.fetch(audit.executor.id)).user)),
pineafan63fc5e22022-08-04 22:04:10 +010015 name: entry([oe.name, ne.name], `\`:${oe.name}:\` -> \`:${ne.name}:\``)
16 };
17 const data = {
Skyler Grey75ea9172022-08-06 10:22:23 +010018 meta: {
pineafan63fc5e22022-08-04 22:04:10 +010019 type: "stickerUpdate",
20 displayName: "Sticker Edited",
21 calculateType: "stickerUpdate",
22 color: NucleusColors.yellow,
23 emoji: "GUILD.EMOJI.EDIT",
24 timestamp: audit.createdTimestamp
25 },
26 list: changes,
27 hidden: {
28 guild: ne.guild.id
pineafanda6e5342022-07-03 10:03:16 +010029 }
pineafan63fc5e22022-08-04 22:04:10 +010030 };
31 log(data);
Skyler Grey75ea9172022-08-06 10:22:23 +010032}