diff --git a/src/events/channelCreate.ts b/src/events/channelCreate.ts
index b42ded7..90a7f6d 100644
--- a/src/events/channelCreate.ts
+++ b/src/events/channelCreate.ts
@@ -5,9 +5,10 @@
 
 export async function callback(client: NucleusClient, channel: GuildBasedChannel) {
     const { getAuditLog, log, isLogging, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
-    if (!await isLogging(channel.guild.id, "channelUpdate")) return;
-    const auditLog = (await getAuditLog(channel.guild, AuditLogEvent.ChannelCreate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildBasedChannel)!.id === channel.id)[0];
+    if (!(await isLogging(channel.guild.id, "channelUpdate"))) return;
+    const auditLog = (await getAuditLog(channel.guild, AuditLogEvent.ChannelCreate)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as GuildBasedChannel)!.id === channel.id
+    )[0];
     if (!auditLog) return;
     if (auditLog.executor!.id === client.user!.id) return;
     let emoji;
@@ -81,4 +82,4 @@
         }
     };
     log(data);
-};
+}
diff --git a/src/events/channelDelete.ts b/src/events/channelDelete.ts
index 890a15f..8dffd38 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -15,9 +15,10 @@
 
 export async function callback(client: NucleusClient, channel: GuildBasedChannel) {
     const { getAuditLog, log, isLogging, NucleusColors, entry, renderDelta, renderUser } = client.logger;
-    if (!await isLogging(channel.guild.id, "channelUpdate")) return;
-    const auditLog = (await getAuditLog(channel.guild, AuditLogEvent.ChannelDelete))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildBasedChannel)!.id === channel.id)[0];
+    if (!(await isLogging(channel.guild.id, "channelUpdate"))) return;
+    const auditLog = (await getAuditLog(channel.guild, AuditLogEvent.ChannelDelete)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as GuildBasedChannel)!.id === channel.id
+    )[0];
     if (!auditLog) return;
     if (auditLog.executor!.id === client.user!.id) return;
 
@@ -30,32 +31,38 @@
             readableType = "Text";
             displayName = "Text Channel";
             break;
-        } case ChannelType.GuildAnnouncement: {
+        }
+        case ChannelType.GuildAnnouncement: {
             emoji = "CHANNEL.TEXT.DELETE";
             readableType = "Announcement";
             displayName = "Announcement Channel";
             break;
-        } case ChannelType.GuildVoice: {
+        }
+        case ChannelType.GuildVoice: {
             emoji = "CHANNEL.VOICE.DELETE";
             readableType = "Voice";
             displayName = "Voice Channel";
             break;
-        } case ChannelType.GuildCategory: {
+        }
+        case ChannelType.GuildCategory: {
             emoji = "CHANNEL.CATEGORY.DELETE";
             readableType = "Category";
             displayName = "Category";
             break;
-        } case ChannelType.GuildStageVoice: {
+        }
+        case ChannelType.GuildStageVoice: {
             emoji = "CHANNEL.VOICE.DELETE";
             readableType = "Stage";
             displayName = "Stage Channel";
             break;
-        } case ChannelType.GuildForum: {
+        }
+        case ChannelType.GuildForum: {
             emoji = "CHANNEL.TEXT.DELETE";
             readableType = "Forum";
             displayName = "Forum Channel";
             break;
-        } default: {
+        }
+        default: {
             emoji = "CHANNEL.TEXT.DELETE";
             readableType = "Channel";
             displayName = "Channel";
diff --git a/src/events/channelUpdate.ts b/src/events/channelUpdate.ts
index 052acc1..6491cc9 100644
--- a/src/events/channelUpdate.ts
+++ b/src/events/channelUpdate.ts
@@ -1,5 +1,5 @@
-import { GuildChannel, AuditLogEvent, ChannelType, TextChannel, VoiceChannel, StageChannel } from 'discord.js';
-import type { GuildAuditLogsEntry } from 'discord.js';
+import { GuildChannel, AuditLogEvent, ChannelType, TextChannel, VoiceChannel, StageChannel } from "discord.js";
+import type { GuildAuditLogsEntry } from "discord.js";
 //@ts-expect-error
 import humanizeDuration from "humanize-duration";
 import type { NucleusClient } from "../utils/client.js";
@@ -10,12 +10,12 @@
 let entry = c.logger.entry;
 
 const channelTypeEmoji: Record<number, string> = {
-    0: "Text",  // Text channel
-    2: "Voice",  // Voice channel
-    5: "Announcement",  // Announcement channel
-    13: "Stage",  // Stage channel
-    15: "Forum",  // Forum channel
-    99: "Rules"  // Rules channel
+    0: "Text", // Text channel
+    2: "Voice", // Voice channel
+    5: "Announcement", // Announcement channel
+    13: "Stage", // Stage channel
+    15: "Forum", // Forum channel
+    99: "Rules" // Rules channel
 };
 
 interface channelChanges {
@@ -39,19 +39,20 @@
     autoArchiveDuration?: ReturnType<typeof entry>;
 }
 
-
-
 export const event = "channelUpdate";
 
 export async function callback(client: NucleusClient, oldChannel: GuildChannel, newChannel: GuildChannel) {
     const { getAuditLog, log, isLogging, NucleusColors, renderDelta, renderUser, renderChannel } = client.logger;
-    if (!await isLogging(newChannel.guild.id, "channelUpdate")) return;
+    if (!(await isLogging(newChannel.guild.id, "channelUpdate"))) return;
     const config = await client.memory.readGuildInfo(newChannel.guild.id);
     entry = client.logger.entry;
     if (newChannel.parent && newChannel.parent.id === config.tickets.category) return;
 
-    const auditLog: null | GuildAuditLogsEntry<AuditLogEvent.ChannelUpdate> = (await getAuditLog(newChannel.guild, AuditLogEvent.ChannelUpdate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildChannel)!.id === newChannel.id)[0] as GuildAuditLogsEntry<AuditLogEvent.ChannelUpdate> | null;
+    const auditLog: null | GuildAuditLogsEntry<AuditLogEvent.ChannelUpdate> = (
+        await getAuditLog(newChannel.guild, AuditLogEvent.ChannelUpdate)
+    ).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as GuildChannel)!.id === newChannel.id
+    )[0] as GuildAuditLogsEntry<AuditLogEvent.ChannelUpdate> | null;
     if (!auditLog) return;
     if (auditLog.executor!.id === client.user!.id) return;
 
@@ -62,11 +63,18 @@
         channelId: entry(newChannel.id, `\`${newChannel.id}\``),
         channel: entry(newChannel.id, renderChannel(newChannel)),
         edited: entry(Date.now(), renderDelta(Date.now())),
-        editedBy: entry(auditLog.executor!.id, renderUser((await newChannel.guild.members.fetch(auditLog.executor!.id)).user)),
+        editedBy: entry(
+            auditLog.executor!.id,
+            renderUser((await newChannel.guild.members.fetch(auditLog.executor!.id)).user)
+        )
     };
-    if (oldChannel.name !== newChannel.name) changes.name = entry([oldChannel.name, newChannel.name], `${oldChannel.name} -> ${newChannel.name}`);
+    if (oldChannel.name !== newChannel.name)
+        changes.name = entry([oldChannel.name, newChannel.name], `${oldChannel.name} -> ${newChannel.name}`);
     if (oldChannel.position !== newChannel.position)
-        changes.position = entry([oldChannel.position.toString(), newChannel.position.toString()], `${oldChannel.position} -> ${newChannel.position}`);
+        changes.position = entry(
+            [oldChannel.position.toString(), newChannel.position.toString()],
+            `${oldChannel.position} -> ${newChannel.position}`
+        );
 
     switch (newChannel.type) {
         case ChannelType.PrivateThread:
@@ -94,20 +102,46 @@
                 newTopic = "None";
             }
             const nsfw = ["", ""];
-            nsfw[0] = (oldChannel as TextChannel).nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
-            nsfw[1] = (newChannel as TextChannel).nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+            nsfw[0] = (oldChannel as TextChannel).nsfw
+                ? `${getEmojiByName("CONTROL.TICK")} Yes`
+                : `${getEmojiByName("CONTROL.CROSS")} No`;
+            nsfw[1] = (newChannel as TextChannel).nsfw
+                ? `${getEmojiByName("CONTROL.TICK")} Yes`
+                : `${getEmojiByName("CONTROL.CROSS")} No`;
             if (oldTopic !== newTopic)
-                changes.description = entry([(oldChannel as TextChannel).topic ?? "", (newChannel as TextChannel).topic ?? ""], `\nBefore: ${oldTopic}\nAfter: ${newTopic}`);
-            if ((oldChannel as TextChannel).nsfw !== (newChannel as TextChannel).nsfw) changes.nsfw = entry([(oldChannel as TextChannel).nsfw ? "On" : "Off", (newChannel as TextChannel).nsfw ? "On" : "Off"], `${nsfw[0]} -> ${nsfw[1]}`);
+                changes.description = entry(
+                    [(oldChannel as TextChannel).topic ?? "", (newChannel as TextChannel).topic ?? ""],
+                    `\nBefore: ${oldTopic}\nAfter: ${newTopic}`
+                );
+            if ((oldChannel as TextChannel).nsfw !== (newChannel as TextChannel).nsfw)
+                changes.nsfw = entry(
+                    [(oldChannel as TextChannel).nsfw ? "On" : "Off", (newChannel as TextChannel).nsfw ? "On" : "Off"],
+                    `${nsfw[0]} -> ${nsfw[1]}`
+                );
             if ((oldChannel as TextChannel).rateLimitPerUser !== (newChannel as TextChannel).rateLimitPerUser)
                 changes.slowmode = entry(
-                    [((oldChannel as TextChannel).rateLimitPerUser).toString(), ((newChannel as TextChannel).rateLimitPerUser).toString()],
-                    `${humanizeDuration((oldChannel as TextChannel).rateLimitPerUser * 1000)} -> ${humanizeDuration((newChannel as TextChannel).rateLimitPerUser * 1000)}`
+                    [
+                        (oldChannel as TextChannel).rateLimitPerUser.toString(),
+                        (newChannel as TextChannel).rateLimitPerUser.toString()
+                    ],
+                    `${humanizeDuration((oldChannel as TextChannel).rateLimitPerUser * 1000)} -> ${humanizeDuration(
+                        (newChannel as TextChannel).rateLimitPerUser * 1000
+                    )}`
                 );
-            if((oldChannel as TextChannel).defaultAutoArchiveDuration !== (newChannel as TextChannel).defaultAutoArchiveDuration) {
+            if (
+                (oldChannel as TextChannel).defaultAutoArchiveDuration !==
+                (newChannel as TextChannel).defaultAutoArchiveDuration
+            ) {
                 changes.autoArchiveDuration = entry(
-                    [((oldChannel as TextChannel).defaultAutoArchiveDuration ?? 4320).toString(), ((newChannel as TextChannel).defaultAutoArchiveDuration ?? 4320).toString()],
-                    `${humanizeDuration(((oldChannel as TextChannel).defaultAutoArchiveDuration ?? 4320) * 60 * 1000)} -> ${humanizeDuration(((newChannel as TextChannel).defaultAutoArchiveDuration ?? 4320) * 60 * 1000)}`
+                    [
+                        ((oldChannel as TextChannel).defaultAutoArchiveDuration ?? 4320).toString(),
+                        ((newChannel as TextChannel).defaultAutoArchiveDuration ?? 4320).toString()
+                    ],
+                    `${humanizeDuration(
+                        ((oldChannel as TextChannel).defaultAutoArchiveDuration ?? 4320) * 60 * 1000
+                    )} -> ${humanizeDuration(
+                        ((newChannel as TextChannel).defaultAutoArchiveDuration ?? 4320) * 60 * 1000
+                    )}`
                 );
             }
 
@@ -134,12 +168,27 @@
                 newTopic = "None";
             }
             if ((oldChannel as TextChannel).nsfw !== (newChannel as TextChannel).nsfw) {
-                changes.nsfw = entry([(oldChannel as TextChannel).nsfw ? "On" : "Off", (newChannel as TextChannel).nsfw ? "On" : "Off"], `${(oldChannel as TextChannel).nsfw ? "On" : "Off"} -> ${(newChannel as TextChannel).nsfw ? "On" : "Off"}`);
+                changes.nsfw = entry(
+                    [(oldChannel as TextChannel).nsfw ? "On" : "Off", (newChannel as TextChannel).nsfw ? "On" : "Off"],
+                    `${(oldChannel as TextChannel).nsfw ? "On" : "Off"} -> ${
+                        (newChannel as TextChannel).nsfw ? "On" : "Off"
+                    }`
+                );
             }
-            if((oldChannel as TextChannel).defaultAutoArchiveDuration !== (newChannel as TextChannel).defaultAutoArchiveDuration) {
+            if (
+                (oldChannel as TextChannel).defaultAutoArchiveDuration !==
+                (newChannel as TextChannel).defaultAutoArchiveDuration
+            ) {
                 changes.autoArchiveDuration = entry(
-                    [((oldChannel as TextChannel).defaultAutoArchiveDuration ?? 4320).toString(), ((newChannel as TextChannel).defaultAutoArchiveDuration ?? 4320).toString()],
-                    `${humanizeDuration(((oldChannel as TextChannel).defaultAutoArchiveDuration ?? 4320) * 60 * 1000)} -> ${humanizeDuration(((newChannel as TextChannel).defaultAutoArchiveDuration ?? 4320) * 60 * 1000)}`
+                    [
+                        ((oldChannel as TextChannel).defaultAutoArchiveDuration ?? 4320).toString(),
+                        ((newChannel as TextChannel).defaultAutoArchiveDuration ?? 4320).toString()
+                    ],
+                    `${humanizeDuration(
+                        ((oldChannel as TextChannel).defaultAutoArchiveDuration ?? 4320) * 60 * 1000
+                    )} -> ${humanizeDuration(
+                        ((newChannel as TextChannel).defaultAutoArchiveDuration ?? 4320) * 60 * 1000
+                    )}`
                 );
             }
             break;
@@ -149,16 +198,29 @@
             readableType = "Voice";
             displayName = "Voice Channel";
             if ((oldChannel as VoiceChannel).bitrate !== (newChannel as VoiceChannel).bitrate)
-                changes.bitrate = entry([(oldChannel as VoiceChannel).bitrate.toString(), (newChannel as VoiceChannel).bitrate.toString()], `${(oldChannel as VoiceChannel).bitrate} -> ${(newChannel as VoiceChannel).bitrate}`);
+                changes.bitrate = entry(
+                    [(oldChannel as VoiceChannel).bitrate.toString(), (newChannel as VoiceChannel).bitrate.toString()],
+                    `${(oldChannel as VoiceChannel).bitrate} -> ${(newChannel as VoiceChannel).bitrate}`
+                );
             if ((oldChannel as VoiceChannel).userLimit !== (newChannel as VoiceChannel).userLimit)
                 changes.maxUsers = entry(
-                    [(oldChannel as VoiceChannel).userLimit.toString(), (newChannel as VoiceChannel).userLimit.toString()],
-                    `${(oldChannel as VoiceChannel).userLimit ? (oldChannel as VoiceChannel).userLimit : "Unlimited"} -> ${(newChannel as VoiceChannel).userLimit}`
+                    [
+                        (oldChannel as VoiceChannel).userLimit.toString(),
+                        (newChannel as VoiceChannel).userLimit.toString()
+                    ],
+                    `${
+                        (oldChannel as VoiceChannel).userLimit ? (oldChannel as VoiceChannel).userLimit : "Unlimited"
+                    } -> ${(newChannel as VoiceChannel).userLimit}`
                 );
             if ((oldChannel as VoiceChannel).rtcRegion !== (newChannel as VoiceChannel).rtcRegion)
                 changes.region = entry(
-                    [(oldChannel as VoiceChannel).rtcRegion ?? "automatic", (newChannel as VoiceChannel).rtcRegion ?? "automatic"],
-                    `${capitalize((oldChannel as VoiceChannel).rtcRegion?.toUpperCase() ?? "automatic")} -> ${capitalize((newChannel as VoiceChannel).rtcRegion?.toUpperCase() ?? "automatic")}`
+                    [
+                        (oldChannel as VoiceChannel).rtcRegion ?? "automatic",
+                        (newChannel as VoiceChannel).rtcRegion ?? "automatic"
+                    ],
+                    `${capitalize(
+                        (oldChannel as VoiceChannel).rtcRegion?.toUpperCase() ?? "automatic"
+                    )} -> ${capitalize((newChannel as VoiceChannel).rtcRegion?.toUpperCase() ?? "automatic")}`
                 );
             break;
         }
@@ -183,16 +245,29 @@
                 newTopic = "None";
             }
             if ((oldChannel as StageChannel).bitrate !== (newChannel as StageChannel).bitrate)
-                changes.bitrate = entry([(oldChannel as StageChannel).bitrate.toString(), (newChannel as StageChannel).bitrate.toString()], `${(oldChannel as StageChannel).bitrate} -> ${(newChannel as StageChannel).bitrate}`);
+                changes.bitrate = entry(
+                    [(oldChannel as StageChannel).bitrate.toString(), (newChannel as StageChannel).bitrate.toString()],
+                    `${(oldChannel as StageChannel).bitrate} -> ${(newChannel as StageChannel).bitrate}`
+                );
             if ((oldChannel as StageChannel).userLimit !== (newChannel as StageChannel).userLimit)
                 changes.maxUsers = entry(
-                    [(oldChannel as StageChannel).userLimit.toString(), (newChannel as StageChannel).userLimit.toString()],
-                    `${(oldChannel as StageChannel).userLimit ? (oldChannel as StageChannel).userLimit : "Unlimited"} -> ${(newChannel as StageChannel).userLimit}`
+                    [
+                        (oldChannel as StageChannel).userLimit.toString(),
+                        (newChannel as StageChannel).userLimit.toString()
+                    ],
+                    `${
+                        (oldChannel as StageChannel).userLimit ? (oldChannel as StageChannel).userLimit : "Unlimited"
+                    } -> ${(newChannel as StageChannel).userLimit}`
                 );
             if ((oldChannel as StageChannel).rtcRegion !== (newChannel as StageChannel).rtcRegion)
                 changes.region = entry(
-                    [(oldChannel as StageChannel).rtcRegion ?? "Automatic", (newChannel as StageChannel).rtcRegion ?? "Automatic"],
-                    `${capitalize((oldChannel as StageChannel).rtcRegion?.toLowerCase() ?? "automatic")} -> ${capitalize((newChannel as StageChannel).rtcRegion?.toLowerCase() ?? "automatic")}`
+                    [
+                        (oldChannel as StageChannel).rtcRegion ?? "Automatic",
+                        (newChannel as StageChannel).rtcRegion ?? "Automatic"
+                    ],
+                    `${capitalize(
+                        (oldChannel as StageChannel).rtcRegion?.toLowerCase() ?? "automatic"
+                    )} -> ${capitalize((newChannel as StageChannel).rtcRegion?.toLowerCase() ?? "automatic")}`
                 );
             break;
         }
@@ -210,8 +285,7 @@
     }
     const ocType = channelTypeEmoji[oldChannel.type],
         ncType = channelTypeEmoji[newChannel.type];
-    if (oldChannel.type !== newChannel.type)
-        changes.type = entry([ocType!, ncType!], `${ocType!} -> ${readableType}`);
+    if (oldChannel.type !== newChannel.type) changes.type = entry([ocType!, ncType!], `${ocType!} -> ${readableType}`);
     if (!(Object.values(changes).length - 4)) return;
     const data = {
         meta: {
diff --git a/src/events/commandError.ts b/src/events/commandError.ts
index ff5f4ae..e7d9bf5 100644
--- a/src/events/commandError.ts
+++ b/src/events/commandError.ts
@@ -1,16 +1,20 @@
-import type { ButtonInteraction, ContextMenuCommandInteraction } from 'discord.js';
-import type { CommandInteraction } from 'discord.js';
+import type { ButtonInteraction, ContextMenuCommandInteraction } from "discord.js";
+import type { CommandInteraction } from "discord.js";
 import type { NucleusClient } from "../utils/client.js";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 
 export const event = "commandError";
 
-export async function callback(_: NucleusClient, interaction: CommandInteraction | ButtonInteraction | ContextMenuCommandInteraction, error: string) {
+export async function callback(
+    _: NucleusClient,
+    interaction: CommandInteraction | ButtonInteraction | ContextMenuCommandInteraction,
+    error: string
+) {
     const embed = new EmojiEmbed()
         .setTitle("Something went wrong")
         .setDescription(error)
         .setStatus("Danger")
-        .setEmoji("CONTROL.BLOCKCROSS")
+        .setEmoji("CONTROL.BLOCKCROSS");
     if (interaction.replied || interaction.deferred) {
         await interaction.followUp({
             embeds: [embed],
diff --git a/src/events/emojiCreate.ts b/src/events/emojiCreate.ts
index 2630295..96f7909 100644
--- a/src/events/emojiCreate.ts
+++ b/src/events/emojiCreate.ts
@@ -1,13 +1,14 @@
-import { AuditLogEvent } from 'discord.js';
+import { AuditLogEvent } from "discord.js";
 import type { NucleusClient } from "../utils/client.js";
-import type { GuildEmoji, GuildAuditLogsEntry } from 'discord.js'
+import type { GuildEmoji, GuildAuditLogsEntry } from "discord.js";
 export const event = "emojiCreate";
 
 export async function callback(client: NucleusClient, emoji: GuildEmoji) {
     const { getAuditLog, log, isLogging, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = client.logger;
-    if (!await isLogging(emoji.guild.id, "emojiUpdate")) return;
-    const auditLog = (await getAuditLog(emoji.guild, AuditLogEvent.EmojiCreate))
-    .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildEmoji)!.id === emoji.id)[0];
+    if (!(await isLogging(emoji.guild.id, "emojiUpdate"))) return;
+    const auditLog = (await getAuditLog(emoji.guild, AuditLogEvent.EmojiCreate)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as GuildEmoji)!.id === emoji.id
+    )[0];
     if (!auditLog) return;
     if (auditLog.executor!.id === client.user!.id) return;
     const data = {
@@ -31,4 +32,3 @@
     };
     log(data);
 }
-
diff --git a/src/events/emojiDelete.ts b/src/events/emojiDelete.ts
index c4b488e..52822cb 100644
--- a/src/events/emojiDelete.ts
+++ b/src/events/emojiDelete.ts
@@ -1,13 +1,14 @@
-import { AuditLogEvent } from 'discord.js';
+import { AuditLogEvent } from "discord.js";
 import type { NucleusClient } from "../utils/client.js";
-import type { GuildEmoji, GuildAuditLogsEntry } from 'discord.js'
+import type { GuildEmoji, GuildAuditLogsEntry } from "discord.js";
 export const event = "emojiDelete";
 
 export async function callback(client: NucleusClient, emoji: GuildEmoji) {
     const { getAuditLog, log, isLogging, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = client.logger;
-    if (!await isLogging(emoji.guild.id, "emojiUpdate")) return;
-    const auditLog = (await getAuditLog(emoji.guild, AuditLogEvent.EmojiDelete))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildEmoji)!.id === emoji.id)[0];
+    if (!(await isLogging(emoji.guild.id, "emojiUpdate"))) return;
+    const auditLog = (await getAuditLog(emoji.guild, AuditLogEvent.EmojiDelete)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as GuildEmoji)!.id === emoji.id
+    )[0];
     if (!auditLog) return;
     if (auditLog.executor!.id === client.user!.id) return;
     const data = {
diff --git a/src/events/emojiUpdate.ts b/src/events/emojiUpdate.ts
index 98ff558..173f5c5 100644
--- a/src/events/emojiUpdate.ts
+++ b/src/events/emojiUpdate.ts
@@ -1,14 +1,15 @@
-import { AuditLogEvent } from 'discord.js';
+import { AuditLogEvent } from "discord.js";
 import type { NucleusClient } from "../utils/client.js";
-import type { GuildEmoji, GuildAuditLogsEntry } from 'discord.js'
+import type { GuildEmoji, GuildAuditLogsEntry } from "discord.js";
 export const event = "emojiUpdate";
 
 export async function callback(client: NucleusClient, oldEmoji: GuildEmoji, newEmoji: GuildEmoji) {
     const { getAuditLog, log, isLogging, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = client.logger;
     if (!(await isLogging(newEmoji.guild.id, "emojiUpdate"))) return;
 
-    const auditLog = (await getAuditLog(newEmoji.guild, AuditLogEvent.EmojiUpdate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildEmoji)!.id === newEmoji.id)[0];
+    const auditLog = (await getAuditLog(newEmoji.guild, AuditLogEvent.EmojiUpdate)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as GuildEmoji)!.id === newEmoji.id
+    )[0];
     if (!auditLog) return;
     if (auditLog.executor!.id === client.user!.id) return;
 
@@ -16,7 +17,10 @@
         emojiId: entry(newEmoji.id, `\`${newEmoji.id}\``),
         emoji: entry(newEmoji.id, renderEmoji(newEmoji)),
         edited: entry(newEmoji.createdTimestamp, renderDelta(newEmoji.createdTimestamp)),
-        editedBy: entry(auditLog.executor!.id, renderUser((await newEmoji.guild.members.fetch(auditLog.executor!.id)).user)),
+        editedBy: entry(
+            auditLog.executor!.id,
+            renderUser((await newEmoji.guild.members.fetch(auditLog.executor!.id)).user)
+        ),
         name: entry([oldEmoji.name!, newEmoji.name!], `\`:${oldEmoji.name}:\` -> \`:${newEmoji.name}:\``)
     };
     const data = {
diff --git a/src/events/guildBanAdd.ts b/src/events/guildBanAdd.ts
index cac4b41..93f4ec8 100644
--- a/src/events/guildBanAdd.ts
+++ b/src/events/guildBanAdd.ts
@@ -1,5 +1,5 @@
 import type { GuildAuditLogsEntry, GuildBan, User } from "discord.js";
-import { AuditLogEvent } from 'discord.js';
+import { AuditLogEvent } from "discord.js";
 import { purgeByUser } from "../actions/tickets/delete.js";
 import { callback as statsChannelRemove } from "../reflex/statsChannelUpdate.js";
 import type { NucleusClient } from "../utils/client.js";
@@ -11,8 +11,9 @@
     await statsChannelRemove(client, undefined, ban.guild, ban.user);
     purgeByUser(ban.user.id, ban.guild.id);
     if (!(await isLogging(ban.guild.id, "guildMemberPunish"))) return;
-    const auditLog: GuildAuditLogsEntry | undefined = (await getAuditLog(ban.guild, AuditLogEvent.MemberBanAdd))
-        .filter((entry: GuildAuditLogsEntry) => ((entry.target! as User).id === ban.user.id))[0];
+    const auditLog: GuildAuditLogsEntry | undefined = (await getAuditLog(ban.guild, AuditLogEvent.MemberBanAdd)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target! as User).id === ban.user.id
+    )[0];
     if (!auditLog) return;
     if (auditLog.executor!.id === client.user!.id) return;
     await client.database.history.create("ban", ban.guild.id, ban.user, auditLog.executor, auditLog.reason);
diff --git a/src/events/guildBanRemove.ts b/src/events/guildBanRemove.ts
index 3be4560..fc916ba 100644
--- a/src/events/guildBanRemove.ts
+++ b/src/events/guildBanRemove.ts
@@ -6,9 +6,10 @@
 
 export async function callback(client: NucleusClient, ban: GuildBan) {
     const { log, isLogging, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = client.logger;
-    if (!await isLogging(ban.guild.id, "guildMemberPunish")) return;
-    const auditLog = (await getAuditLog(ban.guild, AuditLogEvent.MemberBanRemove))
-        .filter((entry: GuildAuditLogsEntry) => ((entry.target! as User).id === ban.user.id))[0];
+    if (!(await isLogging(ban.guild.id, "guildMemberPunish"))) return;
+    const auditLog = (await getAuditLog(ban.guild, AuditLogEvent.MemberBanRemove)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target! as User).id === ban.user.id
+    )[0];
     if (!auditLog) return;
     if (auditLog.executor!.id === client.user!.id) return;
     await client.database.history.create("unban", ban.guild.id, ban.user, auditLog.executor, auditLog.reason);
diff --git a/src/events/guildDelete.ts b/src/events/guildDelete.ts
index 92af401..0a4904e 100644
--- a/src/events/guildDelete.ts
+++ b/src/events/guildDelete.ts
@@ -1,10 +1,10 @@
-import client, { NucleusClient } from '../utils/client.js'
-import type { Guild } from 'discord.js'
+import client, { NucleusClient } from "../utils/client.js";
+import type { Guild } from "discord.js";
 
-export const event = 'guildDelete'
+export const event = "guildDelete";
 export const callback = async (_client: NucleusClient, guild: Guild) => {
     await client.database.guilds.delete(guild.id);
     await client.database.history.delete(guild.id);
     await client.database.notes.delete(guild.id);
     await client.database.transcripts.deleteAll(guild.id);
-}
\ No newline at end of file
+};
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index 721978f..a0acd34 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -7,37 +7,49 @@
 
 export async function callback(client: NucleusClient, before: GuildMember, after: GuildMember) {
     const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = client.logger;
-    if(before.guild.id === "684492926528651336") {
-        await client.database.premium.checkAllPremium(after)
+    if (before.guild.id === "684492926528651336") {
+        await client.database.premium.checkAllPremium(after);
     }
 
-    if(!before.roles.cache.equals(after.roles.cache)) {
-        const auditLog = (await getAuditLog(after.guild, AuditLogEvent.MemberRoleUpdate))
-            .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === after.id)[0];
+    if (!before.roles.cache.equals(after.roles.cache)) {
+        const auditLog = (await getAuditLog(after.guild, AuditLogEvent.MemberRoleUpdate)).filter(
+            (entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === after.id
+        )[0];
         if (!auditLog) return;
         if (client.noLog.includes(`${after.guild.id}${after.id}${auditLog.id}`)) return;
         generalException(`${after.guild.id}${after.id}${auditLog.id}`);
         if (auditLog.executor!.id !== client.user!.id) {
-            const rolesAdded = after.roles.cache.filter(role => !before.roles.cache.has(role.id));
-            const rolesRemoved = before.roles.cache.filter(role => !after.roles.cache.has(role.id));
+            const rolesAdded = after.roles.cache.filter((role) => !before.roles.cache.has(role.id));
+            const rolesRemoved = before.roles.cache.filter((role) => !after.roles.cache.has(role.id));
             let displayName = "Roles Removed";
             let color = NucleusColors.red;
             let emoji = "GUILD.ROLES.DELETE";
-            if(rolesAdded.size > 0 && rolesRemoved.size > 0) {displayName = "Roles Changed"; color = NucleusColors.yellow; emoji = "GUILD.ROLES.EDIT";}
-            else if(rolesAdded.size > 0) {displayName = "Roles Added"; color = NucleusColors.green; emoji = "GUILD.ROLES.CREATE";}
-            const removedEntry = rolesRemoved.map(role => role.id);
-            const addedEntry = rolesAdded.map(role => role.id);
+            if (rolesAdded.size > 0 && rolesRemoved.size > 0) {
+                displayName = "Roles Changed";
+                color = NucleusColors.yellow;
+                emoji = "GUILD.ROLES.EDIT";
+            } else if (rolesAdded.size > 0) {
+                displayName = "Roles Added";
+                color = NucleusColors.green;
+                emoji = "GUILD.ROLES.CREATE";
+            }
+            const removedEntry = rolesRemoved.map((role) => role.id);
+            const addedEntry = rolesAdded.map((role) => role.id);
 
             let list = {
                 memberId: entry(after.id, `\`${after.id}\``),
-                name: entry(after.user.id, renderUser(after.user)),
+                name: entry(after.user.id, renderUser(after.user))
             };
 
             if (rolesAdded.size > 0) {
-                list = Object.assign(list, {rolesAdded: entry(addedEntry, addedEntry.map(id => `<@&${id}>`).join(", "))});
+                list = Object.assign(list, {
+                    rolesAdded: entry(addedEntry, addedEntry.map((id) => `<@&${id}>`).join(", "))
+                });
             }
             if (rolesRemoved.size > 0) {
-                list = Object.assign(list, {rolesRemoved: entry(removedEntry, removedEntry.map(id => `<@&${id}>`).join(", "))});
+                list = Object.assign(list, {
+                    rolesRemoved: entry(removedEntry, removedEntry.map((id) => `<@&${id}>`).join(", "))
+                });
             }
 
             list = Object.assign(list, {
@@ -60,18 +72,23 @@
                 }
             };
 
-            if(rolesAdded.size > 0) {
-                list = Object.assign(list, {rolesAdded: entry(addedEntry, addedEntry.map(id => `<@&${id}>`).join(", "))});
+            if (rolesAdded.size > 0) {
+                list = Object.assign(list, {
+                    rolesAdded: entry(addedEntry, addedEntry.map((id) => `<@&${id}>`).join(", "))
+                });
             }
-            if(rolesRemoved.size > 0) {
-                list = Object.assign(list, {rolesRemoved: entry(removedEntry, removedEntry.map(id => `<@&${id}>`).join(", "))});
+            if (rolesRemoved.size > 0) {
+                list = Object.assign(list, {
+                    rolesRemoved: entry(removedEntry, removedEntry.map((id) => `<@&${id}>`).join(", "))
+                });
             }
-            data = Object.assign(data, {list: list});
+            data = Object.assign(data, { list: list });
             log(data);
         }
     }
-    const auditLog = (await getAuditLog(after.guild, AuditLogEvent.MemberUpdate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === after.id)[0];
+    const auditLog = (await getAuditLog(after.guild, AuditLogEvent.MemberUpdate)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === after.id
+    )[0];
     if (!auditLog) return;
     if (auditLog.executor!.id === client.user!.id) return;
     if (before.nickname !== after.nickname) {
diff --git a/src/events/guildUpdate.ts b/src/events/guildUpdate.ts
index 6b25e48..dbd747f 100644
--- a/src/events/guildUpdate.ts
+++ b/src/events/guildUpdate.ts
@@ -7,9 +7,10 @@
 export async function callback(client: NucleusClient, before: Guild, after: Guild) {
     await statsChannelUpdate(client, after.members.me!);
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
-    if (!await isLogging(after.id, "guildUpdate")) return;
-    const auditLog = (await getAuditLog(after, AuditLogEvent.GuildUpdate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as Guild)!.id === after.id)[0]!;
+    if (!(await isLogging(after.id, "guildUpdate"))) return;
+    const auditLog = (await getAuditLog(after, AuditLogEvent.GuildUpdate)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as Guild)!.id === after.id
+    )[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const list: Record<string, ReturnType<typeof entry>> = {};
 
@@ -21,23 +22,19 @@
         "Verified phone"
     ];
 
-    const explicitContentFilterLevels = [
-        "Disabled",
-        "Members without roles",
-        "All members"
-    ];
+    const explicitContentFilterLevels = ["Disabled", "Members without roles", "All members"];
 
-    const MFALevels = [
-        "None",
-        "Enabled"
-    ];
+    const MFALevels = ["None", "Enabled"];
 
     const beforeOwner = await before.fetchOwner();
     const afterOwner = await after.fetchOwner();
 
     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,8 +52,13 @@
         );
     if (before.verificationLevel !== after.verificationLevel)
         list["verificationLevel"] = entry(
-            [verificationLevels[before.verificationLevel.valueOf()]!, verificationLevels[before.verificationLevel.valueOf()]!],
-            `${verificationLevels[before.verificationLevel.valueOf()]} -> ${verificationLevels[before.verificationLevel.valueOf()]}`
+            [
+                verificationLevels[before.verificationLevel.valueOf()]!,
+                verificationLevels[before.verificationLevel.valueOf()]!
+            ],
+            `${verificationLevels[before.verificationLevel.valueOf()]} -> ${
+                verificationLevels[before.verificationLevel.valueOf()]
+            }`
         );
     if (before.explicitContentFilter !== after.explicitContentFilter)
         list["explicitContentFilter"] = entry(
diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts
index 80c2c1b..c91f8cd 100644
--- a/src/events/interactionCreate.ts
+++ b/src/events/interactionCreate.ts
@@ -11,17 +11,30 @@
 
 export const event = "interactionCreate";
 
-
 async function interactionCreate(interaction: Interaction) {
     if (interaction.isButton()) {
         switch (interaction.customId) {
-            case "rolemenu":         { return await roleMenu(interaction); }
-            case "verifybutton":     { return await verify(interaction); }
-            case "createticket":     { return await create(interaction); }
-            case "closeticket":      { return await close(interaction); }
-            case "createtranscript": { return await createTranscript(interaction); }
-            case "suggestionAccept": { return await modifySuggestion(interaction, true); }
-            case "suggestionDeny":   { return await modifySuggestion(interaction, false); }
+            case "rolemenu": {
+                return await roleMenu(interaction);
+            }
+            case "verifybutton": {
+                return await verify(interaction);
+            }
+            case "createticket": {
+                return await create(interaction);
+            }
+            case "closeticket": {
+                return await close(interaction);
+            }
+            case "createtranscript": {
+                return await createTranscript(interaction);
+            }
+            case "suggestionAccept": {
+                return await modifySuggestion(interaction, true);
+            }
+            case "suggestionDeny": {
+                return await modifySuggestion(interaction, false);
+            }
         }
     }
 }
@@ -32,7 +45,10 @@
     if (message.embeds.length === 0) return;
     const embed = message.embeds[0];
     const newcolor = accept ? "Success" : "Danger";
-    const footer = {text: `Suggestion ${accept ? "accepted" : "denied"} by ${interaction.user.tag}`, iconURL: interaction.user.displayAvatarURL()};
+    const footer = {
+        text: `Suggestion ${accept ? "accepted" : "denied"} by ${interaction.user.tag}`,
+        iconURL: interaction.user.displayAvatarURL()
+    };
 
     const newEmbed = new EmojiEmbed()
         .setTitle(embed!.title!)
@@ -40,7 +56,7 @@
         .setFooter(footer)
         .setStatus(newcolor);
 
-    await interaction.update({embeds: [newEmbed], components: []});
+    await interaction.update({ embeds: [newEmbed], components: [] });
 }
 
 export async function callback(_client: NucleusClient, interaction: Interaction) {
diff --git a/src/events/inviteCreate.ts b/src/events/inviteCreate.ts
index 34f66dc..240965c 100644
--- a/src/events/inviteCreate.ts
+++ b/src/events/inviteCreate.ts
@@ -6,11 +6,12 @@
 export const event = "inviteCreate";
 
 export async function callback(client: NucleusClient, invite: Invite) {
-    if(!invite.guild) return; // This is a DM invite (not a guild invite
+    if (!invite.guild) return; // This is a DM invite (not a guild invite
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
-    if (!await isLogging(invite.guild.id, "guildUpdate")) return;
-    const auditLog = (await getAuditLog(invite.guild as Guild, AuditLogEvent.InviteCreate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as Invite)!.code === invite.code)[0]!;
+    if (!(await isLogging(invite.guild.id, "guildUpdate"))) return;
+    const auditLog = (await getAuditLog(invite.guild as Guild, AuditLogEvent.InviteCreate)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as Invite)!.code === invite.code
+    )[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const data = {
         meta: {
diff --git a/src/events/inviteDelete.ts b/src/events/inviteDelete.ts
index 456af90..81285c7 100644
--- a/src/events/inviteDelete.ts
+++ b/src/events/inviteDelete.ts
@@ -6,11 +6,12 @@
 export const event = "inviteDelete";
 
 export async function callback(client: NucleusClient, invite: Invite) {
-    if(!invite.guild) return; // This is a DM invite (not a guild invite
+    if (!invite.guild) return; // This is a DM invite (not a guild invite
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
-    if (!await isLogging(invite.guild.id, "guildUpdate")) return;
-    const auditLog = (await getAuditLog(invite.guild as Guild, AuditLogEvent.InviteDelete))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as Invite)!.code === invite.code)[0]!;
+    if (!(await isLogging(invite.guild.id, "guildUpdate"))) return;
+    const auditLog = (await getAuditLog(invite.guild as Guild, AuditLogEvent.InviteDelete)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as Invite)!.code === invite.code
+    )[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const data = {
         meta: {
diff --git a/src/events/memberJoin.ts b/src/events/memberJoin.ts
index 77b111f..bdfd999 100644
--- a/src/events/memberJoin.ts
+++ b/src/events/memberJoin.ts
@@ -9,7 +9,7 @@
     welcome(client, member);
     statsChannelAdd(client, member);
     const { log, isLogging, NucleusColors, entry, renderUser, renderDelta } = client.logger;
-    if (!await isLogging(member.guild.id, "guildMemberUpdate")) return;
+    if (!(await isLogging(member.guild.id, "guildMemberUpdate"))) return;
     await client.database.history.create("join", member.guild.id, member.user, null, null);
     const data = {
         meta: {
diff --git a/src/events/memberLeave.ts b/src/events/memberLeave.ts
index 8b3d1b1..c4ce74e 100644
--- a/src/events/memberLeave.ts
+++ b/src/events/memberLeave.ts
@@ -11,11 +11,13 @@
     purgeByUser(member.id, member.guild.id);
     await statsChannelRemove(client, member);
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
-    if (!await isLogging(member.guild.id, "guildMemberUpdate")) return;
-    const kickAuditLog = (await getAuditLog(member.guild as Guild, AuditLogEvent.MemberKick))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === member.id)[0];
-    const banAuditLog = (await getAuditLog(member.guild as Guild, AuditLogEvent.MemberBanAdd))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === member.id)[0];
+    if (!(await isLogging(member.guild.id, "guildMemberUpdate"))) return;
+    const kickAuditLog = (await getAuditLog(member.guild as Guild, AuditLogEvent.MemberKick)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === member.id
+    )[0];
+    const banAuditLog = (await getAuditLog(member.guild as Guild, AuditLogEvent.MemberBanAdd)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === member.id
+    )[0];
     let type = "leave";
     if (kickAuditLog) {
         if (kickAuditLog.executor!.id === client.user!.id) return;
@@ -27,16 +29,22 @@
         if (banAuditLog.executor!.id === client.user!.id) return;
         if (banAuditLog.createdAt.getTime() >= startTime) {
             if (!kickAuditLog) {
-                return
+                return;
             } else if (kickAuditLog.createdAt.valueOf() < banAuditLog.createdAt.valueOf()) {
-                return
+                return;
             }
         }
     }
     let data;
     if (type === "kick") {
         if (!kickAuditLog) return;
-        await client.database.history.create("kick", member.guild.id, member.user, kickAuditLog.executor, kickAuditLog.reason);
+        await client.database.history.create(
+            "kick",
+            member.guild.id,
+            member.user,
+            kickAuditLog.executor,
+            kickAuditLog.reason
+        );
         data = {
             meta: {
                 type: "memberKick",
@@ -52,7 +60,10 @@
                 joined: entry(member.joinedTimestamp, renderDelta(member.joinedTimestamp?.valueOf()!)),
                 kicked: entry(Date.now(), renderDelta(Date.now())),
                 kickedBy: entry(kickAuditLog.executor!.id, renderUser(kickAuditLog.executor!)),
-                reason: entry(kickAuditLog.reason, kickAuditLog.reason ? `\n> ${kickAuditLog.reason}` : "*No reason provided.*"),
+                reason: entry(
+                    kickAuditLog.reason,
+                    kickAuditLog.reason ? `\n> ${kickAuditLog.reason}` : "*No reason provided.*"
+                ),
                 accountCreated: entry(member.user.createdTimestamp, renderDelta(member.user.createdTimestamp)),
                 serverMemberCount: member.guild.memberCount
             },
diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts
index 14ec7e5..b106d61 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -13,10 +13,11 @@
     if (!message.guild) return;
     const config = await client.memory.readGuildInfo(message.guild.id);
 
-    if (config.autoPublish.enabled 
-        && config.autoPublish.channels.includes(message.channel.id)
-        && message.channel.type === ChannelType.GuildAnnouncement
-        && message.reference === null
+    if (
+        config.autoPublish.enabled &&
+        config.autoPublish.channels.includes(message.channel.id) &&
+        message.channel.type === ChannelType.GuildAnnouncement &&
+        message.reference === null
     ) {
         await message.crosspost();
     }
@@ -34,11 +35,11 @@
     const fileNames = await logAttachment(message);
 
     const content = message.content.toLowerCase() || "";
-    if(config.filters.clean.channels.includes(message.channel.id)) {
-        const memberRoles = message.member!.roles.cache.map(role => role.id);
-        const roleAllow = config.filters.clean.allowed.roles.some(role => memberRoles.includes(role));
+    if (config.filters.clean.channels.includes(message.channel.id)) {
+        const memberRoles = message.member!.roles.cache.map((role) => role.id);
+        const roleAllow = config.filters.clean.allowed.roles.some((role) => memberRoles.includes(role));
         const userAllow = config.filters.clean.allowed.users.includes(message.author.id);
-        if(!roleAllow && !userAllow) return await message.delete();
+        if (!roleAllow && !userAllow) return await message.delete();
     }
 
     const filter = getEmojiByName("ICONS.FILTER");
@@ -94,7 +95,11 @@
     if (fileNames.files.length > 0) {
         for (const element of fileNames.files) {
             const url = element.url ? element.url : element.local;
-            if (/\.(j(pe?g|fif)|a?png|gifv?|w(eb[mp]|av)|mp([34]|eg-\d)|ogg|avi|h\.26(4|5)|cda)$/.test(url.toLowerCase())) {
+            if (
+                /\.(j(pe?g|fif)|a?png|gifv?|w(eb[mp]|av)|mp([34]|eg-\d)|ogg|avi|h\.26(4|5)|cda)$/.test(
+                    url.toLowerCase()
+                )
+            ) {
                 // jpg|jpeg|png|apng|gif|gifv|webm|webp|mp4|wav|mp3|ogg|jfif|MPEG-#|avi|h.264|h.265
                 if (
                     config.filters.images.NSFW &&
@@ -288,7 +293,7 @@
     }
 
     if (config.filters.pings.everyone && message.mentions.everyone) {
-        if(!await isLogging(message.guild.id, "messageMassPing")) return;
+        if (!(await isLogging(message.guild.id, "messageMassPing"))) return;
         const data = {
             meta: {
                 type: "everyonePing",
@@ -313,7 +318,7 @@
             if (!config.filters.pings.allowed.roles.includes(roleId)) {
                 messageException(message.guild.id, message.channel.id, message.id);
                 await message.delete();
-                if(!await isLogging(message.guild.id, "messageMassPing")) return;
+                if (!(await isLogging(message.guild.id, "messageMassPing"))) return;
                 const data = {
                     meta: {
                         type: "rolePing",
@@ -340,7 +345,7 @@
     if (message.mentions.users.size >= config.filters.pings.mass && config.filters.pings.mass) {
         messageException(message.guild.id, message.channel.id, message.id);
         await message.delete();
-        if(!await isLogging(message.guild.id, "messageMassPing")) return;
+        if (!(await isLogging(message.guild.id, "messageMassPing"))) return;
         const data = {
             meta: {
                 type: "massPing",
diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts
index aac83f4..c29bfd0 100644
--- a/src/events/messageDelete.ts
+++ b/src/events/messageDelete.ts
@@ -8,9 +8,10 @@
     if (message.author.bot) return;
     if (client.noLog.includes(`${message.guild!.id}/${message.channel.id}/${message.id}`)) return;
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
-    if (!await isLogging(message.guild!.id, "messageDelete")) return;
-    const auditLog = (await getAuditLog(message.guild!, AuditLogEvent.MemberBanAdd))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target! as User).id === message.author.id)[0];
+    if (!(await isLogging(message.guild!.id, "messageDelete"))) return;
+    const auditLog = (await getAuditLog(message.guild!, AuditLogEvent.MemberBanAdd)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target! as User).id === message.author.id
+    )[0];
     if (auditLog) {
         if (auditLog.createdTimestamp - 1000 < Date.now()) return;
     }
@@ -19,7 +20,8 @@
     content.replace("`", "\\`");
     if (content.length > 256) content = content.substring(0, 253) + "...";
     const attachments =
-        message.attachments.size + (
+        message.attachments.size +
+        (
             message.content.match(
                 /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/gi
             ) ?? []
@@ -28,7 +30,9 @@
     const config = (await client.database.guilds.read(message.guild!.id)).logging.attachments.saved[
         message.channel.id + message.id
     ];
-    if (config) { attachmentJump = ` [[View attachments]](${config})`; }
+    if (config) {
+        attachmentJump = ` [[View attachments]](${config})`;
+    }
     const data = {
         meta: {
             type: "messageDelete",
@@ -44,14 +48,20 @@
         list: {
             messageId: entry(message.id, `\`${message.id}\``),
             sentBy: entry(message.author.id, renderUser(message.author)),
-            sentIn: entry(message.channel.id, renderChannel(message.channel as Discord.GuildChannel | Discord.ThreadChannel)),
+            sentIn: entry(
+                message.channel.id,
+                renderChannel(message.channel as Discord.GuildChannel | Discord.ThreadChannel)
+            ),
             deleted: entry(Date.now(), renderDelta(Date.now())),
             mentions: message.mentions.users.size,
             attachments: entry(attachments, attachments + attachmentJump),
             repliedTo: entry(
                 replyTo ? replyTo.messageId! : null,
-                replyTo ? `[[Jump to message]](https://discord.com/channels/${message.guild!.id}/${message.channel.id}/${replyTo.messageId})`
-                        : "None"
+                replyTo
+                    ? `[[Jump to message]](https://discord.com/channels/${message.guild!.id}/${message.channel.id}/${
+                          replyTo.messageId
+                      })`
+                    : "None"
             )
         },
         hidden: {
diff --git a/src/events/messageEdit.ts b/src/events/messageEdit.ts
index f5a28a4..3b7f482 100644
--- a/src/events/messageEdit.ts
+++ b/src/events/messageEdit.ts
@@ -8,8 +8,9 @@
     if (newMessage.author.id === client.user!.id) return;
     if (newMessage.author.bot) return;
     if (!newMessage.guild) return;
-    const { log, isLogging, NucleusColors, entry, renderUser, renderDelta, renderNumberDelta, renderChannel } = client.logger;
-    
+    const { log, isLogging, NucleusColors, entry, renderUser, renderDelta, renderNumberDelta, renderChannel } =
+        client.logger;
+
     const replyTo: MessageReference | null = newMessage.reference;
     let newContent = newMessage.cleanContent.replaceAll("`", "‘");
     let oldContent = oldMessage.cleanContent.replaceAll("`", "‘");
@@ -21,7 +22,7 @@
         attachmentJump = ` [[View attachments]](${config})`;
     }
     if (newMessage.crosspostable !== oldMessage.crosspostable) {
-        if(!await isLogging(newMessage.guild.id, "messageAnnounce")) return;
+        if (!(await isLogging(newMessage.guild.id, "messageAnnounce"))) return;
         if (!replyTo) {
             const data = {
                 meta: {
@@ -38,15 +39,12 @@
                 list: {
                     messageId: entry(newMessage.id, `\`${newMessage.id}\``),
                     sentBy: entry(newMessage.author.id, renderUser(newMessage.author)),
-                    sentIn: entry(newMessage.channel.id, renderChannel(newMessage.channel as Discord.GuildBasedChannel)),
-                    sent: entry(
-                        newMessage.createdTimestamp,
-                        renderDelta(newMessage.createdTimestamp)
+                    sentIn: entry(
+                        newMessage.channel.id,
+                        renderChannel(newMessage.channel as Discord.GuildBasedChannel)
                     ),
-                    published: entry(
-                        newMessage.editedTimestamp!,
-                        renderDelta(newMessage.editedTimestamp!)
-                    ),
+                    sent: entry(newMessage.createdTimestamp, renderDelta(newMessage.createdTimestamp)),
+                    published: entry(newMessage.editedTimestamp!, renderDelta(newMessage.editedTimestamp!)),
                     mentions: renderNumberDelta(oldMessage.mentions.users.size, newMessage.mentions.users.size),
                     attachments: entry(
                         renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size),
@@ -60,7 +58,7 @@
             return log(data);
         }
     }
-    if (!await isLogging(newMessage.guild.id, "messageUpdate")) return;
+    if (!(await isLogging(newMessage.guild.id, "messageUpdate"))) return;
     if (!newMessage.editedTimestamp) {
         return;
     }
diff --git a/src/events/roleCreate.ts b/src/events/roleCreate.ts
index be385f0..9b900f8 100644
--- a/src/events/roleCreate.ts
+++ b/src/events/roleCreate.ts
@@ -5,10 +5,11 @@
 
 export async function callback(client: NucleusClient, role: Role) {
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta, renderRole } = client.logger;
-    if (!await isLogging(role.guild.id, "guildRoleUpdate")) return;
+    if (!(await isLogging(role.guild.id, "guildRoleUpdate"))) return;
     if (role.managed) return;
-    const auditLog = (await getAuditLog(role.guild as Guild, AuditLogEvent.RoleCreate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as Role)!.id === role.id)[0]!;
+    const auditLog = (await getAuditLog(role.guild as Guild, AuditLogEvent.RoleCreate)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as Role)!.id === role.id
+    )[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const data = {
         meta: {
diff --git a/src/events/roleDelete.ts b/src/events/roleDelete.ts
index b207f4f..e83d557 100644
--- a/src/events/roleDelete.ts
+++ b/src/events/roleDelete.ts
@@ -6,10 +6,11 @@
 
 export async function callback(client: NucleusClient, role: Role) {
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
-    if (!await isLogging(role.guild.id, "guildRoleUpdate")) return;
+    if (!(await isLogging(role.guild.id, "guildRoleUpdate"))) return;
     if (role.managed) return;
-    const auditLog = (await getAuditLog(role.guild as Guild, AuditLogEvent.RoleDelete))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as Role)!.id === role.id)[0]!;
+    const auditLog = (await getAuditLog(role.guild as Guild, AuditLogEvent.RoleDelete)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as Role)!.id === role.id
+    )[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const data = {
         meta: {
diff --git a/src/events/roleUpdate.ts b/src/events/roleUpdate.ts
index 8d9ef10..236bc0f 100644
--- a/src/events/roleUpdate.ts
+++ b/src/events/roleUpdate.ts
@@ -6,9 +6,10 @@
 
 export async function callback(client: NucleusClient, oldRole: Role, newRole: Role) {
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderDelta, renderUser, renderRole } = client.logger;
-    if (!await isLogging(newRole.guild.id, "guildRoleUpdate")) return;
-    const auditLog = (await getAuditLog(newRole.guild as Guild, AuditLogEvent.RoleUpdate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as Role)!.id === newRole.id)[0];
+    if (!(await isLogging(newRole.guild.id, "guildRoleUpdate"))) return;
+    const auditLog = (await getAuditLog(newRole.guild as Guild, AuditLogEvent.RoleUpdate)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as Role)!.id === newRole.id
+    )[0];
     if (!auditLog) return;
     if (auditLog.executor!.id === client.user!.id) return;
 
@@ -16,22 +17,40 @@
         roleId: entry(newRole.id, `\`${newRole.id}\``),
         role: entry(newRole.id, renderRole(newRole)),
         edited: entry(Date.now(), renderDelta(Date.now())),
-        editedBy: entry(auditLog.executor!.id, renderUser((await newRole.guild.members.fetch(auditLog.executor!.id)).user))
+        editedBy: entry(
+            auditLog.executor!.id,
+            renderUser((await newRole.guild.members.fetch(auditLog.executor!.id)).user)
+        )
     };
     const mentionable = ["", ""];
     const hoist = ["", ""];
-    mentionable[0] = oldRole.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
-    mentionable[1] = newRole.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+    mentionable[0] = oldRole.mentionable
+        ? `${getEmojiByName("CONTROL.TICK")} Yes`
+        : `${getEmojiByName("CONTROL.CROSS")} No`;
+    mentionable[1] = newRole.mentionable
+        ? `${getEmojiByName("CONTROL.TICK")} Yes`
+        : `${getEmojiByName("CONTROL.CROSS")} No`;
     hoist[0] = oldRole.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
     hoist[1] = newRole.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
-    if (oldRole.name !== newRole.name) changes["name"] = entry([oldRole.name, newRole.name], `${oldRole.name} -> ${newRole.name}`);
+    if (oldRole.name !== newRole.name)
+        changes["name"] = entry([oldRole.name, newRole.name], `${oldRole.name} -> ${newRole.name}`);
     if (oldRole.position !== newRole.position)
-        changes["position"] = entry([oldRole.position.toString(), newRole.position.toString()], `${oldRole.position} -> ${newRole.position}`);
-    if (oldRole.hoist !== newRole.hoist) changes["showInMemberList"] = entry([oldRole.hoist, newRole.hoist], `${hoist[0]} -> ${hoist[1]}`);
+        changes["position"] = entry(
+            [oldRole.position.toString(), newRole.position.toString()],
+            `${oldRole.position} -> ${newRole.position}`
+        );
+    if (oldRole.hoist !== newRole.hoist)
+        changes["showInMemberList"] = entry([oldRole.hoist, newRole.hoist], `${hoist[0]} -> ${hoist[1]}`);
     if (oldRole.mentionable !== newRole.mentionable)
-        changes["mentionable"] = entry([oldRole.mentionable, newRole.mentionable], `${mentionable[0]} -> ${mentionable[1]}`);
+        changes["mentionable"] = entry(
+            [oldRole.mentionable, newRole.mentionable],
+            `${mentionable[0]} -> ${mentionable[1]}`
+        );
     if (oldRole.hexColor !== newRole.hexColor)
-        changes["color"] = entry([oldRole.hexColor, newRole.hexColor], `\`${oldRole.hexColor}\` -> \`${newRole.hexColor}\``);
+        changes["color"] = entry(
+            [oldRole.hexColor, newRole.hexColor],
+            `\`${oldRole.hexColor}\` -> \`${newRole.hexColor}\``
+        );
     if (oldRole.permissions.bitfield !== newRole.permissions.bitfield) {
         changes["permissions"] = entry(
             [oldRole.permissions.bitfield.toString(), newRole.permissions.bitfield.toString()],
diff --git a/src/events/stickerCreate.ts b/src/events/stickerCreate.ts
index 5d2e443..01944fc 100644
--- a/src/events/stickerCreate.ts
+++ b/src/events/stickerCreate.ts
@@ -6,9 +6,10 @@
 
 export async function callback(client: NucleusClient, sticker: Sticker) {
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
-    if (!await isLogging(sticker.guild!.id, "stickerUpdate")) return;
-    const auditLog = (await getAuditLog(sticker.guild!, AuditLogEvent.StickerCreate))
-    .filter((entry: GuildAuditLogsEntry) => (entry.target as Sticker)!.id === sticker.id)[0]!;
+    if (!(await isLogging(sticker.guild!.id, "stickerUpdate"))) return;
+    const auditLog = (await getAuditLog(sticker.guild!, AuditLogEvent.StickerCreate)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as Sticker)!.id === sticker.id
+    )[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     if (client.noLog.includes(`${sticker.guild!.id}${auditLog.id}`)) return;
     generalException(`${sticker.guild!.id}${auditLog.id}`);
diff --git a/src/events/stickerDelete.ts b/src/events/stickerDelete.ts
index d123f44..a348b73 100644
--- a/src/events/stickerDelete.ts
+++ b/src/events/stickerDelete.ts
@@ -5,9 +5,10 @@
 
 export async function callback(client: NucleusClient, sticker: Sticker) {
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
-    if (!await isLogging(sticker.guild!.id, "stickerUpdate")) return;
-    const auditLog = (await getAuditLog(sticker.guild!, AuditLogEvent.StickerDelete))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as Sticker)!.id === sticker.id)[0]!;
+    if (!(await isLogging(sticker.guild!.id, "stickerUpdate"))) return;
+    const auditLog = (await getAuditLog(sticker.guild!, AuditLogEvent.StickerDelete)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as Sticker)!.id === sticker.id
+    )[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const data = {
         meta: {
diff --git a/src/events/stickerUpdate.ts b/src/events/stickerUpdate.ts
index aef28a4..c42f775 100644
--- a/src/events/stickerUpdate.ts
+++ b/src/events/stickerUpdate.ts
@@ -5,16 +5,20 @@
 
 export async function callback(client: NucleusClient, oldSticker: Sticker, newSticker: Sticker) {
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderDelta, renderUser } = client.logger;
-    if (!await isLogging(newSticker.guild!.id, "stickerUpdate")) return;
+    if (!(await isLogging(newSticker.guild!.id, "stickerUpdate"))) return;
     if (oldSticker.name === newSticker.name) return;
-    const auditLog = (await getAuditLog(newSticker.guild!, AuditLogEvent.StickerUpdate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as Sticker)!.id === newSticker.id)[0]!;
+    const auditLog = (await getAuditLog(newSticker.guild!, AuditLogEvent.StickerUpdate)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as Sticker)!.id === newSticker.id
+    )[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
 
     const changes = {
         stickerId: entry(newSticker.id, `\`${newSticker.id}\``),
         edited: entry(newSticker.createdTimestamp, renderDelta(newSticker.createdTimestamp)),
-        editedBy: entry(auditLog.executor!.id, renderUser((await newSticker.guild!.members.fetch(auditLog.executor!.id)).user)),
+        editedBy: entry(
+            auditLog.executor!.id,
+            renderUser((await newSticker.guild!.members.fetch(auditLog.executor!.id)).user)
+        ),
         name: entry([oldSticker.name, newSticker.name], `\`:${oldSticker.name}:\` -> \`:${newSticker.name}:\``)
     };
     const data = {
diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts
index f56e1bb..cefaf3b 100644
--- a/src/events/threadCreate.ts
+++ b/src/events/threadCreate.ts
@@ -6,9 +6,10 @@
 
 export async function callback(client: NucleusClient, thread: ThreadChannel) {
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
-    if (!await isLogging(thread.guild.id, "channelUpdate")) return;
-    const auditLog = (await getAuditLog(thread.guild, AuditLogEvent.ThreadCreate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as ThreadChannel)!.id === thread.id)[0]!;
+    if (!(await isLogging(thread.guild.id, "channelUpdate"))) return;
+    const auditLog = (await getAuditLog(thread.guild, AuditLogEvent.ThreadCreate)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as ThreadChannel)!.id === thread.id
+    )[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const category = thread.parent
         ? entry(
diff --git a/src/events/threadDelete.ts b/src/events/threadDelete.ts
index bfac75e..ecbf4cf 100644
--- a/src/events/threadDelete.ts
+++ b/src/events/threadDelete.ts
@@ -6,9 +6,10 @@
 
 export async function callback(client: NucleusClient, thread: ThreadChannel) {
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
-    if (!await isLogging(thread.guild.id, "channelUpdate")) return;
-    const auditLog = (await getAuditLog(thread.guild, AuditLogEvent.ThreadDelete))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as ThreadChannel)!.id === thread.id)[0]!;
+    if (!(await isLogging(thread.guild.id, "channelUpdate"))) return;
+    const auditLog = (await getAuditLog(thread.guild, AuditLogEvent.ThreadDelete)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as ThreadChannel)!.id === thread.id
+    )[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const category = thread.parent
         ? entry(
diff --git a/src/events/threadUpdate.ts b/src/events/threadUpdate.ts
index af792bc..510ec30 100644
--- a/src/events/threadUpdate.ts
+++ b/src/events/threadUpdate.ts
@@ -7,9 +7,10 @@
 
 export async function callback(client: NucleusClient, oldThread: ThreadChannel, newThread: ThreadChannel) {
     const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
-    if (!await isLogging(newThread.guild.id, "channelUpdate")) return;
-    const auditLog = (await getAuditLog(newThread.guild, AuditLogEvent.ThreadUpdate))
-        .filter((entry: GuildAuditLogsEntry) => (entry.target as ThreadChannel)!.id === newThread.id)[0]!;
+    if (!(await isLogging(newThread.guild.id, "channelUpdate"))) return;
+    const auditLog = (await getAuditLog(newThread.guild, AuditLogEvent.ThreadUpdate)).filter(
+        (entry: GuildAuditLogsEntry) => (entry.target as ThreadChannel)!.id === newThread.id
+    )[0]!;
     if (auditLog.executor!.id === client.user!.id) return;
     const list: Record<string, ReturnType<typeof entry>> = {
         threadId: entry(newThread.id, `\`${newThread.id}\``),
diff --git a/src/events/webhookUpdate.ts b/src/events/webhookUpdate.ts
index 004f754..438c66e 100644
--- a/src/events/webhookUpdate.ts
+++ b/src/events/webhookUpdate.ts
@@ -10,14 +10,21 @@
 
 export async function callback(client: NucleusClient, channel: Discord.GuildChannel) {
     try {
-        const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger;
-        if (!await isLogging(channel.guild.id, "webhookUpdate")) return;
-        const auditCreate = (await getAuditLog(channel.guild, AuditLogEvent.WebhookCreate))
-            .filter((entry: GuildAuditLogsEntry | null) => (entry?.target) ? (entry.target as Webhook)!.channelId === channel.id : false)[0];
-        const auditDelete = (await getAuditLog(channel.guild, AuditLogEvent.WebhookDelete, 0))
-            .filter((entry: GuildAuditLogsEntry | null) => (entry?.target) ? (entry.target as Webhook)!.channelId === channel.id : false)[0];
-        const auditUpdate = (await getAuditLog(channel.guild, AuditLogEvent.WebhookUpdate, 0))
-            .filter((entry: GuildAuditLogsEntry | null) => (entry?.target) ? (entry.target as Webhook)!.channelId === channel.id : false)[0];
+        const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderChannel, renderDelta } =
+            client.logger;
+        if (!(await isLogging(channel.guild.id, "webhookUpdate"))) return;
+        const auditCreate = (await getAuditLog(channel.guild, AuditLogEvent.WebhookCreate)).filter(
+            (entry: GuildAuditLogsEntry | null) =>
+                entry?.target ? (entry.target as Webhook)!.channelId === channel.id : false
+        )[0];
+        const auditDelete = (await getAuditLog(channel.guild, AuditLogEvent.WebhookDelete, 0)).filter(
+            (entry: GuildAuditLogsEntry | null) =>
+                entry?.target ? (entry.target as Webhook)!.channelId === channel.id : false
+        )[0];
+        const auditUpdate = (await getAuditLog(channel.guild, AuditLogEvent.WebhookUpdate, 0)).filter(
+            (entry: GuildAuditLogsEntry | null) =>
+                entry?.target ? (entry.target as Webhook)!.channelId === channel.id : false
+        )[0];
         if (!auditCreate && !auditUpdate && !auditDelete) return;
         let action: "Create" | "Update" | "Delete" = "Create";
         let list: Record<string, ReturnType<typeof entry> | string> = {};
@@ -25,7 +32,8 @@
         const deleteTimestamp = auditDelete ? auditDelete.createdTimestamp : 0;
         const updateTimestamp = auditUpdate ? auditUpdate.createdTimestamp : 0;
         if (updateTimestamp > createTimestamp && updateTimestamp > deleteTimestamp && auditUpdate) {
-            const { before, after } = auditUpdate.changes.reduce((acc: accType, change) => {
+            const { before, after } = auditUpdate.changes.reduce(
+                (acc: accType, change) => {
                     acc.before[change.key] = change.old?.toString()!;
                     acc.after[change.key] = change.new?.toString()!;
                     return acc;
@@ -37,20 +45,23 @@
             if (before["channel_id"] !== after["channel_id"])
                 list["channel"] = entry(
                     [before["channel_id"]!, after["channel_id"]!],
-                    renderChannel(await client.channels.fetch(before["channel_id"]!) as GuildChannel) +
+                    renderChannel((await client.channels.fetch(before["channel_id"]!)) as GuildChannel) +
                         " -> " +
-                        renderChannel(await client.channels.fetch(after["channel_id"]!) as GuildChannel)
+                        renderChannel((await client.channels.fetch(after["channel_id"]!)) as GuildChannel)
                 );
             if (!Object.keys(list).length) return;
             list["created"] = entry(
-                (auditUpdate.target! as Extract<GuildAuditLogsEntry, {createdTimestamp: number}>).createdTimestamp,
-                renderDelta((auditUpdate.target! as Extract<GuildAuditLogsEntry, {createdTimestamp: number}>).createdTimestamp)
+                (auditUpdate.target! as Extract<GuildAuditLogsEntry, { createdTimestamp: number }>).createdTimestamp,
+                renderDelta(
+                    (auditUpdate.target! as Extract<GuildAuditLogsEntry, { createdTimestamp: number }>).createdTimestamp
+                )
             );
             list["edited"] = entry(after["editedTimestamp"]!, renderDelta(Date.now()));
             list["editedBy"] = entry(auditUpdate.executor!.id, renderUser(auditUpdate.executor!));
             action = "Update";
         } else if (deleteTimestamp > createTimestamp && deleteTimestamp > updateTimestamp && auditDelete) {
-            const { before } = auditDelete.changes.reduce((acc: accType, change) => {
+            const { before } = auditDelete.changes.reduce(
+                (acc: accType, change) => {
                     acc.before[change.key] = change.old?.toString()!;
                     acc.after[change.key] = change.new?.toString()!;
                     return acc;
@@ -59,8 +70,18 @@
             );
             list = {
                 name: entry(before["name"]!, `${before["name"]}`),
-                channel: entry(before["channel_id"]!, renderChannel((await client.channels.fetch(before["channel_id"]!)) as GuildChannel)),
-                created: entry((auditDelete.target! as Extract<GuildAuditLogsEntry, {createdTimestamp: number}>).createdTimestamp, renderDelta((auditDelete.target! as Extract<GuildAuditLogsEntry, {createdTimestamp: number}>).createdTimestamp)),
+                channel: entry(
+                    before["channel_id"]!,
+                    renderChannel((await client.channels.fetch(before["channel_id"]!)) as GuildChannel)
+                ),
+                created: entry(
+                    (auditDelete.target! as Extract<GuildAuditLogsEntry, { createdTimestamp: number }>)
+                        .createdTimestamp,
+                    renderDelta(
+                        (auditDelete.target! as Extract<GuildAuditLogsEntry, { createdTimestamp: number }>)
+                            .createdTimestamp
+                    )
+                ),
                 deleted: entry(Date.now(), renderDelta(Date.now())),
                 deletedBy: entry(
                     auditDelete.executor!.id,
@@ -69,7 +90,8 @@
             };
             action = "Delete";
         } else {
-            const { before } = auditDelete!.changes.reduce((acc: accType, change) => {
+            const { before } = auditDelete!.changes.reduce(
+                (acc: accType, change) => {
                     acc.before[change.key] = change.old?.toString()!;
                     acc.after[change.key] = change.new?.toString()!;
                     return acc;
@@ -78,7 +100,10 @@
             );
             list = {
                 name: entry(before["name"]!, `${before["name"]}`),
-                channel: entry(before["channel_id"]!, renderChannel(await client.channels.fetch(before["channel_id"]!) as GuildChannel)),
+                channel: entry(
+                    before["channel_id"]!,
+                    renderChannel((await client.channels.fetch(before["channel_id"]!)) as GuildChannel)
+                ),
                 createdBy: entry(
                     auditCreate!.executor!.id,
                     renderUser((await channel.guild.members.fetch(auditCreate!.executor!.id)).user)
