blob: 54de27074c94fb3092270bdb726e2cfae56e80f5 [file] [log] [blame]
pineafan63fc5e22022-08-04 22:04:10 +01001export const event = "stickerCreate";
pineafanda6e5342022-07-03 10:03:16 +01002
3export async function callback(client, emoji) {
Skyler Grey75ea9172022-08-06 10:22:23 +01004 const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } =
5 emoji.client.logger;
pineafan63fc5e22022-08-04 22:04:10 +01006 const auditLog = await getAuditLog(emoji.guild, "STICKER_CREATE");
Skyler Grey75ea9172022-08-06 10:22:23 +01007 const audit = auditLog.entries
8 .filter((entry) => entry.target.id === emoji.id)
9 .first();
pineafan63fc5e22022-08-04 22:04:10 +010010 if (audit.executor.id === client.user.id) return;
11 const data = {
12 meta: {
13 type: "stickerCreate",
14 displayName: "Sticker Created",
15 calculateType: "stickerUpdate",
16 color: NucleusColors.green,
17 emoji: "GUILD.EMOJI.CREATE",
18 timestamp: emoji.createdTimestamp
19 },
20 list: {
21 stickerId: entry(emoji.id, `\`${emoji.id}\``),
22 emoji: entry(emoji.name, `\`:${emoji.name}:\``),
23 createdBy: entry(audit.executor.id, renderUser(audit.executor)),
Skyler Grey75ea9172022-08-06 10:22:23 +010024 created: entry(
25 emoji.createdTimestamp,
26 renderDelta(emoji.createdTimestamp)
27 )
pineafan63fc5e22022-08-04 22:04:10 +010028 },
29 hidden: {
30 guild: emoji.guild.id
pineafanda6e5342022-07-03 10:03:16 +010031 }
pineafan63fc5e22022-08-04 22:04:10 +010032 };
33 log(data);
pineafanda6e5342022-07-03 10:03:16 +010034}