blob: c1ed3c56610df3e4520403e6c6dc2589df071fcc [file] [log] [blame]
pineafan32767212022-03-14 21:27:39 +00001export const event = 'emojiCreate'
2
3export async function callback(client, emoji) {
pineafane625d782022-05-09 18:04:32 +01004 try {
5 const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger
6 let auditLog = await getAuditLog(emoji.guild, 'EMOJI_CREATE');
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: 'emojiCreate',
12 displayName: 'Emoji Created',
13 calculateType: 'emojiUpdate',
14 color: NucleusColors.green,
15 emoji: "GUILD.EMOJI.CREATE",
16 timestamp: emoji.createdTimestamp
17 },
18 list: {
19 id: entry(emoji.id, `\`${emoji.id}\``),
20 emoji: entry(emoji.name, renderEmoji(emoji)),
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 }
pineafan32767212022-03-14 21:27:39 +000027 }
pineafane625d782022-05-09 18:04:32 +010028 log(data, client);
29 } catch {}
pineafan32767212022-03-14 21:27:39 +000030}