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