blob: 363e0720d9985baee5a2848d35429df84310c3ad [file] [log] [blame]
pineafanda6e5342022-07-03 10:03:16 +01001export const event = 'stickerUpdate';
2
3export async function callback(client, oe, ne) {
4 try {
5 const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderEmoji } = client.logger
6
pineafane23c4ec2022-07-27 21:56:27 +01007 if (oe.name === ne.name) return
pineafanda6e5342022-07-03 10:03:16 +01008 let auditLog = await getAuditLog(ne.guild, 'EMOJI_UPDATE');
9 let audit = auditLog.entries.first();
pineafane23c4ec2022-07-27 21:56:27 +010010 if (audit.executor.id === client.user.id) return;
pineafanda6e5342022-07-03 10:03:16 +010011
12 let changes = {
13 stickerId:entry(ne.id, `\`${ne.id}\``),
14 edited: entry(ne.createdTimestamp, renderDelta(ne.createdTimestamp)),
15 editedBy: entry(audit.executor.id, renderUser((await ne.guild.members.fetch(audit.executor.id)).user)),
16 name: entry([oe.name, ne.name], `\`:${oe.name}:\` -> \`:${ne.name}:\``),
17 }
18 let data = {
19 meta:{
20 type: 'stickerUpdate',
21 displayName: 'Sticker Edited',
22 calculateType: 'stickerUpdate',
23 color: NucleusColors.yellow,
24 emoji: "GUILD.EMOJI.EDIT",
25 timestamp: audit.createdTimestamp
26 },
27 list: changes,
28 hidden: {
29 guild: ne.guild.id
30 }
31 }
32 log(data);
33 } catch {}
34}