pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 1 | export const event = "emojiCreate"; |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 2 | |
| 3 | export async function callback(client, emoji) { |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 4 | const { |
| 5 | getAuditLog, |
| 6 | log, |
| 7 | NucleusColors, |
| 8 | entry, |
| 9 | renderUser, |
| 10 | renderDelta, |
| 11 | renderEmoji |
| 12 | } = emoji.client.logger; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 13 | const auditLog = await getAuditLog(emoji.guild, "EMOJI_CREATE"); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 14 | const audit = auditLog.entries |
| 15 | .filter((entry) => entry.target.id === emoji.id) |
| 16 | .first(); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 17 | if (audit.executor.id === client.user.id) return; |
| 18 | const data = { |
| 19 | meta: { |
| 20 | type: "emojiCreate", |
| 21 | displayName: "Emoji Created", |
| 22 | calculateType: "emojiUpdate", |
| 23 | color: NucleusColors.green, |
| 24 | emoji: "GUILD.EMOJI.CREATE", |
| 25 | timestamp: emoji.createdTimestamp |
| 26 | }, |
| 27 | list: { |
| 28 | emojiId: entry(emoji.id, `\`${emoji.id}\``), |
| 29 | emoji: entry(emoji.name, renderEmoji(emoji)), |
| 30 | createdBy: entry(audit.executor.id, renderUser(audit.executor)), |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 31 | created: entry( |
| 32 | emoji.createdTimestamp, |
| 33 | renderDelta(emoji.createdTimestamp) |
| 34 | ) |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 35 | }, |
| 36 | hidden: { |
| 37 | guild: emoji.guild.id |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 38 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 39 | }; |
| 40 | log(data); |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 41 | } |