pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 1 | export const event = 'stickerUpdate'; |
| 2 | |
| 3 | export async function callback(client, oe, ne) { |
| 4 | try { |
| 5 | const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderEmoji } = client.logger |
| 6 | |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame^] | 7 | if (oe.name === ne.name) return |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 8 | let auditLog = await getAuditLog(ne.guild, 'EMOJI_UPDATE'); |
| 9 | let audit = auditLog.entries.first(); |
pineafan | e23c4ec | 2022-07-27 21:56:27 +0100 | [diff] [blame^] | 10 | if (audit.executor.id === client.user.id) return; |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 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 | } |