pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 1 | export const event = 'emojiDelete' |
| 2 | |
| 3 | export async function callback(client, emoji) { |
pineafan | e625d78 | 2022-05-09 18:04:32 +0100 | [diff] [blame] | 4 | try{ |
| 5 | const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger |
| 6 | let auditLog = await getAuditLog(emoji.guild, 'EMOJI_DELETE'); |
| 7 | let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first(); |
| 8 | if (audit.executor.id == client.user.id) return; |
| 9 | let data = { |
| 10 | meta: { |
| 11 | type: 'emojiDelete', |
| 12 | displayName: 'Emoji Deleted', |
| 13 | calculateType: 'emojiUpdate', |
| 14 | color: NucleusColors.red, |
| 15 | emoji: "GUILD.EMOJI.DELETE", |
| 16 | timestamp: audit.createdTimestamp, |
| 17 | }, |
| 18 | list: { |
| 19 | id: entry(emoji.id, `\`${emoji.id}\``), |
| 20 | emoji: entry(emoji.name, renderEmoji(emoji)), |
| 21 | deletedBy: entry(audit.executor.id, renderUser(audit.executor)), |
| 22 | created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp)), |
| 23 | deleted: entry(audit.createdTimestamp, renderDelta(audit.createdTimestamp)), |
| 24 | }, |
| 25 | hidden: { |
| 26 | guild: emoji.guild.id |
| 27 | } |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 28 | } |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame^] | 29 | log(data); |
pineafan | e625d78 | 2022-05-09 18:04:32 +0100 | [diff] [blame] | 30 | } catch {} |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 31 | } |