blob: 9e91012e5f3dfa1f48abf11d7149ee0240bac9f9 [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');
pineafane23c4ec2022-07-27 21:56:27 +01007 let audit = auditLog.entries.filter(entry => entry.target.id === emoji.id).first();
8 if (audit.executor.id === client.user.id) return;
pineafane625d782022-05-09 18:04:32 +01009 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: {
pineafanda6e5342022-07-03 10:03:16 +010019 emojiId: entry(emoji.id, `\`${emoji.id}\``),
pineafane625d782022-05-09 18:04:32 +010020 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 }
pineafan4edb7762022-06-26 19:21:04 +010028 log(data);
pineafane625d782022-05-09 18:04:32 +010029 } catch {}
pineafan32767212022-03-14 21:27:39 +000030}