blob: 83a30e298e494fe075616b30173d4b13663c7eaf [file] [log] [blame]
pineafan63fc5e22022-08-04 22:04:10 +01001export const event = "emojiCreate";
pineafan32767212022-03-14 21:27:39 +00002
3export async function callback(client, emoji) {
pineafan63fc5e22022-08-04 22:04:10 +01004 const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger;
5 const auditLog = await getAuditLog(emoji.guild, "EMOJI_CREATE");
6 const audit = auditLog.entries.filter(entry => entry.target.id === emoji.id).first();
7 if (audit.executor.id === client.user.id) return;
8 const data = {
9 meta: {
10 type: "emojiCreate",
11 displayName: "Emoji Created",
12 calculateType: "emojiUpdate",
13 color: NucleusColors.green,
14 emoji: "GUILD.EMOJI.CREATE",
15 timestamp: emoji.createdTimestamp
16 },
17 list: {
18 emojiId: entry(emoji.id, `\`${emoji.id}\``),
19 emoji: entry(emoji.name, renderEmoji(emoji)),
20 createdBy: entry(audit.executor.id, renderUser(audit.executor)),
21 created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp))
22 },
23 hidden: {
24 guild: emoji.guild.id
pineafan32767212022-03-14 21:27:39 +000025 }
pineafan63fc5e22022-08-04 22:04:10 +010026 };
27 log(data);
pineafan32767212022-03-14 21:27:39 +000028}