pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 1 | export const event = "stickerCreate"; |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 2 | |
| 3 | export async function callback(client, emoji) { |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame^] | 4 | const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = emoji.client.logger; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 5 | const auditLog = await getAuditLog(emoji.guild, "STICKER_CREATE"); |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame^] | 6 | const audit = auditLog.entries.filter((entry) => entry.target.id === emoji.id).first(); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 7 | if (audit.executor.id === client.user.id) return; |
| 8 | const data = { |
| 9 | meta: { |
| 10 | type: "stickerCreate", |
| 11 | displayName: "Sticker Created", |
| 12 | calculateType: "stickerUpdate", |
| 13 | color: NucleusColors.green, |
| 14 | emoji: "GUILD.EMOJI.CREATE", |
| 15 | timestamp: emoji.createdTimestamp |
| 16 | }, |
| 17 | list: { |
| 18 | stickerId: entry(emoji.id, `\`${emoji.id}\``), |
| 19 | emoji: entry(emoji.name, `\`:${emoji.name}:\``), |
| 20 | createdBy: entry(audit.executor.id, renderUser(audit.executor)), |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame^] | 21 | created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp)) |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 22 | }, |
| 23 | hidden: { |
| 24 | guild: emoji.guild.id |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 25 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 26 | }; |
| 27 | log(data); |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 28 | } |