blob: 46c4d177f0edab0030f0e538b5ecfaf5ef0398b6 [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 Grey75ea9172022-08-06 10:22:23 +01004 const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } =
5 client.logger;
pineafanda6e5342022-07-03 10:03:16 +01006
pineafan63fc5e22022-08-04 22:04:10 +01007 if (oe.name === ne.name) return;
8 const auditLog = await getAuditLog(ne.guild, "EMOJI_UPDATE");
9 const audit = auditLog.entries.first();
10 if (audit.executor.id === client.user.id) return;
pineafanda6e5342022-07-03 10:03:16 +010011
pineafan63fc5e22022-08-04 22:04:10 +010012 const changes = {
Skyler Grey75ea9172022-08-06 10:22:23 +010013 stickerId: entry(ne.id, `\`${ne.id}\``),
pineafan63fc5e22022-08-04 22:04:10 +010014 edited: entry(ne.createdTimestamp, renderDelta(ne.createdTimestamp)),
Skyler Grey75ea9172022-08-06 10:22:23 +010015 editedBy: entry(
16 audit.executor.id,
17 renderUser((await ne.guild.members.fetch(audit.executor.id)).user)
18 ),
pineafan63fc5e22022-08-04 22:04:10 +010019 name: entry([oe.name, ne.name], `\`:${oe.name}:\` -> \`:${ne.name}:\``)
20 };
21 const data = {
Skyler Grey75ea9172022-08-06 10:22:23 +010022 meta: {
pineafan63fc5e22022-08-04 22:04:10 +010023 type: "stickerUpdate",
24 displayName: "Sticker Edited",
25 calculateType: "stickerUpdate",
26 color: NucleusColors.yellow,
27 emoji: "GUILD.EMOJI.EDIT",
28 timestamp: audit.createdTimestamp
29 },
30 list: changes,
31 hidden: {
32 guild: ne.guild.id
pineafanda6e5342022-07-03 10:03:16 +010033 }
pineafan63fc5e22022-08-04 22:04:10 +010034 };
35 log(data);
Skyler Grey75ea9172022-08-06 10:22:23 +010036}