fixed events/* (not including webhookUpdate.ts)
diff --git a/src/events/stickerUpdate.ts b/src/events/stickerUpdate.ts
index 0ac000e..cc11726 100644
--- a/src/events/stickerUpdate.ts
+++ b/src/events/stickerUpdate.ts
@@ -1,21 +1,21 @@
import type { NucleusClient } from "../utils/client.js";
-import type { Sticker } from "discord.js";
+import { AuditLogEvent, GuildAuditLogsEntry, Sticker } from "discord.js";
export const event = "stickerUpdate";
-export async function callback(client: NucleusClient, oe: Sticker, ne: Sticker) {
+export async function callback(client: NucleusClient, oldSticker: Sticker, newSticker: Sticker) {
const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = client.logger;
- if (oe.name === ne.name) return;
- const auditLog = await getAuditLog(ne.guild, "STICKER_UPDATE");
- const audit = auditLog.entries.first();
- if (audit.executor.id === client.user.id) return;
+ if (oldSticker.name === newSticker.name) return;
+ const auditLog = (await getAuditLog(newSticker.guild!, AuditLogEvent.StickerUpdate))
+ .filter((entry: GuildAuditLogsEntry) => (entry.target as Sticker)!.id === newSticker.id)[0] as GuildAuditLogsEntry;
+ if (auditLog.executor!.id === client.user!.id) return;
const changes = {
- stickerId: entry(ne.id, `\`${ne.id}\``),
- edited: entry(ne.createdTimestamp, renderDelta(ne.createdTimestamp)),
- editedBy: entry(audit.executor.id, renderUser((await ne.guild!.members.fetch(audit.executor.id)).user)),
- name: entry([oe.name, ne.name], `\`:${oe.name}:\` -> \`:${ne.name}:\``)
+ stickerId: entry(newSticker.id, `\`${newSticker.id}\``),
+ edited: entry(newSticker.createdTimestamp, renderDelta(newSticker.createdTimestamp)),
+ editedBy: entry(auditLog.executor!.id, renderUser((await newSticker.guild!.members.fetch(auditLog.executor!.id)).user)),
+ name: entry([oldSticker.name, newSticker.name], `\`:${oldSticker.name}:\` -> \`:${newSticker.name}:\``)
};
const data = {
meta: {
@@ -24,11 +24,11 @@
calculateType: "stickerUpdate",
color: NucleusColors.yellow,
emoji: "GUILD.EMOJI.EDIT",
- timestamp: audit.createdTimestamp
+ timestamp: auditLog.createdTimestamp
},
list: changes,
hidden: {
- guild: ne.guild!.id
+ guild: newSticker.guild!.id
}
};
log(data);