Much more typing
diff --git a/src/events/inviteCreate.ts b/src/events/inviteCreate.ts
index 7b23bb2..fb35b7e 100644
--- a/src/events/inviteCreate.ts
+++ b/src/events/inviteCreate.ts
@@ -1,10 +1,15 @@
+import type { GuildAuditLogsEntry, Invite } from "discord.js";
+// @ts-expect-error
import humanizeDuration from "humanize-duration";
+// @ts-expect-error
+import type { HaikuClient } from "jshaiku";
+
export const event = "inviteCreate";
-export async function callback(client, invite) {
- const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = invite.client.logger;
+export async function callback(client: HaikuClient, invite: Invite) {
+ const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
const auditLog = await getAuditLog(invite.guild, "INVITE_CREATE");
- const audit = auditLog.entries.filter((entry) => entry.target.id === invite.id).first();
+ const audit = auditLog.entries.filter((entry: GuildAuditLogsEntry) => entry.target!.id === invite.inviterId).first();
if (audit.executor.id === client.user.id) return;
const data = {
meta: {
@@ -23,7 +28,7 @@
created: entry(invite.createdTimestamp, renderDelta(invite.createdTimestamp))
},
hidden: {
- guild: invite.guild.id
+ guild: invite.guild!.id
}
};
log(data);