diff --git a/src/events/channelDelete.ts b/src/events/channelDelete.ts
index c8a72a4..af55205 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -3,58 +3,77 @@
 export const event = "channelDelete";
 
 export async function callback(client, channel) {
-    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = channel.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } =
+        channel.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;
     let readableType;
     let displayName;
     switch (channel.type) {
-    case "GUILD_TEXT": {
-        emoji = "CHANNEL.TEXT.DELETE";
-        readableType = "Text";
-        displayName = "Text Channel";
-        break;
-    }
-    case "GUILD_VOICE": {
-        emoji = "CHANNEL.VOICE.DELETE";
-        readableType = "Voice";
-        displayName = "Voice Channel";
-        break;
-    }
-    case "GUILD_CATEGORY": {
-        emoji = "CHANNEL.CATEGORY.DELETE";
-        readableType = "Category";
-        displayName = "Category";
-        break;
-    }
-    default: {
-        emoji = "CHANNEL.TEXT.DELETE";
-        readableType = "Channel";
-        displayName = "Channel";
-    }
+        case "GUILD_TEXT": {
+            emoji = "CHANNEL.TEXT.DELETE";
+            readableType = "Text";
+            displayName = "Text Channel";
+            break;
+        }
+        case "GUILD_VOICE": {
+            emoji = "CHANNEL.VOICE.DELETE";
+            readableType = "Voice";
+            displayName = "Voice Channel";
+            break;
+        }
+        case "GUILD_CATEGORY": {
+            emoji = "CHANNEL.CATEGORY.DELETE";
+            readableType = "Category";
+            displayName = "Category";
+            break;
+        }
+        default: {
+            emoji = "CHANNEL.TEXT.DELETE";
+            readableType = "Channel";
+            displayName = "Channel";
+        }
     }
     const list = {
         channelId: entry(channel.id, `\`${channel.id}\``),
         name: entry(channel.id, `${channel.name}`),
         topic: null,
         type: entry(channel.type, readableType),
-        category: entry(channel.parent ? channel.parent.id : null, channel.parent ? channel.parent.name : "Uncategorised"),
+        category: entry(
+            channel.parent ? channel.parent.id : null,
+            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.topic !== null ?? false)
+        list.topic = entry(
+            channel.topic,
+            `\`\`\`\n${channel.topic.replace("`", "'")}\n\`\`\``
+        );
     else delete list.topic;
-    if (channel.nsfw !== null ?? false) list.nsfw = entry(channel.nsfw, channel.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`);
+    if (channel.nsfw !== null ?? false)
+        list.nsfw = entry(
+            channel.nsfw,
+            channel.nsfw
+                ? `${getEmojiByName("CONTROL.TICK")} Yes`
+                : `${getEmojiByName("CONTROL.CROSS")} No`
+        );
     else delete list.nsfw;
 
     const data = {
-        meta:{
+        meta: {
             type: "channelDelete",
             displayName: displayName + " Deleted",
             calculateType: "channelUpdate",
