diff --git a/src/events/channelDelete.ts b/src/events/channelDelete.ts
index ee46204..44bbc8e 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -1,15 +1,22 @@
+import {
+    BaseGuildTextChannel,
+    BaseGuildVoiceChannel,
+    GuildChannel,
+    StageChannel,
+    ThreadChannel,
+    VoiceChannel
+} from "discord.js";
+// @ts-expect-error
+import type { HaikuClient } from "jshaiku";
 import getEmojiByName from "../utils/getEmojiByName.js";
 
 export const event = "channelDelete";
 
-export async function callback(client, channel) {
-    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } =
-        channel.client.logger;
+export async function callback(client: HaikuClient, channel: GuildChannel) {
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = client.logger;
 
     const auditLog = await getAuditLog(channel.guild, "CHANNEL_DELETE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === channel.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === channel.id).first();
     if (audit.executor.id === client.user.id) return;
 
     let emoji;
@@ -60,27 +67,26 @@
             channel.parent ? channel.parent.name : "Uncategorised"
         ),
         nsfw: null,
-        created: entry(
-            channel.createdTimestamp,
-            renderDelta(channel.createdTimestamp)
-        ),
+        created: entry(channel.createdTimestamp, renderDelta(channel.createdTimestamp)),
         deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
         deletedBy: entry(audit.executor.id, renderUser(audit.executor))
     };
-    if (channel.topic !== null ?? false)
-        list.topic = entry(
-            channel.topic,
-            `\`\`\`\n${channel.topic.replace("`", "'")}\n\`\`\``
-        );
+    if ((channel instanceof BaseGuildTextChannel || channel instanceof StageChannel) && channel.topic !== null)
+        list.topic = entry(channel.topic, `\`\`\`\n${channel.topic.replace("`", "'")}\n\`\`\``);
     else delete list.topic;
-    if (channel.nsfw !== null ?? false)
+    if (
+        channel instanceof BaseGuildTextChannel ||
+        channel instanceof VoiceChannel ||
+        channel instanceof ThreadChannel
+    ) {
+        const nsfw = channel instanceof ThreadChannel ? (channel as ThreadChannel).parent?.nsfw ?? false : channel.nsfw;
         list.nsfw = entry(
-            channel.nsfw,
-            channel.nsfw
-                ? `${getEmojiByName("CONTROL.TICK")} Yes`
-                : `${getEmojiByName("CONTROL.CROSS")} No`
+            nsfw,
+            nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
         );
-    else delete list.nsfw;
+    } else {
+        delete list.nsfw;
+    }
 
     const data = {
         meta: {
