pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 1 | export const event = "stickerUpdate"; |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 2 | |
| 3 | export async function callback(client, oe, ne) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 4 | const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = |
| 5 | client.logger; |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 6 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 7 | 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; |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 11 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 12 | const changes = { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 13 | stickerId: entry(ne.id, `\`${ne.id}\``), |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 14 | edited: entry(ne.createdTimestamp, renderDelta(ne.createdTimestamp)), |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 15 | editedBy: entry( |
| 16 | audit.executor.id, |
| 17 | renderUser((await ne.guild.members.fetch(audit.executor.id)).user) |
| 18 | ), |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 19 | name: entry([oe.name, ne.name], `\`:${oe.name}:\` -> \`:${ne.name}:\``) |
| 20 | }; |
| 21 | const data = { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 22 | meta: { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 23 | 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 |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 33 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 34 | }; |
| 35 | log(data); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 36 | } |