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