blob: 7cb745f7afb774edf895a875718c874f4789c6f3 [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
7 if (oe.name == ne.name) return
8 let auditLog = await getAuditLog(ne.guild, 'EMOJI_UPDATE');
9 let audit = auditLog.entries.first();
10 if (audit.executor.id == client.user.id) return;
11
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}