diff --git a/src/events/channelDelete.ts b/src/events/channelDelete.ts
index d42a12a..e92676d 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -48,15 +48,15 @@
         }
     }
     const list: {
-        channelId: { value: string; displayValue: string };
-        name: { value: string; displayValue: string };
-        topic?: { value: string; displayValue: string } | null;
-        type: { value: string; displayValue: string };
-        category: { value: string; displayValue: string };
-        nsfw?: { value: string; displayValue: string } | null;
-        created: { value: string; displayValue: string };
-        deleted: { value: string; displayValue: string };
-        deletedBy: { value: string; displayValue: string };
+        channelId: ReturnType<typeof entry>;
+        name: ReturnType<typeof entry>;
+        topic?: ReturnType<typeof entry> | null;
+        type: ReturnType<typeof entry>;
+        category: ReturnType<typeof entry>;
+        nsfw?: ReturnType<typeof entry> | null;
+        created: ReturnType<typeof entry>;
+        deleted: ReturnType<typeof entry>;
+        deletedBy: ReturnType<typeof entry>;
     } = {
         channelId: entry(channel.id, `\`${channel.id}\``),
         name: entry(channel.id, `${channel.name}`),
diff --git a/src/events/threadUpdate.ts b/src/events/threadUpdate.ts
index 144dc84..4df2587 100644
--- a/src/events/threadUpdate.ts
+++ b/src/events/threadUpdate.ts
@@ -1,38 +1,43 @@
+import type { GuildAuditLogsEntry, ThreadChannel } from "discord.js";
+// @ts-expect-error
 import humanizeDuration from "humanize-duration";
+// @ts-expect-error
+import type { HaikuClient } from "jshaiku";
+
 export const event = "threadUpdate";
 
-export async function callback(client, before, after) {
-    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = after.client.logger;
+export async function callback(client: HaikuClient, before: ThreadChannel, after: ThreadChannel) {
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
     const auditLog = await getAuditLog(after.guild, "THREAD_UPDATE");
-    const audit = auditLog.entries.filter((entry) => entry.target.id === after.id).first();
+    const audit = auditLog.entries.filter((entry: GuildAuditLogsEntry) => entry.target!.id === after.id).first();
     if (audit.executor.id === client.user.id) return;
-    const list = {
+    const list: Record<string, ReturnType<typeof entry>> = {
         threadId: entry(after.id, `\`${after.id}\``),
         thread: entry(after.name, renderChannel(after)),
         parentChannel: entry(after.parentId, renderChannel(after.parent))
     };
     if (before.name !== after.name) {
-        list.name = entry([before.name, after.name], `${before.name} -> ${after.name}`);
+        list["name"] = entry([before.name, after.name], `${before.name} -> ${after.name}`);
     }
     if (before.autoArchiveDuration !== after.autoArchiveDuration) {
-        list.autoArchiveDuration = entry(
+        list["autoArchiveDuration"] = entry(
             [before.autoArchiveDuration, after.autoArchiveDuration],
-            `${humanizeDuration(before.autoArchiveDuration * 60 * 1000, {
+            `${humanizeDuration((before.autoArchiveDuration ?? 0) * 60 * 1000, {
                 round: true
-            })} -> ${humanizeDuration(after.autoArchiveDuration * 60 * 1000, {
+            })} -> ${humanizeDuration((after.autoArchiveDuration ?? 0) * 60 * 1000, {
                 round: true
             })}`
         );
     }
     if (before.rateLimitPerUser !== after.rateLimitPerUser) {
-        list.slowmode = entry(
+        list["slowmode"] = entry(
             [before.rateLimitPerUser, after.rateLimitPerUser],
-            `${humanizeDuration(before.rateLimitPerUser * 1000)} -> ${humanizeDuration(after.rateLimitPerUser * 1000)}`
+            `${humanizeDuration((before.rateLimitPerUser ?? 0) * 1000)} -> ${humanizeDuration((after.rateLimitPerUser ?? 0) * 1000)}`
         );
     }
     if (!(Object.keys(list).length - 3)) return;
-    list.updated = entry(new Date().getTime(), renderDelta(new Date().getTime()));
-    list.updatedBy = entry(audit.executor.id, renderUser(audit.executor));
+    list["updated"] = entry(new Date().getTime(), renderDelta(new Date().getTime()));
+    list["updatedBy"] = entry(audit.executor.id, renderUser(audit.executor));
     const data = {
         meta: {
             type: "channelUpdate",
diff --git a/src/events/webhookUpdate.ts b/src/events/webhookUpdate.ts
index 2e95c4b..c58a340 100644
--- a/src/events/webhookUpdate.ts
+++ b/src/events/webhookUpdate.ts
@@ -1,3 +1,4 @@
+import type { GuildAuditLogsEntry, Webhook } from "discord.js";
 import type Discord from "discord.js";
 // @ts-expect-error
 import type { HaikuClient } from "jshaiku";
@@ -14,20 +15,25 @@
             auditLogUpdate,
             auditLogDelete
         ]);
-        const auditCreate = auditLogCreate.entries.filter((entry) => entry.target.channelId === channel.id).first();
-        const auditUpdate = auditLogUpdate.entries.filter((entry) => entry.target.channelId === channel.id).first();
-        const auditDelete = auditLogDelete.entries.filter((entry) => entry.target.channelId === channel.id).first();
+        const auditCreate = auditLogCreate.entries.filter((entry: GuildAuditLogsEntry | null) => {
+            if (entry === null) return false
+            return (entry.target! as Webhook).channelId === channel.id}
+        ).first();
+        const auditUpdate = auditLogUpdate.entries.filter((entry: GuildAuditLogsEntry | null) => {
+            if (entry === null) return false
+            return (entry.target! as Webhook).channelId === channel.id}
+        ).first();
+        const auditDelete = auditLogDelete.entries.filter((entry: GuildAuditLogsEntry | null) => {
+            if (entry === null) return false
+            return (entry.target! as Webhook).channelId === channel.id}
+        ).first();
         if (!auditCreate && !auditUpdate && !auditDelete) return;
         let audit = auditCreate;
-        let action = "Create";
-        let list = {} as {
-            created: { value: string; displayValue: string };
-            updated: { value: string; displayValue: string };
-            deleted: { value: string; displayValue: string };
-        };
+        let action: "Create" | "Update" | "Delete" = "Create";
+        let list: Record<string, ReturnType<typeof entry> | string> = {};
         if (auditUpdate && auditUpdate.createdTimestamp > audit.createdTimestamp) {
             const { before, after } = auditUpdate.changes.reduce(
-                (acc, change) => {
+                (acc: {before: Record<string, string>, after: Record<string, string>}, change: {key: string, new: string, old: string}) => {
                     acc.before[change.key] = change.old;
                     acc.after[change.key] = change.new;
                     return acc;
@@ -35,23 +41,23 @@
                 { before: {}, after: {} }
             );
             if (before.name !== after.name)
-                list.name = entry([before.name, after.name], `${before.name} -> ${after.name}`);
+                list["name"] = entry([before.name, after.name], `${before.name} -> ${after.name}`);
             if (before.channel_id !== after.channel_id)
-                list.channel = entry(
+                list["channel"] = entry(
                     [before.channel_id, after.channel_id],
                     renderChannel(await client.channels.fetch(before.channel_id)) +
                         " -> " +
                         renderChannel(await client.channels.fetch(after.channel_id))
                 );
             if (!Object.keys(list).length) return;
-            list.created = entry(auditUpdate.target.createdTimestamp, renderDelta(auditUpdate.target.createdTimestamp));
-            list.edited = entry(after.editedTimestamp, renderDelta(new Date().getTime()));
-            list.editedBy = entry(auditUpdate.executor.id, renderUser(auditUpdate.executor));
+            list["created"] = entry(auditUpdate.target.createdTimestamp, renderDelta(auditUpdate.target.createdTimestamp));
+            list["edited"] = entry(after.editedTimestamp, renderDelta(new Date().getTime()));
+            list["editedBy"] = entry(auditUpdate.executor.id, renderUser(auditUpdate.executor));
             audit = auditUpdate;
             action = "Update";
         } else if (auditDelete && auditDelete.createdTimestamp > audit.createdTimestamp) {
             const { before } = auditDelete.changes.reduce(
-                (acc, change) => {
+                (acc: {before: Record<string, string>, after: Record<string, string>}, change: {key: string, new: string, old: string}) => {
                     acc.before[change.key] = change.old;
                     acc.after[change.key] = change.new;
                     return acc;
@@ -72,7 +78,7 @@
             action = "Delete";
         } else {
             const { before } = auditDelete.changes.reduce(
-                (acc, change) => {
+                (acc: {before: Record<string, string>, after: Record<string, string>}, change: {key: string, new: string, old: string}) => {
                     acc.before[change.key] = change.old;
                     acc.after[change.key] = change.new;
                     return acc;
