diff --git a/src/events/channelCreate.ts b/src/events/channelCreate.ts
index 7350ebd..19f5c9b 100644
--- a/src/events/channelCreate.ts
+++ b/src/events/channelCreate.ts
@@ -1,19 +1,9 @@
 export const event = "channelCreate";
 
 export async function callback(client, channel) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = channel.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = channel.client.logger;
     const auditLog = await getAuditLog(channel.guild, "CHANNEL_CREATE");
-    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;
@@ -73,10 +63,7 @@
                 channel.parent ? channel.parent.name : "Uncategorised"
             ),
             createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                channel.createdTimestamp,
-                renderDelta(channel.createdTimestamp)
-            )
+            created: entry(channel.createdTimestamp, renderDelta(channel.createdTimestamp))
         },
         hidden: {
             guild: channel.guild.id
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: {
diff --git a/src/events/channelUpdate.ts b/src/events/channelUpdate.ts
index 6717661..a7af453 100644
--- a/src/events/channelUpdate.ts
+++ b/src/events/channelUpdate.ts
@@ -5,22 +5,12 @@
 
 export async function callback(client, oc, nc) {
     const config = await client.memory.readGuildInfo(nc.guild.id);
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderDelta,
-        renderUser,
-        renderChannel
-    } = client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderChannel } = client.logger;
 
     if (nc.parent && nc.parent.id === config.tickets.category) return;
 
     const auditLog = await getAuditLog(nc.guild, "CHANNEL_UPDATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === nc.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === nc.id).first();
     if (audit.executor.id === client.user.id) return;
 
     let emoji: string;
@@ -30,18 +20,11 @@
         channelId: entry(nc.id, `\`${nc.id}\``),
         channel: entry(nc.id, renderChannel(nc)),
         edited: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-        editedBy: entry(
-            audit.executor.id,
-            renderUser((await nc.guild.members.fetch(audit.executor.id)).user)
-        )
+        editedBy: entry(audit.executor.id, renderUser((await nc.guild.members.fetch(audit.executor.id)).user))
     };
-    if (oc.name !== nc.name)
-        changes.name = entry([oc.name, nc.name], `${oc.name} -> ${nc.name}`);
+    if (oc.name !== nc.name) changes.name = entry([oc.name, nc.name], `${oc.name} -> ${nc.name}`);
     if (oc.position !== nc.position)
-        changes.position = entry(
-            [oc.position, nc.position],
-            `${oc.position} -> ${nc.position}`
-        );
+        changes.position = entry([oc.position, nc.position], `${oc.position} -> ${nc.position}`);
 
     switch (nc.type) {
         case "GUILD_TEXT": {
@@ -52,45 +35,28 @@
                 newTopic = nc.topic;
             if (oldTopic) {
                 if (oldTopic.length > 256)
-                    oldTopic = `\`\`\`\n${
-                        oldTopic.replace("`", "'").substring(0, 253) + "..."
-                    }\n\`\`\``;
+                    oldTopic = `\`\`\`\n${oldTopic.replace("`", "'").substring(0, 253) + "..."}\n\`\`\``;
                 else oldTopic = `\`\`\`\n${oldTopic.replace("`", "'")}\n\`\`\``;
             } else {
                 oldTopic = "None";
             }
             if (newTopic) {
                 if (newTopic.length > 256)
-                    newTopic = `\`\`\`\n${
-                        newTopic.replace("`", "'").substring(0, 253) + "..."
-                    }\n\`\`\``;
+                    newTopic = `\`\`\`\n${newTopic.replace("`", "'").substring(0, 253) + "..."}\n\`\`\``;
                 else newTopic = `\`\`\`\n${newTopic.replace("`", "'")}\n\`\`\``;
             } else {
                 newTopic = "None";
             }
             const nsfw = ["", ""];
-            nsfw[0] = oc.nsfw
-                ? `${getEmojiByName("CONTROL.TICK")} Yes`
-                : `${getEmojiByName("CONTROL.CROSS")} No`;
-            nsfw[1] = nc.nsfw
-                ? `${getEmojiByName("CONTROL.TICK")} Yes`
-                : `${getEmojiByName("CONTROL.CROSS")} No`;
+            nsfw[0] = oc.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+            nsfw[1] = nc.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
             if (oc.topic !== nc.topic)
-                changes.description = entry(
-                    [oc.topic, nc.topic],
-                    `\nBefore: ${oldTopic}\nAfter: ${newTopic}`
-                );
-            if (oc.nsfw !== nc.nsfw)
-                changes.nsfw = entry(
-                    [oc.nsfw, nc.nsfw],
-                    `${nsfw[0]} -> ${nsfw[1]}`
-                );
+                changes.description = entry([oc.topic, nc.topic], `\nBefore: ${oldTopic}\nAfter: ${newTopic}`);
+            if (oc.nsfw !== nc.nsfw) changes.nsfw = entry([oc.nsfw, nc.nsfw], `${nsfw[0]} -> ${nsfw[1]}`);
             if (oc.rateLimitPerUser !== nc.rateLimitPerUser)
                 changes.rateLimitPerUser = entry(
                     [oc.rateLimitPerUser, nc.rateLimitPerUser],
-                    `${humanizeDuration(
-                        oc.rateLimitPerUser * 1000
-                    )} -> ${humanizeDuration(nc.rateLimitPerUser * 1000)}`
+                    `${humanizeDuration(oc.rateLimitPerUser * 1000)} -> ${humanizeDuration(nc.rateLimitPerUser * 1000)}`
                 );
 
             break;
@@ -103,27 +69,20 @@
                 newTopic = nc.topic;
             if (oldTopic) {
                 if (oldTopic.length > 256)
-                    oldTopic = `\`\`\`\n${
-                        oldTopic.replace("`", "'").substring(0, 253) + "..."
-                    }\n\`\`\``;
+                    oldTopic = `\`\`\`\n${oldTopic.replace("`", "'").substring(0, 253) + "..."}\n\`\`\``;
                 else oldTopic = `\`\`\`\n${oldTopic.replace("`", "'")}\n\`\`\``;
             } else {
                 oldTopic = "None";
             }
             if (newTopic) {
                 if (newTopic.length > 256)
-                    newTopic = `\`\`\`\n${
-                        newTopic.replace("`", "'").substring(0, 253) + "..."
-                    }\n\`\`\``;
+                    newTopic = `\`\`\`\n${newTopic.replace("`", "'").substring(0, 253) + "..."}\n\`\`\``;
                 else newTopic = `\`\`\`\n${newTopic.replace("`", "'")}\n\`\`\``;
             } else {
                 newTopic = "None";
             }
             if (oc.nsfw !== nc.nsfw)
-                changes.nsfw = entry(
-                    [oc.nsfw, nc.nsfw],
-                    `${oc.nsfw ? "On" : "Off"} -> ${nc.nsfw ? "On" : "Off"}`
-                );
+                changes.nsfw = entry([oc.nsfw, nc.nsfw], `${oc.nsfw ? "On" : "Off"} -> ${nc.nsfw ? "On" : "Off"}`);
             break;
         }
         case "GUILD_VOICE": {
@@ -131,23 +90,16 @@
             readableType = "Voice";
             displayName = "Voice Channel";
             if (oc.bitrate !== nc.bitrate)
-                changes.bitrate = entry(
-                    [oc.bitrate, nc.bitrate],
-                    `${oc.bitrate} -> ${nc.bitrate}`
-                );
+                changes.bitrate = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
             if (oc.userLimit !== nc.userLimit)
                 changes.maxUsers = entry(
                     [oc.userLimit, nc.userLimit],
-                    `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${
-                        nc.userLimit
-                    }`
+                    `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`
                 );
             if (oc.rtcRegion !== nc.rtcRegion)
                 changes.region = entry(
                     [oc.rtcRegion, nc.rtcRegion],
-                    `${oc.rtcRegion || "Automatic"} -> ${
-                        nc.rtcRegion || "Automatic"
-                    }`
+                    `${oc.rtcRegion || "Automatic"} -> ${nc.rtcRegion || "Automatic"}`
                 );
             break;
         }
@@ -159,40 +111,29 @@
                 newTopic = nc.topic;
             if (oldTopic) {
                 if (oldTopic.length > 256)
-                    oldTopic = `\`\`\`\n${
-                        oldTopic.replace("`", "'").substring(0, 253) + "..."
-                    }\n\`\`\``;
+                    oldTopic = `\`\`\`\n${oldTopic.replace("`", "'").substring(0, 253) + "..."}\n\`\`\``;
                 else oldTopic = `\`\`\`\n${oldTopic.replace("`", "'")}\n\`\`\``;
             } else {
                 oldTopic = "None";
             }
             if (newTopic) {
                 if (newTopic.length > 256)
-                    newTopic = `\`\`\`\n${
-                        newTopic.replace("`", "'").substring(0, 253) + "..."
-                    }\n\`\`\``;
+                    newTopic = `\`\`\`\n${newTopic.replace("`", "'").substring(0, 253) + "..."}\n\`\`\``;
                 else newTopic = `\`\`\`\n${newTopic.replace("`", "'")}\n\`\`\``;
             } else {
                 newTopic = "None";
             }
             if (oc.bitrate !== nc.bitrate)
-                changes.bitrate = entry(
-                    [oc.bitrate, nc.bitrate],
-                    `${oc.bitrate} -> ${nc.bitrate}`
-                );
+                changes.bitrate = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
             if (oc.userLimit !== nc.userLimit)
                 changes.maxUsers = entry(
                     [oc.userLimit, nc.userLimit],
-                    `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${
-                        nc.userLimit
-                    }`
+                    `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`
                 );
             if (oc.rtcRegion !== nc.rtcRegion)
                 changes.region = entry(
                     [oc.rtcRegion, nc.rtcRegion],
-                    `${oc.rtcRegion || "Automatic"} -> ${
-                        nc.rtcRegion || "Automatic"
-                    }`
+                    `${oc.rtcRegion || "Automatic"} -> ${nc.rtcRegion || "Automatic"}`
                 );
             break;
         }
@@ -210,10 +151,7 @@
     }
     const t = oc.type.split("_")[1];
     if (oc.type !== nc.type)
-        changes.type = entry(
-            [oc.type, nc.type],
-            `${t[0] + t.splice(1).toLowerCase()} -> ${readableType}`
-        );
+        changes.type = entry([oc.type, nc.type], `${t[0] + t.splice(1).toLowerCase()} -> ${readableType}`);
     if (!(Object.values(changes).length - 4)) return;
     const data = {
         meta: {
diff --git a/src/events/emojiCreate.ts b/src/events/emojiCreate.ts
index 53f564c..b4e9dfa 100644
--- a/src/events/emojiCreate.ts
+++ b/src/events/emojiCreate.ts
@@ -1,19 +1,9 @@
 export const event = "emojiCreate";
 
 export async function callback(client, emoji) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderEmoji
-    } = emoji.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger;
     const auditLog = await getAuditLog(emoji.guild, "EMOJI_CREATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === emoji.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === emoji.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -28,10 +18,7 @@
             emojiId: entry(emoji.id, `\`${emoji.id}\``),
             emoji: entry(emoji.name, renderEmoji(emoji)),
             createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                emoji.createdTimestamp,
-                renderDelta(emoji.createdTimestamp)
-            )
+            created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp))
         },
         hidden: {
             guild: emoji.guild.id
diff --git a/src/events/emojiDelete.ts b/src/events/emojiDelete.ts
index 041b432..c4b1535 100644
--- a/src/events/emojiDelete.ts
+++ b/src/events/emojiDelete.ts
@@ -1,19 +1,9 @@
 export const event = "emojiDelete";
 
 export async function callback(client, emoji) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderEmoji
-    } = emoji.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger;
     const auditLog = await getAuditLog(emoji.guild, "EMOJI_DELETE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === emoji.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === emoji.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -28,14 +18,8 @@
             emojiId: entry(emoji.id, `\`${emoji.id}\``),
             emoji: entry(emoji.name, renderEmoji(emoji)),
             deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                emoji.createdTimestamp,
-                renderDelta(emoji.createdTimestamp)
-            ),
-            deleted: entry(
-                audit.createdTimestamp,
-                renderDelta(audit.createdTimestamp)
-            )
+            created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp)),
+            deleted: entry(audit.createdTimestamp, renderDelta(audit.createdTimestamp))
         },
         hidden: {
             guild: emoji.guild.id
diff --git a/src/events/emojiUpdate.ts b/src/events/emojiUpdate.ts
index 34b16de..66227d4 100644
--- a/src/events/emojiUpdate.ts
+++ b/src/events/emojiUpdate.ts
@@ -1,15 +1,7 @@
 export const event = "emojiUpdate";
 
 export async function callback(client, oe, ne) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderDelta,
-        renderUser,
-        renderEmoji
-    } = client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderEmoji } = client.logger;
 
     if (oe.name === ne.name) return;
     const auditLog = await getAuditLog(ne.guild, "EMOJI_UPDATE");
@@ -20,10 +12,7 @@
         emojiId: entry(ne.id, `\`${ne.id}\``),
         emoji: entry(ne.id, renderEmoji(ne)),
         edited: entry(ne.createdTimestamp, renderDelta(ne.createdTimestamp)),
-        editedBy: entry(
-            audit.executor.id,
-            renderUser((await ne.guild.members.fetch(audit.executor.id)).user)
-        ),
+        editedBy: entry(audit.executor.id, renderUser((await ne.guild.members.fetch(audit.executor.id)).user)),
         name: entry([oe.name, ne.name], `\`:${oe.name}:\` -> \`:${ne.name}:\``)
     };
     const data = {
diff --git a/src/events/guildBanAdd.ts b/src/events/guildBanAdd.ts
index dd723d3..17c4595 100644
--- a/src/events/guildBanAdd.ts
+++ b/src/events/guildBanAdd.ts
@@ -6,20 +6,11 @@
 export async function callback(client, ban) {
     await statsChannelRemove(client, ban.user);
     purgeByUser(ban.user.id, ban.guild);
-    const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } =
-        ban.user.client.logger;
+    const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = ban.user.client.logger;
     const auditLog = await getAuditLog(ban.guild, "MEMBER_BAN_ADD");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === ban.user.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === ban.user.id).first();
     if (audit.executor.id === client.user.id) return;
-    await client.database.history.create(
-        "ban",
-        ban.guild.id,
-        ban.user,
-        audit.executor,
-        audit.reason
-    );
+    await client.database.history.create("ban", ban.guild.id, ban.user, audit.executor, audit.reason);
     const data = {
         meta: {
             type: "memberBan",
@@ -32,19 +23,10 @@
         list: {
             memberId: entry(ban.user.id, `\`${ban.user.id}\``),
             name: entry(ban.user.id, renderUser(ban.user)),
-            banned: entry(
-                new Date().getTime(),
-                renderDelta(new Date().getTime())
-            ),
+            banned: entry(new Date().getTime(), renderDelta(new Date().getTime())),
             bannedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            reason: entry(
-                audit.reason,
-                audit.reason ? `\n> ${audit.reason}` : "*No reason provided.*"
-            ),
-            accountCreated: entry(
-                ban.user.createdAt,
-                renderDelta(ban.user.createdAt)
-            ),
+            reason: entry(audit.reason, audit.reason ? `\n> ${audit.reason}` : "*No reason provided.*"),
+            accountCreated: entry(ban.user.createdAt, renderDelta(ban.user.createdAt)),
             serverMemberCount: ban.guild.memberCount
         },
         hidden: {
diff --git a/src/events/guildBanRemove.ts b/src/events/guildBanRemove.ts
index 4c2263d..74b7c4e 100644
--- a/src/events/guildBanRemove.ts
+++ b/src/events/guildBanRemove.ts
@@ -6,20 +6,11 @@
 export async function callback(client, ban) {
     await statsChannelRemove(client, ban.user);
     purgeByUser(ban.user.id, ban.guild);
-    const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } =
-        ban.user.client.logger;
+    const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = ban.user.client.logger;
     const auditLog = await getAuditLog(ban.guild, "MEMBER_BAN_REMOVE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === ban.user.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === ban.user.id).first();
     if (audit.executor.id === client.user.id) return;
-    await client.database.history.create(
-        "unban",
-        ban.guild.id,
-        ban.user,
-        audit.executor,
-        audit.reason
-    );
+    await client.database.history.create("unban", ban.guild.id, ban.user, audit.executor, audit.reason);
     const data = {
         meta: {
             type: "memberUnban",
@@ -32,15 +23,9 @@
         list: {
             memberId: entry(ban.user.id, `\`${ban.user.id}\``),
             name: entry(ban.user.id, renderUser(ban.user)),
-            unbanned: entry(
-                new Date().getTime(),
-                renderDelta(new Date().getTime())
-            ),
+            unbanned: entry(new Date().getTime(), renderDelta(new Date().getTime())),
             unbannedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            accountCreated: entry(
-                ban.user.createdAt,
-                renderDelta(ban.user.createdAt)
-            )
+            accountCreated: entry(ban.user.createdAt, renderDelta(ban.user.createdAt))
         },
         hidden: {
             guild: ban.guild.id
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index 4cffe69..08730f2 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -2,18 +2,9 @@
 
 export async function callback(client, before, after) {
     try {
-        const {
-            log,
-            NucleusColors,
-            entry,
-            renderUser,
-            renderDelta,
-            getAuditLog
-        } = after.client.logger;
+        const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = after.client.logger;
         const auditLog = await getAuditLog(after.guild, "MEMBER_UPDATE");
-        const audit = auditLog.entries
-            .filter((entry) => entry.target.id === after.id)
-            .first();
+        const audit = auditLog.entries.filter((entry) => entry.target.id === after.id).first();
         if (audit.executor.id === client.user.id) return;
         if (before.nickname !== after.nickname) {
             await client.database.history.create(
@@ -37,22 +28,10 @@
                 list: {
                     memberId: entry(after.id, `\`${after.id}\``),
                     name: entry(after.user.id, renderUser(after.user)),
-                    before: entry(
-                        before.nickname,
-                        before.nickname ? before.nickname : "*None*"
-                    ),
-                    after: entry(
-                        after.nickname,
-                        after.nickname ? after.nickname : "*None*"
-                    ),
-                    changed: entry(
-                        new Date().getTime(),
-                        renderDelta(new Date().getTime())
-                    ),
-                    changedBy: entry(
-                        audit.executor.id,
-                        renderUser(audit.executor)
-                    )
+                    before: entry(before.nickname, before.nickname ? before.nickname : "*None*"),
+                    after: entry(after.nickname, after.nickname ? after.nickname : "*None*"),
+                    changed: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                    changedBy: entry(audit.executor.id, renderUser(audit.executor))
                 },
                 hidden: {
                     guild: after.guild.id
@@ -89,33 +68,20 @@
                         after.communicationDisabledUntilTimestamp,
                         renderDelta(after.communicationDisabledUntilTimestamp)
                     ),
-                    muted: entry(
-                        new Date().getTime(),
-                        renderDelta(new Date().getTime())
-                    ),
-                    mutedBy: entry(
-                        audit.executor.id,
-                        renderUser(audit.executor)
-                    ),
-                    reason: entry(
-                        audit.reason,
-                        audit.reason ? audit.reason : "\n> *No reason provided*"
-                    )
+                    muted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                    mutedBy: entry(audit.executor.id, renderUser(audit.executor)),
+                    reason: entry(audit.reason, audit.reason ? audit.reason : "\n> *No reason provided*")
                 },
                 hidden: {
                     guild: after.guild.id
                 }
             };
             log(data);
-            client.database.eventScheduler.schedule(
-                "naturalUnmute",
-                after.communicationDisabledUntil,
-                {
-                    guild: after.guild.id,
-                    user: after.id,
-                    expires: after.communicationDisabledUntilTimestamp
-                }
-            );
+            client.database.eventScheduler.schedule("naturalUnmute", after.communicationDisabledUntil, {
+                guild: after.guild.id,
+                user: after.id,
+                expires: after.communicationDisabledUntilTimestamp
+            });
         } else if (
             after.communicationDisabledUntil === null &&
             before.communicationDisabledUntilTimestamp !== null &&
@@ -143,14 +109,8 @@
                 list: {
                     memberId: entry(after.id, `\`${after.id}\``),
                     name: entry(after.user.id, renderUser(after.user)),
-                    unmuted: entry(
-                        new Date().getTime(),
-                        renderDelta(new Date().getTime())
-                    ),
-                    unmutedBy: entry(
-                        audit.executor.id,
-                        renderUser(audit.executor)
-                    )
+                    unmuted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                    unmutedBy: entry(audit.executor.id, renderUser(audit.executor))
                 },
                 hidden: {
                     guild: after.guild.id
diff --git a/src/events/guildUpdate.ts b/src/events/guildUpdate.ts
index 2c87807..a165770 100644
--- a/src/events/guildUpdate.ts
+++ b/src/events/guildUpdate.ts
@@ -4,12 +4,9 @@
 
 export async function callback(client, before, after) {
     await statsChannelUpdate(client, after.me);
-    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } =
-        after.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = after.client.logger;
     const auditLog = await getAuditLog(after, "GUILD_UPDATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === after.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === after.id).first();
     if (audit.executor.id === client.user.id) return;
     const list = {};
 
@@ -32,16 +29,9 @@
         ELEVATED: "Enabled"
     };
 
-    if (before.name !== after.name)
-        list.name = entry(
-            [before.name, after.name],
-            `${before.name} -> ${after.name}`
-        );
+    if (before.name !== after.name) list.name = entry([before.name, after.name], `${before.name} -> ${after.name}`);
     if (before.icon !== after.icon)
-        list.icon = entry(
-            [before.icon, after.icon],
-            `[Before](${before.iconURL()}) -> [After](${after.iconURL()})`
-        );
+        list.icon = entry([before.icon, after.icon], `[Before](${before.iconURL()}) -> [After](${after.iconURL()})`);
     if (before.splash !== after.splash)
         list.splash = entry(
             [before.splash, after.splash],
@@ -55,19 +45,12 @@
     if (before.owner !== after.owner)
         list.owner = entry(
             [before.owner, after.owner],
-            `${renderUser(before.owner.user)} -> ${renderUser(
-                after.owner.user
-            )}`
+            `${renderUser(before.owner.user)} -> ${renderUser(after.owner.user)}`
         );
     if (before.verificationLevel !== after.verificationLevel)
         list.verificationLevel = entry(
-            [
-                verificationLevels[before.verificationLevel],
-                verificationLevels[after.verificationLevel]
-            ],
-            `${verificationLevels[before.verificationLevel]} -> ${
-                verificationLevels[after.verificationLevel]
-            }`
+            [verificationLevels[before.verificationLevel], verificationLevels[after.verificationLevel]],
+            `${verificationLevels[before.verificationLevel]} -> ${verificationLevels[after.verificationLevel]}`
         );
     if (before.explicitContentFilter !== after.explicitContentFilter)
         list.explicitContentFilter = entry(
@@ -86,10 +69,7 @@
         );
 
     if (!Object.keys(list).length) return;
-    list.updated = entry(
-        new Date().getTime(),
-        renderDelta(new Date().getTime())
-    );
+    list.updated = entry(new Date().getTime(), renderDelta(new Date().getTime()));
     list.updatedBy = entry(audit.executor.id, renderUser(audit.executor));
     const data = {
         meta: {
diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts
index 60b90e3..5b0aff1 100644
--- a/src/events/interactionCreate.ts
+++ b/src/events/interactionCreate.ts
@@ -20,25 +20,16 @@
         findAllMatches: true,
         minMatchCharLength: 0
     }).search(typed);
-    return fuse
-        .slice(0, 25)
-        .map((option) => ({ name: option.item, value: option.item }));
+    return fuse.slice(0, 25).map((option) => ({ name: option.item, value: option.item }));
 }
 
 function generateStatsChannelAutocomplete(typed) {
-    const validReplacements = [
-        "serverName",
-        "memberCount",
-        "memberCount:bots",
-        "memberCount:humans"
-    ];
+    const validReplacements = ["serverName", "memberCount", "memberCount:bots", "memberCount:humans"];
     const autocompletions = [];
     const beforeLastOpenBracket = typed.match(/(.*){[^{}]{0,15}$/);
     if (beforeLastOpenBracket !== null) {
         for (const replacement of validReplacements) {
-            autocompletions.push(
-                `${beforeLastOpenBracket[1]} {${replacement}}`
-            );
+            autocompletions.push(`${beforeLastOpenBracket[1]} {${replacement}}`);
         }
     } else {
         for (const replacement of validReplacements) {
@@ -60,9 +51,7 @@
     const beforeLastOpenBracket = typed.match(/(.*){[^{}]{0,15}$/);
     if (beforeLastOpenBracket !== null) {
         for (const replacement of validReplacements) {
-            autocompletions.push(
-                `${beforeLastOpenBracket[1]} {${replacement}}`
-            );
+            autocompletions.push(`${beforeLastOpenBracket[1]} {${replacement}}`);
         }
     } else {
         for (const replacement of validReplacements) {
@@ -93,32 +82,21 @@
         }
     } else if (interaction.type === "APPLICATION_COMMAND_AUTOCOMPLETE") {
         switch (
-            `${
-                interaction.commandName
-            } ${interaction.options.getSubcommandGroup(
+            `${interaction.commandName} ${interaction.options.getSubcommandGroup(
                 false
             )} ${interaction.options.getSubcommand(false)}`
         ) {
             case "tag null null": {
                 return interaction.respond(
-                    getAutocomplete(
-                        interaction.options.getString("tag"),
-                        await tagAutocomplete(interaction)
-                    )
+                    getAutocomplete(interaction.options.getString("tag"), await tagAutocomplete(interaction))
                 );
             }
             case "settings null stats": {
-                return interaction.respond(
-                    generateStatsChannelAutocomplete(
-                        interaction.options.getString("name")
-                    )
-                );
+                return interaction.respond(generateStatsChannelAutocomplete(interaction.options.getString("name")));
             }
             case "settings null welcome": {
                 return interaction.respond(
-                    generateWelcomeMessageAutocomplete(
-                        interaction.options.getString("message")
-                    )
+                    generateWelcomeMessageAutocomplete(interaction.options.getString("message"))
                 );
             }
         }
diff --git a/src/events/inviteCreate.ts b/src/events/inviteCreate.ts
index 5461307..7b23bb2 100644
--- a/src/events/inviteCreate.ts
+++ b/src/events/inviteCreate.ts
@@ -2,19 +2,9 @@
 export const event = "inviteCreate";
 
 export async function callback(client, invite) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = invite.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = invite.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) => entry.target.id === invite.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -28,15 +18,9 @@
         list: {
             channel: entry(invite.channel.id, renderChannel(invite.channel)),
             link: entry(invite.url, invite.url),
-            expires: entry(
-                invite.maxAge,
-                invite.maxAge ? humanizeDuration(invite.maxAge * 1000) : "Never"
-            ),
+            expires: entry(invite.maxAge, invite.maxAge ? humanizeDuration(invite.maxAge * 1000) : "Never"),
             createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                invite.createdTimestamp,
-                renderDelta(invite.createdTimestamp)
-            )
+            created: entry(invite.createdTimestamp, renderDelta(invite.createdTimestamp))
         },
         hidden: {
             guild: invite.guild.id
diff --git a/src/events/inviteDelete.ts b/src/events/inviteDelete.ts
index e5bf241..2cd3bc5 100644
--- a/src/events/inviteDelete.ts
+++ b/src/events/inviteDelete.ts
@@ -2,19 +2,9 @@
 export const event = "inviteDelete";
 
 export async function callback(client, invite) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = invite.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = invite.client.logger;
     const auditLog = await getAuditLog(invite.guild, "INVITE_DELETE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === invite.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === invite.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -28,15 +18,9 @@
         list: {
             channel: entry(invite.channel.id, renderChannel(invite.channel)),
             link: entry(invite.url, invite.url),
-            expires: entry(
-                invite.maxAge,
-                invite.maxAge ? humanizeDuration(invite.maxAge * 1000) : "Never"
-            ),
+            expires: entry(invite.maxAge, invite.maxAge ? humanizeDuration(invite.maxAge * 1000) : "Never"),
             deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            deleted: entry(
-                new Date().getTime(),
-                renderDelta(new Date().getTime())
-            )
+            deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
         },
         hidden: {
             guild: invite.guild.id
diff --git a/src/events/memberJoin.ts b/src/events/memberJoin.ts
index ea0b24d..ebc2934 100644
--- a/src/events/memberJoin.ts
+++ b/src/events/memberJoin.ts
@@ -7,15 +7,8 @@
 export async function callback(_, member) {
     welcome(_, member);
     statsChannelAdd(_, member);
-    const { log, NucleusColors, entry, renderUser, renderDelta } =
-        member.client.logger;
-    await client.database.history.create(
-        "join",
-        member.guild.id,
-        member.user,
-        null,
-        null
-    );
+    const { log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger;
+    await client.database.history.create("join", member.guild.id, member.user, null, null);
     const data = {
         meta: {
             type: "memberJoin",
@@ -29,10 +22,7 @@
             memberId: entry(member.id, `\`${member.id}\``),
             name: entry(member.id, renderUser(member.user)),
             joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
-            accountCreated: entry(
-                member.user.createdAt,
-                renderDelta(member.user.createdAt)
-            ),
+            accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
             serverMemberCount: member.guild.memberCount
         },
         hidden: {
diff --git a/src/events/memberLeave.ts b/src/events/memberLeave.ts
index d170396..00f6d84 100644
--- a/src/events/memberLeave.ts
+++ b/src/events/memberLeave.ts
@@ -6,12 +6,9 @@
 export async function callback(client, member) {
     purgeByUser(member.id, member.guild);
     await statsChannelRemove(client, member);
-    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } =
-        member.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger;
     const auditLog = await getAuditLog(member.guild, "MEMBER_KICK");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === member.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === member.id).first();
     let type = "leave";
     if (audit) {
         if (audit.executor.id === client.user.id) return;
@@ -21,13 +18,7 @@
     }
     let data;
     if (type === "kick") {
-        await client.database.history.create(
-            "kick",
-            member.guild.id,
-            member.user,
-            audit.executor,
-            audit.reason
-        );
+        await client.database.history.create("kick", member.guild.id, member.user, audit.executor, audit.reason);
         data = {
             meta: {
                 type: "memberKick",
@@ -41,21 +32,10 @@
                 memberId: entry(member.id, `\`${member.id}\``),
                 name: entry(member.id, renderUser(member.user)),
                 joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
-                kicked: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                ),
+                kicked: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                 kickedBy: entry(audit.executor.id, renderUser(audit.executor)),
-                reason: entry(
-                    audit.reason,
-                    audit.reason
-                        ? `\n> ${audit.reason}`
-                        : "*No reason provided.*"
-                ),
-                accountCreated: entry(
-                    member.user.createdAt,
-                    renderDelta(member.user.createdAt)
-                ),
+                reason: entry(audit.reason, audit.reason ? `\n> ${audit.reason}` : "*No reason provided.*"),
+                accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
                 serverMemberCount: member.guild.memberCount
             },
             hidden: {
@@ -63,13 +43,7 @@
             }
         };
     } else {
-        await client.database.history.create(
-            "leave",
-            member.guild.id,
-            member.user,
-            null,
-            null
-        );
+        await client.database.history.create("leave", member.guild.id, member.user, null, null);
         data = {
             meta: {
                 type: "memberLeave",
@@ -82,18 +56,9 @@
             list: {
                 memberId: entry(member.id, `\`${member.id}\``),
                 name: entry(member.id, renderUser(member.user)),
-                joined: entry(
-                    member.joinedTimestamp,
-                    renderDelta(member.joinedAt)
-                ),
-                left: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                ),
-                accountCreated: entry(
-                    member.user.createdAt,
-                    renderDelta(member.user.createdAt)
-                ),
+                joined: entry(member.joinedTimestamp, renderDelta(member.joinedAt)),
+                left: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
                 serverMemberCount: member.guild.memberCount
             },
             hidden: {
diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts
index 7e4a52f..f690885 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -1,13 +1,6 @@
 // @ts-expect-error
 import { HaikuClient } from "jshaiku";
-import {
-    LinkCheck,
-    MalwareCheck,
-    NSFWCheck,
-    SizeCheck,
-    TestString,
-    TestImage
-} from "../reflex/scanners.js";
+import { LinkCheck, MalwareCheck, NSFWCheck, SizeCheck, TestString, TestImage } from "../reflex/scanners.js";
 import logAttachment from "../premium/attachmentLogs.js";
 import createLogException from "../utils/createLogException.js";
 import getEmojiByName from "../utils/getEmojiByName.js";
@@ -27,14 +20,7 @@
         console.log(e);
     }
 
-    const {
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = client.logger;
+    const { log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
 
     const fileNames = await logAttachment(message);
 
@@ -43,9 +29,7 @@
     const filter = getEmojiByName("ICONS.FILTER");
     let attachmentJump = "";
     if (config.logging.attachments.saved[message.channel.id + message.id]) {
-        attachmentJump = ` [[View attachments]](${
-            config.logging.attachments.saved[message.channel.id + message.id]
-        })`;
+        attachmentJump = ` [[View attachments]](${config.logging.attachments.saved[message.channel.id + message.id]})`;
     }
     const list = {
         messageId: entry(message.id, `\`${message.id}\``),
@@ -53,10 +37,7 @@
         sentIn: entry(message.channel.id, renderChannel(message.channel)),
         deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
         mentions: message.mentions.users.size,
-        attachments: entry(
-            message.attachments.size,
-            message.attachments.size + attachmentJump
-        ),
+        attachments: entry(message.attachments.size, message.attachments.size + attachmentJump),
         repliedTo: entry(
             message.reference ? message.reference.messageId : null,
             message.reference
@@ -66,25 +47,14 @@
     };
 
     if (config.filters.invite.enabled) {
-        if (
-            !config.filters.invite.allowed.channels.includes(message.channel.id)
-        ) {
-            if (
-                /(?:https?:\/\/)?discord(?:app)?\.(?:com\/invite|gg)\/[a-zA-Z0-9]+\/?/.test(
-                    content
-                )
-            ) {
-                createLogException(
-                    message.guild.id,
-                    message.channel.id,
-                    message.id
-                );
+        if (!config.filters.invite.allowed.channels.includes(message.channel.id)) {
+            if (/(?:https?:\/\/)?discord(?:app)?\.(?:com\/invite|gg)\/[a-zA-Z0-9]+\/?/.test(content)) {
+                createLogException(message.guild.id, message.channel.id, message.id);
                 message.delete();
                 const data = {
                     meta: {
                         type: "messageDelete",
-                        displayName:
-                            "Message Deleted (Automated, Contained Invite)",
+                        displayName: "Message Deleted (Automated, Contained Invite)",
                         calculateType: "autoModeratorDeleted",
                         color: NucleusColors.red,
                         emoji: "MESSAGE.DELETE",
@@ -94,9 +64,7 @@
                         start:
                             filter +
                             " Contained invite\n\n" +
-                            (content
-                                ? `**Message:**\n\`\`\`${content}\`\`\``
-                                : "**Message:** *Message had no content*")
+                            (content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*")
                     },
                     list: list,
                     hidden: {
@@ -111,21 +79,13 @@
     if (fileNames.files.length > 0) {
         for (const element of fileNames.files) {
             const url = element.url ? element.url : element.local;
-            if (
-                /\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/.test(url)
-            ) {
+            if (/\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/.test(url)) {
                 if (
                     config.filters.images.NSFW &&
-                    !(message.channel instanceof ThreadChannel
-                        ? message.channel.parent?.nsfw
-                        : message.channel.nsfw)
+                    !(message.channel instanceof ThreadChannel ? message.channel.parent?.nsfw : message.channel.nsfw)
                 ) {
                     if (await NSFWCheck(url)) {
-                        createLogException(
-                            message.guild.id,
-                            message.channel.id,
-                            message.id
-                        );
+                        createLogException(message.guild.id, message.channel.id, message.id);
                         await message.delete();
                         const data = {
                             meta: {
@@ -160,11 +120,7 @@
                         config.filters.wordFilter.words.strict
                     );
                     if (check !== null) {
-                        createLogException(
-                            message.guild.id,
-                            message.channel.id,
-                            message.id
-                        );
+                        createLogException(message.guild.id, message.channel.id, message.id);
                         await message.delete();
                         const data = {
                             meta: {
@@ -194,11 +150,7 @@
                 if (config.filters.images.size) {
                     if (url.match(/\.+(webp|png|jpg)$/gi)) {
                         if (!(await SizeCheck(element))) {
-                            createLogException(
-                                message.guild.id,
-                                message.channel.id,
-                                message.id
-                            );
+                            createLogException(message.guild.id, message.channel.id, message.id);
                             await message.delete();
                             const data = {
                                 meta: {
@@ -229,11 +181,7 @@
             }
             if (config.filters.malware) {
                 if (!(await MalwareCheck(url))) {
-                    createLogException(
-                        message.guild.id,
-                        message.channel.id,
-                        message.id
-                    );
+                    createLogException(message.guild.id, message.channel.id, message.id);
                     await message.delete();
                     const data = {
                         meta: {
@@ -280,9 +228,7 @@
                 start:
                     filter +
                     ` Link filtered as ${linkDetectionTypes[0]?.toLowerCase()}\n\n` +
-                    (content
-                        ? `**Message:**\n\`\`\`${content}\`\`\``
-                        : "**Message:** *Message had no content*")
+                    (content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*")
             },
             list: list,
             hidden: {
@@ -299,11 +245,7 @@
             config.filters.wordFilter.words.strict
         );
         if (check !== null) {
-            createLogException(
-                message.guild.id,
-                message.channel.id,
-                message.id
-            );
+            createLogException(message.guild.id, message.channel.id, message.id);
             await message.delete();
             const data = {
                 meta: {
@@ -318,9 +260,7 @@
                     start:
                         filter +
                         " Message contained filtered word\n\n" +
-                        (content
-                            ? `**Message:**\n\`\`\`${content}\`\`\``
-                            : "**Message:** *Message had no content*")
+                        (content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*")
                 },
                 list: list,
                 hidden: {
@@ -342,9 +282,7 @@
                 timestamp: new Date().getTime()
             },
             separate: {
-                start: content
-                    ? `**Message:**\n\`\`\`${content}\`\`\``
-                    : "**Message:** *Message had no content*"
+                start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*"
             },
             list: list,
             hidden: {
@@ -356,11 +294,7 @@
     if (config.filters.pings.roles) {
         for (const roleId in message.mentions.roles) {
             if (!config.filters.pings.allowed.roles.includes(roleId)) {
-                createLogException(
-                    message.guild.id,
-                    message.channel.id,
-                    message.id
-                );
+                createLogException(message.guild.id, message.channel.id, message.id);
                 await message.delete();
                 const data = {
                     meta: {
@@ -385,10 +319,7 @@
             }
         }
     }
-    if (
-        message.mentions.users.size >= config.filters.pings.mass &&
-        config.filters.pings.mass
-    ) {
+    if (message.mentions.users.size >= config.filters.pings.mass && config.filters.pings.mass) {
         createLogException(message.guild.id, message.channel.id, message.id);
         await message.delete();
         const data = {
@@ -401,9 +332,7 @@
                 timestamp: new Date().getTime()
             },
             separate: {
-                start: content
-                    ? `**Message:**\n\`\`\`${content}\`\`\``
-                    : "**Message:** *Message had no content*"
+                start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*"
             },
             list: list,
             hidden: {
diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts
index 4cdbdb2..3a72876 100644
--- a/src/events/messageDelete.ts
+++ b/src/events/messageDelete.ts
@@ -3,25 +3,11 @@
 export async function callback(client, message) {
     try {
         if (message.author.id === client.user.id) return;
-        if (
-            client.noLog.includes(
-                `${message.guild.id}/${message.channel.id}/${message.id}`
-            )
-        )
-            return;
-        const {
-            getAuditLog,
-            log,
-            NucleusColors,
-            entry,
-            renderUser,
-            renderDelta,
-            renderChannel
-        } = message.channel.client.logger;
+        if (client.noLog.includes(`${message.guild.id}/${message.channel.id}/${message.id}`)) return;
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } =
+            message.channel.client.logger;
         const auditLog = await getAuditLog(message.guild, "MEMBER_BAN_ADD");
-        const audit = auditLog.entries
-            .filter((entry) => entry.target.id === message.author.id)
-            .first();
+        const audit = auditLog.entries.filter((entry) => entry.target.id === message.author.id).first();
         if (audit) {
             if (audit.createdAt - 100 < new Date().getTime()) return;
         }
@@ -37,8 +23,9 @@
                 ) ?? []
             ).length;
         let attachmentJump = "";
-        const config = (await client.database.guilds.read(message.guild.id))
-            .logging.attachments.saved[message.channel.id + message.id];
+        const config = (await client.database.guilds.read(message.guild.id)).logging.attachments.saved[
+            message.channel.id + message.id
+        ];
         if (config) {
             attachmentJump = ` [[View attachments]](${config})`;
         }
@@ -52,21 +39,13 @@
                 timestamp: new Date().getTime()
             },
             separate: {
-                start: content
-                    ? `**Message:**\n\`\`\`${content}\`\`\``
-                    : "**Message:** *Message had no content*"
+                start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*"
             },
             list: {
                 messageId: entry(message.id, `\`${message.id}\``),
                 sentBy: entry(message.author.id, renderUser(message.author)),
-                sentIn: entry(
-                    message.channel.id,
-                    renderChannel(message.channel)
-                ),
-                deleted: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                ),
+                sentIn: entry(message.channel.id, renderChannel(message.channel)),
+                deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                 mentions: message.mentions.users.size,
                 attachments: entry(attachments, attachments + attachmentJump),
                 repliedTo: entry(
diff --git a/src/events/messageEdit.ts b/src/events/messageEdit.ts
index c83512c..1470832 100644
--- a/src/events/messageEdit.ts
+++ b/src/events/messageEdit.ts
@@ -2,29 +2,20 @@
 
 export async function callback(client, oldMessage, newMessage) {
     if (newMessage.author.id === client.user.id) return;
-    const {
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderNumberDelta,
-        renderChannel
-    } = newMessage.channel.client.logger;
+    const { log, NucleusColors, entry, renderUser, renderDelta, renderNumberDelta, renderChannel } =
+        newMessage.channel.client.logger;
     newMessage.reference = newMessage.reference || {};
     let newContent = newMessage.cleanContent.replaceAll("`", "‘");
     let oldContent = oldMessage.cleanContent.replaceAll("`", "‘");
     let attachmentJump = "";
-    const config = (await client.database.guilds.read(newMessage.guild.id))
-        .logging.attachments.saved[newMessage.channel.id + newMessage.id];
+    const config = (await client.database.guilds.read(newMessage.guild.id)).logging.attachments.saved[
+        newMessage.channel.id + newMessage.id
+    ];
     if (config) {
         attachmentJump = ` [[View attachments]](${config})`;
     }
     if (newContent === oldContent) {
-        if (
-            !oldMessage.flags.has("CROSSPOSTED") &&
-            newMessage.flags.has("CROSSPOSTED")
-        ) {
+        if (!oldMessage.flags.has("CROSSPOSTED") && newMessage.flags.has("CROSSPOSTED")) {
             const data = {
                 meta: {
                     type: "messageAnnounce",
@@ -39,14 +30,8 @@
                 },
                 list: {
                     messageId: entry(newMessage.id, `\`${newMessage.id}\``),
-                    sentBy: entry(
-                        newMessage.author.id,
-                        renderUser(newMessage.author)
-                    ),
-                    sentIn: entry(
-                        newMessage.channel.id,
-                        renderChannel(newMessage.channel)
-                    ),
+                    sentBy: entry(newMessage.author.id, renderUser(newMessage.author)),
+                    sentIn: entry(newMessage.channel.id, renderChannel(newMessage.channel)),
                     sent: entry(
                         new Date(newMessage.createdTimestamp),
                         renderDelta(new Date(newMessage.createdTimestamp))
@@ -55,19 +40,10 @@
                         new Date(newMessage.editedTimestamp),
                         renderDelta(new Date(newMessage.editedTimestamp))
                     ),
-                    mentions: renderNumberDelta(
-                        oldMessage.mentions.users.size,
-                        newMessage.mentions.users.size
-                    ),
+                    mentions: renderNumberDelta(oldMessage.mentions.users.size, newMessage.mentions.users.size),
                     attachments: entry(
-                        renderNumberDelta(
-                            oldMessage.attachments.size,
-                            newMessage.attachments.size
-                        ),
-                        renderNumberDelta(
-                            oldMessage.attachments.size,
-                            newMessage.attachments.size
-                        ) + attachmentJump
+                        renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size),
+                        renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size) + attachmentJump
                     )
                 },
                 hidden: {
@@ -80,10 +56,8 @@
     if (!newMessage.editedTimestamp) {
         return;
     }
-    if (newContent.length > 256)
-        newContent = newContent.substring(0, 253) + "...";
-    if (oldContent.length > 256)
-        oldContent = oldContent.substring(0, 253) + "...";
+    if (newContent.length > 256) newContent = newContent.substring(0, 253) + "...";
+    if (oldContent.length > 256) oldContent = oldContent.substring(0, 253) + "...";
     const data = {
         meta: {
             type: "messageUpdate",
@@ -98,39 +72,19 @@
                 (oldContent
                     ? `**Before:**\n\`\`\`\n${oldContent}\n\`\`\`\n`
                     : "**Before:** *Message had no content*\n") +
-                (newContent
-                    ? `**After:**\n\`\`\`\n${newContent}\n\`\`\``
-                    : "**After:** *Message had no content*"),
+                (newContent ? `**After:**\n\`\`\`\n${newContent}\n\`\`\`` : "**After:** *Message had no content*"),
             end: `[[Jump to message]](${newMessage.url})`
         },
         list: {
             messageId: entry(newMessage.id, `\`${newMessage.id}\``),
             sentBy: entry(newMessage.author.id, renderUser(newMessage.author)),
-            sentIn: entry(
-                newMessage.channel.id,
-                renderChannel(newMessage.channel)
-            ),
-            sent: entry(
-                new Date(newMessage.createdTimestamp),
-                renderDelta(new Date(newMessage.createdTimestamp))
-            ),
-            edited: entry(
-                new Date(newMessage.editedTimestamp),
-                renderDelta(new Date(newMessage.editedTimestamp))
-            ),
-            mentions: renderNumberDelta(
-                oldMessage.mentions.users.size,
-                newMessage.mentions.users.size
-            ),
+            sentIn: entry(newMessage.channel.id, renderChannel(newMessage.channel)),
+            sent: entry(new Date(newMessage.createdTimestamp), renderDelta(new Date(newMessage.createdTimestamp))),
+            edited: entry(new Date(newMessage.editedTimestamp), renderDelta(new Date(newMessage.editedTimestamp))),
+            mentions: renderNumberDelta(oldMessage.mentions.users.size, newMessage.mentions.users.size),
             attachments: entry(
-                renderNumberDelta(
-                    oldMessage.attachments.size,
-                    newMessage.attachments.size
-                ),
-                renderNumberDelta(
-                    oldMessage.attachments.size,
-                    newMessage.attachments.size
-                ) + attachmentJump
+                renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size),
+                renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size) + attachmentJump
             ),
             repliedTo: entry(
                 newMessage.reference.messageId || null,
diff --git a/src/events/roleCreate.ts b/src/events/roleCreate.ts
index f0051a0..f1b0a91 100644
--- a/src/events/roleCreate.ts
+++ b/src/events/roleCreate.ts
@@ -1,20 +1,10 @@
 export const event = "roleCreate";
 
 export async function callback(client, role) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderRole
-    } = role.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderRole } = role.client.logger;
     if (role.managed) return;
     const auditLog = await getAuditLog(role.guild, "ROLE_CREATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === role.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === role.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -29,10 +19,7 @@
             roleId: entry(role.id, `\`${role.id}\``),
             role: entry(role.name, renderRole(role)),
             createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                role.createdTimestamp,
-                renderDelta(role.createdTimestamp)
-            )
+            created: entry(role.createdTimestamp, renderDelta(role.createdTimestamp))
         },
         hidden: {
             guild: role.guild.id
diff --git a/src/events/roleDelete.ts b/src/events/roleDelete.ts
index 185ea8e..4807e7d 100644
--- a/src/events/roleDelete.ts
+++ b/src/events/roleDelete.ts
@@ -3,13 +3,10 @@
 export const event = "roleDelete";
 
 export async function callback(client, role) {
-    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } =
-        role.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = role.client.logger;
     if (role.managed) return;
     const auditLog = await getAuditLog(role.guild, "ROLE_DELETE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === role.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === role.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -26,26 +23,16 @@
             color: entry(role.hexColor, `\`${role.hexColor}\``),
             showInMemberList: entry(
                 role.hoist,
-                role.hoist
-                    ? `${getEmojiByName("CONTROL.TICK")} Yes`
-                    : `${getEmojiByName("CONTROL.CROSS")} No`
+                role.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
             ),
             mentionable: entry(
                 role.mentionable,
-                role.mentionable
-                    ? `${getEmojiByName("CONTROL.TICK")} Yes`
-                    : `${getEmojiByName("CONTROL.CROSS")} No`
+                role.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
             ),
             members: entry(role.members.size, `${role.members.size}`),
             deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                role.createdTimestamp,
-                renderDelta(role.createdTimestamp)
-            ),
-            deleted: entry(
-                new Date().getTime(),
-                renderDelta(new Date().getTime())
-            )
+            created: entry(role.createdTimestamp, renderDelta(role.createdTimestamp)),
+            deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
         },
         hidden: {
             guild: role.guild.id
diff --git a/src/events/roleUpdate.ts b/src/events/roleUpdate.ts
index be276e5..53bbdee 100644
--- a/src/events/roleUpdate.ts
+++ b/src/events/roleUpdate.ts
@@ -3,15 +3,7 @@
 export const event = "roleUpdate";
 
 export async function callback(client, or, nr) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderDelta,
-        renderUser,
-        renderRole
-    } = client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderRole } = client.logger;
 
     const auditLog = await getAuditLog(nr.guild, "ROLE_UPDATE");
     const audit = auditLog.entries.first();
@@ -21,47 +13,22 @@
         roleId: entry(nr.id, `\`${nr.id}\``),
         role: entry(nr.id, renderRole(nr)),
         edited: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-        editedBy: entry(
-            audit.executor.id,
-            renderUser((await nr.guild.members.fetch(audit.executor.id)).user)
-        )
+        editedBy: entry(audit.executor.id, renderUser((await nr.guild.members.fetch(audit.executor.id)).user))
     };
     const mentionable = ["", ""];
     const hoist = ["", ""];
-    mentionable[0] = or.mentionable
-        ? `${getEmojiByName("CONTROL.TICK")} Yes`
-        : `${getEmojiByName("CONTROL.CROSS")} No`;
-    mentionable[1] = nr.mentionable
-        ? `${getEmojiByName("CONTROL.TICK")} Yes`
-        : `${getEmojiByName("CONTROL.CROSS")} No`;
-    hoist[0] = or.hoist
-        ? `${getEmojiByName("CONTROL.TICK")} Yes`
-        : `${getEmojiByName("CONTROL.CROSS")} No`;
-    hoist[1] = nr.hoist
-        ? `${getEmojiByName("CONTROL.TICK")} Yes`
-        : `${getEmojiByName("CONTROL.CROSS")} No`;
-    if (or.name !== nr.name)
-        changes.name = entry([or.name, nr.name], `${or.name} -> ${nr.name}`);
+    mentionable[0] = or.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+    mentionable[1] = nr.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+    hoist[0] = or.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+    hoist[1] = nr.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+    if (or.name !== nr.name) changes.name = entry([or.name, nr.name], `${or.name} -> ${nr.name}`);
     if (or.position !== nr.position)
-        changes.position = entry(
-            [or.position, nr.position],
-            `${or.position} -> ${nr.position}`
-        );
-    if (or.hoist !== nr.hoist)
-        changes.showInMemberList = entry(
-            [or.hoist, nr.hoist],
-            `${hoist[0]} -> ${hoist[1]}`
-        );
+        changes.position = entry([or.position, nr.position], `${or.position} -> ${nr.position}`);
+    if (or.hoist !== nr.hoist) changes.showInMemberList = entry([or.hoist, nr.hoist], `${hoist[0]} -> ${hoist[1]}`);
     if (or.mentionable !== nr.mentionable)
-        changes.mentionable = entry(
-            [or.mentionable, nr.mentionable],
-            `${mentionable[0]} -> ${mentionable[1]}`
-        );
+        changes.mentionable = entry([or.mentionable, nr.mentionable], `${mentionable[0]} -> ${mentionable[1]}`);
     if (or.hexColor !== nr.hexColor)
-        changes.color = entry(
-            [or.hexColor, nr.hexColor],
-            `\`${or.hexColor}\` -> \`${nr.hexColor}\``
-        );
+        changes.color = entry([or.hexColor, nr.hexColor], `\`${or.hexColor}\` -> \`${nr.hexColor}\``);
 
     if (Object.keys(changes).length === 4) return;
 
diff --git a/src/events/stickerCreate.ts b/src/events/stickerCreate.ts
index 54de270..c538bde 100644
--- a/src/events/stickerCreate.ts
+++ b/src/events/stickerCreate.ts
@@ -1,12 +1,9 @@
 export const event = "stickerCreate";
 
 export async function callback(client, emoji) {
-    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } =
-        emoji.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = emoji.client.logger;
     const auditLog = await getAuditLog(emoji.guild, "STICKER_CREATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === emoji.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === emoji.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -21,10 +18,7 @@
             stickerId: entry(emoji.id, `\`${emoji.id}\``),
             emoji: entry(emoji.name, `\`:${emoji.name}:\``),
             createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                emoji.createdTimestamp,
-                renderDelta(emoji.createdTimestamp)
-            )
+            created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp))
         },
         hidden: {
             guild: emoji.guild.id
diff --git a/src/events/stickerDelete.ts b/src/events/stickerDelete.ts
index f390b5c..7ac17ce 100644
--- a/src/events/stickerDelete.ts
+++ b/src/events/stickerDelete.ts
@@ -1,12 +1,9 @@
 export const event = "stickerDelete";
 
 export async function callback(client, emoji) {
-    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } =
-        emoji.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = emoji.client.logger;
     const auditLog = await getAuditLog(emoji.guild, "STICKER_DELETE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === emoji.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === emoji.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -21,14 +18,8 @@
             stickerId: entry(emoji.id, `\`${emoji.id}\``),
             sticker: entry(emoji.name, `\`${emoji.name}\``),
             deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                emoji.createdTimestamp,
-                renderDelta(emoji.createdTimestamp)
-            ),
-            deleted: entry(
-                audit.createdTimestamp,
-                renderDelta(audit.createdTimestamp)
-            )
+            created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp)),
+            deleted: entry(audit.createdTimestamp, renderDelta(audit.createdTimestamp))
         },
         hidden: {
             guild: emoji.guild.id
diff --git a/src/events/stickerUpdate.ts b/src/events/stickerUpdate.ts
index 46c4d17..662f981 100644
--- a/src/events/stickerUpdate.ts
+++ b/src/events/stickerUpdate.ts
@@ -1,8 +1,7 @@
 export const event = "stickerUpdate";
 
 export async function callback(client, oe, ne) {
-    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } =
-        client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = client.logger;
 
     if (oe.name === ne.name) return;
     const auditLog = await getAuditLog(ne.guild, "EMOJI_UPDATE");
@@ -12,10 +11,7 @@
     const changes = {
         stickerId: entry(ne.id, `\`${ne.id}\``),
         edited: entry(ne.createdTimestamp, renderDelta(ne.createdTimestamp)),
-        editedBy: entry(
-            audit.executor.id,
-            renderUser((await ne.guild.members.fetch(audit.executor.id)).user)
-        ),
+        editedBy: entry(audit.executor.id, renderUser((await ne.guild.members.fetch(audit.executor.id)).user)),
         name: entry([oe.name, ne.name], `\`:${oe.name}:\` -> \`:${ne.name}:\``)
     };
     const data = {
diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts
index 4fdedcb..da3cbae 100644
--- a/src/events/threadCreate.ts
+++ b/src/events/threadCreate.ts
@@ -2,19 +2,9 @@
 export const event = "threadCreate";
 
 export async function callback(client, thread) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = thread.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = thread.client.logger;
     const auditLog = await getAuditLog(thread.guild, "THREAD_CREATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === thread.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === thread.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -31,9 +21,7 @@
             parentChannel: entry(thread.parentId, renderChannel(thread.parent)),
             category: entry(
                 thread.parent.parent ? thread.parent.parent.name : "None",
-                thread.parent.parent
-                    ? renderChannel(thread.parent.parent)
-                    : "None"
+                thread.parent.parent ? renderChannel(thread.parent.parent) : "None"
             ),
             autoArchiveDuration: entry(
                 thread.autoArchiveDuration,
@@ -42,10 +30,7 @@
                 })
             ),
             createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                thread.createdTimestamp,
-                renderDelta(thread.createdTimestamp)
-            )
+            created: entry(thread.createdTimestamp, renderDelta(thread.createdTimestamp))
         },
         hidden: {
             guild: thread.guild.id
diff --git a/src/events/threadDelete.ts b/src/events/threadDelete.ts
index 0077eff..bfae11a 100644
--- a/src/events/threadDelete.ts
+++ b/src/events/threadDelete.ts
@@ -2,19 +2,9 @@
 export const event = "threadDelete";
 
 export async function callback(client, thread) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = thread.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = thread.client.logger;
     const auditLog = await getAuditLog(thread.guild, "THREAD_UPDATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === thread.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === thread.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -31,9 +21,7 @@
             parentChannel: entry(thread.parentId, renderChannel(thread.parent)),
             category: entry(
                 thread.parent.parent ? thread.parent.parent.name : "None",
-                thread.parent.parent
-                    ? renderChannel(thread.parent.parent)
-                    : "None"
+                thread.parent.parent ? renderChannel(thread.parent.parent) : "None"
             ),
             autoArchiveDuration: entry(
                 thread.autoArchiveDuration,
@@ -43,14 +31,8 @@
             ),
             membersInThread: entry(thread.memberCount, thread.memberCount),
             deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                thread.createdTimestamp,
-                renderDelta(thread.createdTimestamp)
-            ),
-            deleted: entry(
-                new Date().getTime(),
-                renderDelta(new Date().getTime())
-            )
+            created: entry(thread.createdTimestamp, renderDelta(thread.createdTimestamp)),
+            deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
         },
         hidden: {
             guild: thread.guild.id
diff --git a/src/events/threadUpdate.ts b/src/events/threadUpdate.ts
index ff36ce0..144dc84 100644
--- a/src/events/threadUpdate.ts
+++ b/src/events/threadUpdate.ts
@@ -2,19 +2,9 @@
 export const event = "threadUpdate";
 
 export async function callback(client, before, after) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = after.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = after.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) => entry.target.id === after.id).first();
     if (audit.executor.id === client.user.id) return;
     const list = {
         threadId: entry(after.id, `\`${after.id}\``),
@@ -22,10 +12,7 @@
         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(
@@ -40,16 +27,11 @@
     if (before.rateLimitPerUser !== after.rateLimitPerUser) {
         list.slowmode = entry(
             [before.rateLimitPerUser, after.rateLimitPerUser],
-            `${humanizeDuration(
-                before.rateLimitPerUser * 1000
-            )} -> ${humanizeDuration(after.rateLimitPerUser * 1000)}`
+            `${humanizeDuration(before.rateLimitPerUser * 1000)} -> ${humanizeDuration(after.rateLimitPerUser * 1000)}`
         );
     }
     if (!(Object.keys(list).length - 3)) return;
-    list.updated = entry(
-        new Date().getTime(),
-        renderDelta(new Date().getTime())
-    );
+    list.updated = entry(new Date().getTime(), renderDelta(new Date().getTime()));
     list.updatedBy = entry(audit.executor.id, renderUser(audit.executor));
     const data = {
         meta: {
diff --git a/src/events/webhookUpdate.ts b/src/events/webhookUpdate.ts
index ae88cac..2e95c4b 100644
--- a/src/events/webhookUpdate.ts
+++ b/src/events/webhookUpdate.ts
@@ -3,20 +3,9 @@
 import type { HaikuClient } from "jshaiku";
 export const event = "webhookUpdate";
 
-export async function callback(
-    client: HaikuClient,
-    channel: Discord.GuildChannel
-) {
+export async function callback(client: HaikuClient, channel: Discord.GuildChannel) {
     try {
-        const {
-            getAuditLog,
-            log,
-            NucleusColors,
-            entry,
-            renderUser,
-            renderChannel,
-            renderDelta
-        } = client.logger;
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger;
         let auditLogCreate = getAuditLog(channel.guild, "WEBHOOK_CREATE");
         let auditLogUpdate = getAuditLog(channel.guild, "WEBHOOK_UPDATE");
         let auditLogDelete = getAuditLog(channel.guild, "WEBHOOK_DELETE");
@@ -25,15 +14,9 @@
             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) => 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();
         if (!auditCreate && !auditUpdate && !auditDelete) return;
         let audit = auditCreate;
         let action = "Create";
@@ -42,10 +25,7 @@
             updated: { value: string; displayValue: string };
             deleted: { value: string; displayValue: string };
         };
-        if (
-            auditUpdate &&
-            auditUpdate.createdTimestamp > audit.createdTimestamp
-        ) {
+        if (auditUpdate && auditUpdate.createdTimestamp > audit.createdTimestamp) {
             const { before, after } = auditUpdate.changes.reduce(
                 (acc, change) => {
                     acc.before[change.key] = change.old;
@@ -55,40 +35,21 @@
                 { 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(
                     [before.channel_id, after.channel_id],
-                    renderChannel(
-                        await client.channels.fetch(before.channel_id)
-                    ) +
+                    renderChannel(await client.channels.fetch(before.channel_id)) +
                         " -> " +
-                        renderChannel(
-                            await client.channels.fetch(after.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
-        ) {
+        } else if (auditDelete && auditDelete.createdTimestamp > audit.createdTimestamp) {
             const { before } = auditDelete.changes.reduce(
                 (acc, change) => {
                     acc.before[change.key] = change.old;
@@ -99,29 +60,12 @@
             );
             list = {
                 name: entry(before.name, `${before.name}`),
-                channel: entry(
-                    before.channel_id,
-                    renderChannel(
-                        await client.channels.fetch(before.channel_id)
-                    )
-                ),
-                created: entry(
-                    auditDelete.target.createdTimestamp,
-                    renderDelta(auditDelete.target.createdTimestamp)
-                ),
-                deleted: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                ),
+                channel: entry(before.channel_id, renderChannel(await client.channels.fetch(before.channel_id))),
+                created: entry(auditDelete.target.createdTimestamp, renderDelta(auditDelete.target.createdTimestamp)),
+                deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                 deletedBy: entry(
                     auditDelete.executor.id,
-                    renderUser(
-                        (
-                            await channel.guild.members.fetch(
-                                auditDelete.executor.id
-                            )
-                        ).user
-                    )
+                    renderUser((await channel.guild.members.fetch(auditDelete.executor.id)).user)
                 )
             };
             audit = auditDelete;
@@ -137,26 +81,12 @@
             );
             list = {
                 name: entry(before.name, `${before.name}`),
-                channel: entry(
-                    before.channel_id,
-                    renderChannel(
-                        await client.channels.fetch(before.channel_id)
-                    )
-                ),
+                channel: entry(before.channel_id, renderChannel(await client.channels.fetch(before.channel_id))),
                 createdBy: entry(
                     auditCreate.executor.id,
-                    renderUser(
-                        (
-                            await channel.guild.members.fetch(
-                                auditCreate.executor.id
-                            )
-                        ).user
-                    )
+                    renderUser((await channel.guild.members.fetch(auditCreate.executor.id)).user)
                 ),
-                created: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                )
+                created: entry(new Date().getTime(), renderDelta(new Date().getTime()))
             };
         }
         const cols = {
