diff --git a/src/events/channelDelete.ts b/src/events/channelDelete.ts
index 25c9ce5..c8a72a4 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -1,73 +1,71 @@
 import getEmojiByName from "../utils/getEmojiByName.js";
 
-export const event = 'channelDelete'
+export const event = "channelDelete";
 
 export async function callback(client, channel) {
-    try{
-        const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = channel.client.logger
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = channel.client.logger;
 
-        let auditLog = await getAuditLog(channel.guild, 'CHANNEL_DELETE');
-        let audit = auditLog.entries.filter(entry => entry.target.id === channel.id).first();
-        if (audit.executor.id === client.user.id) return;
+    const auditLog = await getAuditLog(channel.guild, "CHANNEL_DELETE");
+    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"
-            }
-        }
-        let 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"),
-            nsfw: null,
-            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\`\`\``);
-        else delete list.topic;
-        if (channel.nsfw !== null ?? false) list.nsfw = entry(channel.nsfw, channel.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`);
-        else delete list.nsfw;
+    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";
+    }
+    }
+    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"),
+        nsfw: null,
+        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\`\`\``);
+    else delete list.topic;
+    if (channel.nsfw !== null ?? false) list.nsfw = entry(channel.nsfw, channel.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`);
+    else delete list.nsfw;
 
-        let data = {
-            meta:{
-                type: 'channelDelete',
-                displayName: displayName + ' Deleted',
-                calculateType: 'channelUpdate',
-                color: NucleusColors.red,
-                emoji: emoji,
-                timestamp: audit.createdTimestamp
-            },
-            list: list,
-            hidden: {
-                guild: channel.guild.id
-            }
+    const data = {
+        meta:{
+            type: "channelDelete",
+            displayName: displayName + " Deleted",
+            calculateType: "channelUpdate",
+            color: NucleusColors.red,
+            emoji: emoji,
+            timestamp: audit.createdTimestamp
+        },
+        list: list,
+        hidden: {
+            guild: channel.guild.id
         }
-        log(data);
-    } catch {}
+    };
+    log(data);
 }
