blob: 53f564c4744a3d078149a0416785614c5f85c4dd [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) {
Skyler Grey75ea9172022-08-06 10:22:23 +01004 const {
5 getAuditLog,
6 log,
7 NucleusColors,
8 entry,
9 renderUser,
10 renderDelta,
11 renderEmoji
12 } = emoji.client.logger;
pineafan63fc5e22022-08-04 22:04:10 +010013 const auditLog = await getAuditLog(emoji.guild, "EMOJI_CREATE");
Skyler Grey75ea9172022-08-06 10:22:23 +010014 const audit = auditLog.entries
15 .filter((entry) => entry.target.id === emoji.id)
16 .first();
pineafan63fc5e22022-08-04 22:04:10 +010017 if (audit.executor.id === client.user.id) return;
18 const data = {
19 meta: {
20 type: "emojiCreate",
21 displayName: "Emoji Created",
22 calculateType: "emojiUpdate",
23 color: NucleusColors.green,
24 emoji: "GUILD.EMOJI.CREATE",
25 timestamp: emoji.createdTimestamp
26 },
27 list: {
28 emojiId: entry(emoji.id, `\`${emoji.id}\``),
29 emoji: entry(emoji.name, renderEmoji(emoji)),
30 createdBy: entry(audit.executor.id, renderUser(audit.executor)),
Skyler Grey75ea9172022-08-06 10:22:23 +010031 created: entry(
32 emoji.createdTimestamp,
33 renderDelta(emoji.createdTimestamp)
34 )
pineafan63fc5e22022-08-04 22:04:10 +010035 },
36 hidden: {
37 guild: emoji.guild.id
pineafan32767212022-03-14 21:27:39 +000038 }
pineafan63fc5e22022-08-04 22:04:10 +010039 };
40 log(data);
pineafan32767212022-03-14 21:27:39 +000041}