diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 88f7b39..91e074d 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -34,7 +34,7 @@
     let deleteDays;
     if (!interaction.isButton()) {
         member = interaction.options.getMember("user") as GuildMember;
-        deleteDays = (interaction.options.get("delete")?.value as number | null) ?? 0
+        deleteDays = (interaction.options.get("delete")?.value as number | null) ?? 0;
     } else {
         deleteDays = 0;
     }
@@ -115,12 +115,7 @@
                         new ButtonBuilder()
                             .setStyle(ButtonStyle.Link)
                             .setLabel(config.moderation.ban.text)
-                            .setURL(
-                                config.moderation.ban.link.replaceAll(
-                                    "{id}",
-                                    member.id
-                                )
-                            )
+                            .setURL(config.moderation.ban.link.replaceAll("{id}", member.id))
                     )
                 );
             }
@@ -204,7 +199,7 @@
         apply = target!;
     } else {
         apply = interaction.options.getMember("user") as GuildMember;
-    };
+    }
     const memberPos = member.roles.cache.size > 1 ? member.roles.highest.position : 0;
     const mePos = me.roles.cache.size > 1 ? me.roles.highest.position : 0;
     const applyPos = apply.roles.cache.size > 1 ? apply.roles.highest.position : 0;
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index 4d325a2..4ef78c8 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -103,12 +103,7 @@
                         new ButtonBuilder()
                             .setStyle(ButtonStyle.Link)
                             .setLabel(config.moderation.kick.text)
-                            .setURL(
-                                config.moderation.kick.link.replaceAll(
-                                    "{id}",
-                                    member.id
-                                )
-                            )
+                            .setURL(config.moderation.kick.link.replaceAll("{id}", member.id))
                     )
                 );
             }
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 51ffc4d..2266a1a 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -1,5 +1,12 @@
 import { LinkWarningFooter, LoadingEmbed } from "../../utils/defaults.js";
-import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle, ButtonInteraction } from "discord.js";
+import Discord, {
+    CommandInteraction,
+    GuildMember,
+    ActionRowBuilder,
+    ButtonBuilder,
+    ButtonStyle,
+    ButtonInteraction
+} from "discord.js";
 import type { SlashCommandSubcommandBuilder } from "discord.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -49,7 +56,10 @@
                 .setRequired(false)
         );
 
-const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<unknown> => {
+const callback = async (
+    interaction: CommandInteraction | ButtonInteraction,
+    member?: GuildMember
+): Promise<unknown> => {
     if (!interaction.guild) return;
     const { log, NucleusColors, renderUser, entry, renderDelta } = client.logger;
     let time: { days: number; hours: number; minutes: number; seconds: number } | null = null;
@@ -62,7 +72,7 @@
             seconds: (interaction.options.get("seconds")?.value as number | null) ?? 0
         };
     } else {
-        time = {days: 0, hours: 0, minutes: 0, seconds: 0};
+        time = { days: 0, hours: 0, minutes: 0, seconds: 0 };
     }
     if (!member) return;
     const config = await client.database.guilds.read(interaction.guild.id);
@@ -203,8 +213,7 @@
                 "appeal",
                 "Create appeal ticket",
                 !(await areTicketsEnabled(interaction.guild.id)),
-                async () =>
-                    await create(interaction.guild!, member!.user, interaction.user, reason),
+                async () => await create(interaction.guild!, member!.user, interaction.user, reason),
                 "An appeal ticket will be created when Confirm is clicked",
                 null,
                 "CONTROL.TICKET",
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index 743579b..cfdcf47 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -1,5 +1,16 @@
 import { LinkWarningFooter } from "./../../utils/defaults.js";
-import { ActionRowBuilder, ButtonBuilder, CommandInteraction, GuildMember, ButtonStyle, Message, ButtonInteraction, ModalBuilder, TextInputBuilder, TextInputStyle } from "discord.js";
+import {
+    ActionRowBuilder,
+    ButtonBuilder,
+    CommandInteraction,
+    GuildMember,
+    ButtonStyle,
+    Message,
+    ButtonInteraction,
+    ModalBuilder,
+    TextInputBuilder,
+    TextInputStyle
+} from "discord.js";
 import type { SlashCommandSubcommandBuilder } from "discord.js";
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -17,7 +28,10 @@
             option.setName("name").setDescription("The name to set | Leave blank to clear").setRequired(false)
         );
 
-const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<unknown> => {
+const callback = async (
+    interaction: CommandInteraction | ButtonInteraction,
+    member?: GuildMember
+): Promise<unknown> => {
     const { log, NucleusColors, entry, renderDelta, renderUser } = client.logger;
     let newNickname;
     if (!interaction.isButton()) {
@@ -39,28 +53,15 @@
             .setDescription(
                 keyValueList({
                     user: renderUser(member.user),
-                    "new nickname": `${
-                        newNickname
-                            ? newNickname
-                            : "*No nickname*"
-                    }`
-                }) +
-                    `Are you sure you want to ${
-                        newNickname ? "change" : "clear"
-                    } <@!${member.id}>'s nickname?`
+                    "new nickname": `${newNickname ? newNickname : "*No nickname*"}`
+                }) + `Are you sure you want to ${newNickname ? "change" : "clear"} <@!${member.id}>'s nickname?`
             )
             .setColor("Danger")
             .addCustomBoolean(
                 "appeal",
                 "Create appeal ticket",
                 !(await areTicketsEnabled(interaction.guild!.id)),
-                async () =>
-                    await create(
-                        interaction.guild!,
-                        member!.user,
-                        interaction.user,
-                        "Nickname changed"
-                    ),
+                async () => await create(interaction.guild!, member!.user, interaction.user, "Nickname changed"),
                 "An appeal ticket will be created",
                 null,
                 "CONTROL.TICKET",
@@ -81,18 +82,16 @@
                 "ICONS.EDIT",
                 "modal",
                 newNickname ?? "",
-                new ModalBuilder()
-                    .setTitle("Editing nickname")
-                    .addComponents(
-                        new ActionRowBuilder<TextInputBuilder>().addComponents(
-                            new TextInputBuilder()
-                                .setCustomId("default")
-                                .setLabel("Nickname")
-                                .setMaxLength(32)
-                                .setRequired(false)
-                                .setStyle(TextInputStyle.Short)
-                                .setValue(newNickname ? newNickname : " ")
-                        )
+                new ModalBuilder().setTitle("Editing nickname").addComponents(
+                    new ActionRowBuilder<TextInputBuilder>().addComponents(
+                        new TextInputBuilder()
+                            .setCustomId("default")
+                            .setLabel("Nickname")
+                            .setMaxLength(32)
+                            .setRequired(false)
+                            .setStyle(TextInputStyle.Short)
+                            .setValue(newNickname ? newNickname : " ")
+                    )
                 )
             )
             .setFailedMessage("No changes were made", "Success", "PUNISH.NICKNAME.GREEN")
@@ -104,7 +103,7 @@
             notify = confirmation.components["notify"]!.active;
             createAppealTicket = confirmation.components["appeal"]!.active;
         }
-        if (confirmation.modals) newNickname = confirmation.modals![0]!.value
+        if (confirmation.modals) newNickname = confirmation.modals![0]!.value;
     } while (!timedOut && !success);
     if (timedOut || !success) return;
     let dmSent = false;
@@ -121,12 +120,8 @@
                         .setEmoji("PUNISH.NICKNAME.RED")
                         .setTitle("Nickname changed")
                         .setDescription(
-                            `Your nickname was ${
-                                newNickname ? "changed" : "cleared"
-                            } in ${interaction.guild!.name}.` +
-                                (newNickname
-                                    ? `\nIt is now: ${newNickname}`
-                                    : "") +
+                            `Your nickname was ${newNickname ? "changed" : "cleared"} in ${interaction.guild!.name}.` +
+                                (newNickname ? `\nIt is now: ${newNickname}` : "") +
                                 "\n\n" +
                                 (createAppealTicket
                                     ? `You can appeal this in the ticket created in <#${
@@ -145,12 +140,7 @@
                         new ButtonBuilder()
                             .setStyle(ButtonStyle.Link)
                             .setLabel(config.moderation.nick.text)
-                            .setURL(
-                                config.moderation.nick.link.replaceAll(
-                                    "{id}",
-                                    member.id
-                                )
-                            )
+                            .setURL(config.moderation.nick.link.replaceAll("{id}", member.id))
                     )
                 );
             }
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index ff69079..dadab04 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -101,8 +101,7 @@
             let component;
             try {
                 component = m.awaitMessageComponent({
-                    filter: (i) =>
-                        i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id,
+                    filter: (i) => i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id,
                     time: 300000
                 });
             } catch (e) {
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 8408303..232219b 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -1,4 +1,11 @@
-import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle, ButtonInteraction } from "discord.js";
+import Discord, {
+    CommandInteraction,
+    GuildMember,
+    ActionRowBuilder,
+    ButtonBuilder,
+    ButtonStyle,
+    ButtonInteraction
+} from "discord.js";
 import type { SlashCommandSubcommandBuilder } from "discord.js";
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -14,7 +21,10 @@
         .setDescription("Warns a user")
         .addUserOption((option) => option.setName("user").setDescription("The user to warn").setRequired(true));
 
-const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<unknown> => {
+const callback = async (
+    interaction: CommandInteraction | ButtonInteraction,
+    member?: GuildMember
+): Promise<unknown> => {
     if (!interaction.guild) return;
     const { log, NucleusColors, renderUser, entry } = client.logger;
     if (!interaction.isButton()) member = interaction.options.getMember("user") as GuildMember;
@@ -41,8 +51,7 @@
                 "appeal",
                 "Create appeal ticket",
                 !(await areTicketsEnabled(interaction.guild.id)),
-                async () =>
-                    await create(interaction.guild!, member!.user, interaction.user, reason),
+                async () => await create(interaction.guild!, member!.user, interaction.user, reason),
                 "An appeal ticket will be created",
                 null,
                 "CONTROL.TICKET",
@@ -110,12 +119,7 @@
                         new ButtonBuilder()
                             .setStyle(ButtonStyle.Link)
                             .setLabel(config.moderation.warn.text)
-                            .setURL(
-                                config.moderation.warn.link.replaceAll(
-                                    "{id}",
-                                    member.id
-                                )
-                            )
+                            .setURL(config.moderation.warn.link.replaceAll("{id}", member.id))
                     )
                 );
             }
@@ -135,10 +139,7 @@
             timestamp: Date.now()
         },
         list: {
-            user: entry(
-                member.user.id,
-                renderUser(member.user)
-            ),
+            user: entry(member.user.id, renderUser(member.user)),
             warnedBy: entry(interaction.member!.user.id, renderUser(interaction.member!.user as Discord.User)),
             reason: reason ? reason : "*No reason provided*"
         },
@@ -151,13 +152,7 @@
             guild: interaction.guild.id
         }
     };
-    await client.database.history.create(
-        "warn",
-        interaction.guild.id,
-        member.user,
-        interaction.user,
-        reason
-    );
+    await client.database.history.create("warn", interaction.guild.id, member.user, interaction.user, reason);
     log(data);
     const failed = !dmSent && notify;
     if (!failed) {
@@ -179,9 +174,7 @@
             components: []
         });
     } else {
-        const canSeeChannel = member
-            .permissionsIn(interaction.channel as Discord.TextChannel)
-            .has("ViewChannel");
+        const canSeeChannel = member.permissionsIn(interaction.channel as Discord.TextChannel).has("ViewChannel");
         const m = (await interaction.editReply({
             embeds: [
                 new EmojiEmbed()
diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts
index 1eceae2..294ee27 100644
--- a/src/commands/nucleus/stats.ts
+++ b/src/commands/nucleus/stats.ts
@@ -1,4 +1,18 @@
-import { ActionRowBuilder, AttachmentBuilder, ButtonBuilder, ButtonInteraction, ButtonStyle, ChannelType, CommandInteraction, ComponentType, Guild, ModalBuilder, ModalSubmitInteraction, TextInputBuilder, TextInputStyle } from "discord.js";
+import {
+    ActionRowBuilder,
+    AttachmentBuilder,
+    ButtonBuilder,
+    ButtonInteraction,
+    ButtonStyle,
+    ChannelType,
+    CommandInteraction,
+    ComponentType,
+    Guild,
+    ModalBuilder,
+    ModalSubmitInteraction,
+    TextInputBuilder,
+    TextInputStyle
+} from "discord.js";
 import type { SlashCommandSubcommandBuilder } from "discord.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import client from "../../utils/client.js";
@@ -8,7 +22,7 @@
     builder.setName("stats").setDescription("Gets the bot's stats");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
-    const description = `**Servers:** ${client.guilds.cache.size}\n` + `**Ping:** \`${client.ws.ping * 2}ms\``
+    const description = `**Servers:** ${client.guilds.cache.size}\n` + `**Ping:** \`${client.ws.ping * 2}ms\``;
     const m = await interaction.reply({
         embeds: [
             new EmojiEmbed()
@@ -28,30 +42,39 @@
                     .setDescription(description)
                     .setStatus("Success")
                     .setEmoji("SETTINGS.STATS.GREEN")
-            ], components: [new ActionRowBuilder<ButtonBuilder>().addComponents(
-                new ButtonBuilder().setCustomId("admin").setLabel("Admin Panel").setStyle(ButtonStyle.Primary),
-                new ButtonBuilder().setCustomId("mod:nickname:599498449733550102").setLabel("Testing").setStyle(ButtonStyle.Primary)
-            )]
+            ],
+            components: [
+                new ActionRowBuilder<ButtonBuilder>().addComponents(
+                    new ButtonBuilder().setCustomId("admin").setLabel("Admin Panel").setStyle(ButtonStyle.Primary),
+                    new ButtonBuilder()
+                        .setCustomId("mod:nickname:599498449733550102")
+                        .setLabel("Testing")
+                        .setStyle(ButtonStyle.Primary)
+                )
+            ]
         });
 
         const modal = new ModalBuilder()
             .addComponents(
-                new ActionRowBuilder<TextInputBuilder>()
-                    .addComponents(
-                        new TextInputBuilder()
-                            .setStyle(TextInputStyle.Short)
-                            .setLabel("Guild ID")
-                            .setCustomId("guildID")
-                            .setPlaceholder("Guild ID")
-                            .setMinLength(16)
-                            .setMaxLength(25)
-                    )
+                new ActionRowBuilder<TextInputBuilder>().addComponents(
+                    new TextInputBuilder()
+                        .setStyle(TextInputStyle.Short)
+                        .setLabel("Guild ID")
+                        .setCustomId("guildID")
+                        .setPlaceholder("Guild ID")
+                        .setMinLength(16)
+                        .setMaxLength(25)
+                )
             )
             .setTitle("Admin Panel")
-            .setCustomId("adminPanel")
+            .setCustomId("adminPanel");
         let i1: ButtonInteraction;
-        const channel = await client.channels.fetch(interaction.channelId)
-        if(!channel || [ChannelType.GuildCategory, ChannelType.GroupDM, ChannelType.GuildStageVoice].includes(channel.type)) return;
+        const channel = await client.channels.fetch(interaction.channelId);
+        if (
+            !channel ||
+            [ChannelType.GuildCategory, ChannelType.GroupDM, ChannelType.GuildStageVoice].includes(channel.type)
+        )
+            return;
         // console.log(interaction)
         if (!("awaitMessageComponent" in channel)) return;
         try {
@@ -59,27 +82,28 @@
                 filter: (i) => i.customId === "admin" && i.user.id === interaction.user.id,
                 time: 300000
             });
-        } catch (e) { console.log(e); return }
-        await i1.showModal(modal)
+        } catch (e) {
+            console.log(e);
+            return;
+        }
+        await i1.showModal(modal);
         let out: ModalSubmitInteraction;
         try {
             out = await i1.awaitModalSubmit({
                 filter: (i) => i.customId === "adminPanel" && i.user.id === interaction.user.id,
                 time: 300000
-            })
-        } catch { return }
+            });
+        } catch {
+            return;
+        }
         out.deferUpdate();
         const GuildID = out.fields.getTextInputValue("guildID");
         if (!client.guilds.cache.has(GuildID)) {
             await interaction.editReply({
-                embeds: [
-                    new EmojiEmbed()
-                        .setTitle("Admin")
-                        .setDescription("Not in server")
-                        .setStatus("Danger")
-                ], components: []
+                embeds: [new EmojiEmbed().setTitle("Admin").setDescription("Not in server").setStatus("Danger")],
+                components: []
             });
-        };
+        }
 
         await interaction.editReply({
             embeds: [],
@@ -91,24 +115,23 @@
                     new ButtonBuilder().setCustomId("purge").setLabel("Delete data").setStyle(ButtonStyle.Danger),
                     new ButtonBuilder().setCustomId("cache").setLabel("Reset cache").setStyle(ButtonStyle.Success)
                 )
-        ]});
+            ]
+        });
         let i;
         try {
             i = await m.awaitMessageComponent<ComponentType.Button>({
                 filter: (i) => i.user.id === interaction.user.id,
                 time: 300000
-            })
-        } catch { return }
+            });
+        } catch {
+            return;
+        }
         i.deferUpdate();
-        const guild = await client.guilds.fetch(GuildID) as Guild | null;
+        const guild = (await client.guilds.fetch(GuildID)) as Guild | null;
         if (!guild) {
             await interaction.editReply({
-                embeds: [
-                    new EmojiEmbed()
-                        .setTitle("Admin")
-                        .setDescription("Not in server")
-                        .setStatus("Danger")
-                ], components: []
+                embeds: [new EmojiEmbed().setTitle("Admin").setDescription("Not in server").setStatus("Danger")],
+                components: []
             });
             return;
         }
@@ -119,17 +142,17 @@
                         .setTitle("Stats")
                         .setDescription(
                             `**Name:** ${guild.name}\n` +
-                            `**ID:** \`${guild.id}\`\n` +
-                            `**Owner:** ${client.users.cache.get(guild.ownerId)!.tag}\n` +
-                            `**Member Count:** ${guild.memberCount}\n` +
-                            `**Created:** <t:${guild.createdTimestamp}:F>\n` +
-                            `**Added Nucleus:** <t:${guild.members.me!.joinedTimestamp}:R>\n` +
-                            `**Nucleus' Perms:** https://discordapi.com/permissions.html#${guild.members.me!.permissions.valueOf()}\n`
+                                `**ID:** \`${guild.id}\`\n` +
+                                `**Owner:** ${client.users.cache.get(guild.ownerId)!.tag}\n` +
+                                `**Member Count:** ${guild.memberCount}\n` +
+                                `**Created:** <t:${guild.createdTimestamp}:F>\n` +
+                                `**Added Nucleus:** <t:${guild.members.me!.joinedTimestamp}:R>\n` +
+                                `**Nucleus' Perms:** https://discordapi.com/permissions.html#${guild.members.me!.permissions.valueOf()}\n`
                         )
                         .setStatus("Success")
                         .setEmoji("SETTINGS.STATS.GREEN")
                 ]
-            })
+            });
         } else if (i.customId === "leave") {
             await guild.leave();
             await interaction.editReply({
@@ -139,8 +162,9 @@
                         .setDescription(`Left ${guild.name}`)
                         .setStatus("Success")
                         .setEmoji("SETTINGS.STATS.GREEN")
-                ], components: []
-            })
+                ],
+                components: []
+            });
         } else if (i.customId === "data") {
             // Get all the data and convert to a string
             const data = await client.database.guilds.read(guild.id);
@@ -150,9 +174,10 @@
             await interaction.editReply({
                 embeds: [
                     new EmojiEmbed().setTitle("Data").setDescription(`Data for ${guild.name}`).setStatus("Success")
-                ], components: [],
+                ],
+                components: [],
                 files: [attachment]
-            })
+            });
         } else if (i.customId === "purge") {
             await client.database.guilds.delete(GuildID);
             await client.database.history.delete(GuildID);
@@ -165,8 +190,9 @@
                         .setDescription(`Deleted data for ${guild.name}`)
                         .setStatus("Success")
                         .setEmoji("SETTINGS.STATS.GREEN")
-                ], components: []
-            })
+                ],
+                components: []
+            });
         } else if (i.customId === "cache") {
             await client.memory.forceUpdate(guild.id);
             await interaction.editReply({
@@ -176,8 +202,9 @@
                         .setDescription(`Reset cache for ${guild.name}`)
                         .setStatus("Success")
                         .setEmoji("SETTINGS.STATS.GREEN")
-                ], components: []
-            })
+                ],
+                components: []
+            });
         }
     }
 };
diff --git a/src/commands/settings/rolemenu.ts b/src/commands/settings/rolemenu.ts
index 0c174f5..e683e4f 100644
--- a/src/commands/settings/rolemenu.ts
+++ b/src/commands/settings/rolemenu.ts
@@ -176,7 +176,7 @@
     m: Message,
     data?: ObjectSchema
 ): Promise<ObjectSchema | null> => {
-    if (!data) data = _.cloneDeep(defaultRoleMenuData)
+    if (!data) data = _.cloneDeep(defaultRoleMenuData);
     const buttons = new ActionRowBuilder<ButtonBuilder>().addComponents(
         new ButtonBuilder()
             .setCustomId("back")
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index 41a22c1..34a52b8 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -2,6 +2,7 @@
 import type { NucleusClient } from "../utils/client.js";
 import type { LoggerOptions } from "../utils/log.js";
 import { generalException } from "../utils/createTemporaryStorage.js";
+import { doMemberChecks } from "../reflex/scanners.js";
 
 export const event = "guildMemberUpdate";
 
@@ -92,6 +93,7 @@
     if (!auditLog) return;
     if (auditLog.executor!.id === client.user!.id) return;
     if (before.nickname !== after.nickname) {
+        doMemberChecks(after, after.guild);
         await client.database.history.create(
             "nickname",
             after.guild.id,
diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts
index 4a8d941..3b0cd62 100644
--- a/src/events/interactionCreate.ts
+++ b/src/events/interactionCreate.ts
@@ -19,10 +19,7 @@
 
 async function errorMessage(interaction: ButtonInteraction, message: string) {
     await interaction.reply({
-        embeds: [new EmojiEmbed()
-            .setDescription(message)
-            .setStatus("Danger")
-        ],
+        embeds: [new EmojiEmbed().setDescription(message).setStatus("Danger")],
         ephemeral: true,
         components: []
     });
@@ -60,23 +57,27 @@
             const member = await interaction.guild?.members.fetch(memberId!);
             switch (action) {
                 case "kick": {
-                    const check = await kickCheck(interaction, false, member)
+                    const check = await kickCheck(interaction, false, member);
                     if (check !== true) return await errorMessage(interaction, check!);
                     return await kickCallback(interaction, member);
-                } case "ban": {
-                    const check = await banCheck(interaction, false, member)
+                }
+                case "ban": {
+                    const check = await banCheck(interaction, false, member);
                     if (check !== true) return await errorMessage(interaction, check!);
                     return await banCallback(interaction, member);
-                } case "mute": {
-                    const check = await muteCheck(interaction, false, member)
+                }
+                case "mute": {
+                    const check = await muteCheck(interaction, false, member);
                     if (check !== true) return await errorMessage(interaction, check!);
                     return await muteCallback(interaction, member);
-                } case "nickname": {
-                    const check = await nicknameCheck(interaction, false, member)
+                }
+                case "nickname": {
+                    const check = await nicknameCheck(interaction, false, member);
                     if (check !== true) return await errorMessage(interaction, check || "Something went wrong");
                     return await nicknameCallback(interaction, member);
-                } case "warn": {
-                    const check = await warnCheck(interaction, false, member)
+                }
+                case "warn": {
+                    const check = await warnCheck(interaction, false, member);
                     if (check !== true) return await errorMessage(interaction, check!);
                     return await warnCallback(interaction, member);
                 }
diff --git a/src/events/memberJoin.ts b/src/events/memberJoin.ts
index 191ba6b..66abe28 100644
--- a/src/events/memberJoin.ts
+++ b/src/events/memberJoin.ts
@@ -9,7 +9,7 @@
 export async function callback(client: NucleusClient, member: GuildMember) {
     welcome(member);
     statsChannelAdd(member.user, member.guild);
-    doMemberChecks(member, member.guild)
+    doMemberChecks(member, member.guild);
     const { log, isLogging, NucleusColors, entry, renderUser, renderDelta } = client.logger;
     if (!(await isLogging(member.guild.id, "guildMemberUpdate"))) return;
     await client.database.history.create("join", member.guild.id, member.user, null, null);
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index f00e82c..192be25 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -5,9 +5,9 @@
 import type Discord from "discord.js";
 import client from "../utils/client.js";
 import { createHash } from "crypto";
-import * as nsfwjs from 'nsfwjs';
-import * as clamscan from 'clamscan'
-import * as tf from "@tensorflow/tfjs-node";
+// import * as nsfwjs from "nsfwjs";
+// import * as clamscan from "clamscan";
+// import * as tf from "@tensorflow/tfjs-node";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../utils/getEmojiByName.js";
 import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
@@ -21,10 +21,10 @@
     errored?: boolean;
 }
 
-const model = await nsfwjs.load();
+// const model = await nsfwjs.load();
 
 export async function testNSFW(link: string): Promise<NSFWSchema> {
-    const [fileName, hash] = await saveAttachment(link);
+    const [_fileName, hash] = await saveAttachment(link);
     const alreadyHaveCheck = await client.database.scanCache.read(hash);
     if (alreadyHaveCheck) return { nsfw: alreadyHaveCheck.data };
 
@@ -167,7 +167,12 @@
     }
 }
 
-export function TestString(string: string, soft: string[], strict: string[], enabled?: boolean): {word: string, type: string} | null {
+export function TestString(
+    string: string,
+    soft: string[],
+    strict: string[],
+    enabled?: boolean
+): { word: string; type: string } | null {
     if (!enabled) return null;
     for (const word of strict) {
         if (string.toLowerCase().includes(word)) {
@@ -197,34 +202,56 @@
     if (member.user.bot) return;
     const guildData = await client.database.guilds.read(guild.id);
     if (!guildData.logging.staff.channel) return;
-    const [ loose, strict ] = [guildData.filters.wordFilter.words.loose, guildData.filters.wordFilter.words.strict];
+    const [loose, strict] = [guildData.filters.wordFilter.words.loose, guildData.filters.wordFilter.words.strict];
     // Does the username contain filtered words
     const usernameCheck = TestString(member.user.username, loose, strict, guildData.filters.wordFilter.enabled);
     // Does the nickname contain filtered words
     const nicknameCheck = TestString(member.nickname ?? "", loose, strict, guildData.filters.wordFilter.enabled);
     // Does the profile picture contain filtered words
-    const avatarTextCheck = TestString(await TestImage(member.user.displayAvatarURL({ forceStatic: true })) ?? "", loose, strict, guildData.filters.wordFilter.enabled);
+    const avatarTextCheck = TestString(
+        (await TestImage(member.user.displayAvatarURL({ forceStatic: true }))) ?? "",
+        loose,
+        strict,
+        guildData.filters.wordFilter.enabled
+    );
     // Is the profile picture NSFW
-    const avatarCheck = guildData.filters.images.NSFW && await NSFWCheck(member.user.displayAvatarURL({ forceStatic: true }));
+    const avatarCheck =
+        guildData.filters.images.NSFW && (await NSFWCheck(member.user.displayAvatarURL({ forceStatic: true })));
     // Does the username contain an invite
-    const inviteCheck = guildData.filters.invite.enabled && member.user.username.match(/discord\.gg\/[a-zA-Z0-9]+/gi) !== null;
+    const inviteCheck =
+        guildData.filters.invite.enabled && member.user.username.match(/discord\.gg\/[a-zA-Z0-9]+/gi) !== null;
     // Does the nickname contain an invite
-    const nicknameInviteCheck = guildData.filters.invite.enabled && member.nickname?.match(/discord\.gg\/[a-zA-Z0-9]+/gi) !== null;
+    const nicknameInviteCheck =
+        guildData.filters.invite.enabled && member.nickname?.match(/discord\.gg\/[a-zA-Z0-9]+/gi) !== null;
 
-    if (usernameCheck !== null || nicknameCheck !== null || avatarCheck || inviteCheck || nicknameInviteCheck || avatarTextCheck !== null) {
+    if (
+        usernameCheck !== null ||
+        nicknameCheck !== null ||
+        avatarCheck ||
+        inviteCheck ||
+        nicknameInviteCheck ||
+        avatarTextCheck !== null
+    ) {
         const infractions = [];
         if (usernameCheck !== null) {
             infractions.push(`Username contains a ${usernameCheck.type}ly filtered word (${usernameCheck.word})`);
-        } if (nicknameCheck !== null) {
+        }
+        if (nicknameCheck !== null) {
             infractions.push(`Nickname contains a ${nicknameCheck.type}ly filtered word (${nicknameCheck.word})`);
-        } if (avatarCheck) {
+        }
+        if (avatarCheck) {
             infractions.push("Profile picture is NSFW");
-        } if (inviteCheck) {
+        }
+        if (inviteCheck) {
             infractions.push("Username contains an invite");
-        } if (nicknameInviteCheck) {
+        }
+        if (nicknameInviteCheck) {
             infractions.push("Nickname contains an invite");
-        } if (avatarTextCheck !== null) {
-            infractions.push(`Profile picture contains a ${avatarTextCheck.type}ly filtered word: ${avatarTextCheck.word}`);
+        }
+        if (avatarTextCheck !== null) {
+            infractions.push(
+                `Profile picture contains a ${avatarTextCheck.type}ly filtered word: ${avatarTextCheck.word}`
+            );
         }
         if (infractions.length === 0) return;
         // This is bad - Warn in the staff notifications channel
@@ -234,34 +261,43 @@
             .setTitle("Member Flagged")
             .setEmoji("ICONS.FLAGS.RED")
             .setStatus("Danger")
-            .setDescription(`**Member:** ${member.user.username} (<@${member.user.id}>)\n\n` +
-                infractions.map((element) => `${filter} ${element}`).join("\n")
-            )
+            .setDescription(
+                `**Member:** ${member.user.username} (<@${member.user.id}>)\n\n` +
+                    infractions.map((element) => `${filter} ${element}`).join("\n")
+            );
         await channel.send({
             embeds: [embed],
-            components: [new ActionRowBuilder<ButtonBuilder>().addComponents(...[
-                new ButtonBuilder()
-                    .setCustomId(`mod:warn:${member.user.id}`)
-                    .setLabel("Warn")
-                    .setStyle(ButtonStyle.Primary),
-                new ButtonBuilder()
-                    .setCustomId(`mod:mute:${member.user.id}`)
-                    .setLabel("Mute")
-                    .setStyle(ButtonStyle.Primary),
-                new ButtonBuilder()
-                    .setCustomId(`mod:kick:${member.user.id}`)
-                    .setLabel("Kick")
-                    .setStyle(ButtonStyle.Danger),
-                new ButtonBuilder()
-                    .setCustomId(`mod:ban:${member.user.id}`)
-                    .setLabel("Ban")
-                    .setStyle(ButtonStyle.Danger),
-            ].concat((usernameCheck !== null || nicknameCheck !== null || avatarTextCheck !== null) ? [
-                new ButtonBuilder()
-                    .setCustomId(`mod:nickname:${member.user.id}`)
-                    .setLabel("Change Name")
-                    .setStyle(ButtonStyle.Primary)
-            ] : []))]
+            components: [
+                new ActionRowBuilder<ButtonBuilder>().addComponents(
+                    ...[
+                        new ButtonBuilder()
+                            .setCustomId(`mod:warn:${member.user.id}`)
+                            .setLabel("Warn")
+                            .setStyle(ButtonStyle.Primary),
+                        new ButtonBuilder()
+                            .setCustomId(`mod:mute:${member.user.id}`)
+                            .setLabel("Mute")
+                            .setStyle(ButtonStyle.Primary),
+                        new ButtonBuilder()
+                            .setCustomId(`mod:kick:${member.user.id}`)
+                            .setLabel("Kick")
+                            .setStyle(ButtonStyle.Danger),
+                        new ButtonBuilder()
+                            .setCustomId(`mod:ban:${member.user.id}`)
+                            .setLabel("Ban")
+                            .setStyle(ButtonStyle.Danger)
+                    ].concat(
+                        usernameCheck !== null || nicknameCheck !== null || avatarTextCheck !== null
+                            ? [
+                                  new ButtonBuilder()
+                                      .setCustomId(`mod:nickname:${member.user.id}`)
+                                      .setLabel("Change Name")
+                                      .setStyle(ButtonStyle.Primary)
+                              ]
+                            : []
+                    )
+                )
+            ]
         });
     }
-}
\ No newline at end of file
+}
diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index 5bfbfdb..7b3bd31 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -37,7 +37,13 @@
     inverted = false;
     reason: string | null = null;
 
-    modals: {buttonText: string, emoji: string, customId: string, modal: Discord.ModalBuilder, value: string | undefined}[] = [];
+    modals: {
+        buttonText: string;
+        emoji: string;
+        customId: string;
+        modal: Discord.ModalBuilder;
+        value: string | undefined;
+    }[] = [];
 
     constructor(interaction: CommandInteraction | ButtonInteraction) {
         this.interaction = interaction;
@@ -102,7 +108,7 @@
     }
     addModal(buttonText: string, emoji: string, customId: string, current: string, modal: Discord.ModalBuilder) {
         modal.setCustomId(customId);
-        this.modals.push({buttonText, emoji, customId, modal, value: current});
+        this.modals.push({ buttonText, emoji, customId, modal, value: current });
         return this;
     }
     async send(editOnly?: boolean): Promise<{
@@ -110,7 +116,13 @@
         cancelled?: boolean;
         components?: Record<string, CustomBoolean<unknown>>;
         newReason?: string;
-        modals?: {buttonText: string, emoji: string, customId: string, modal: Discord.ModalBuilder, value: string | undefined}[];
+        modals?: {
+            buttonText: string;
+            emoji: string;
+            customId: string;
+            modal: Discord.ModalBuilder;
+            value: string | undefined;
+        }[];
     }> {
         let cancelled = false;
         let success: boolean | undefined = undefined;
@@ -212,7 +224,7 @@
                     time: 300000
                 });
             } catch (e) {
-                success = false
+                success = false;
                 break;
             }
             if (component.customId === "yes") {
@@ -291,7 +303,12 @@
                     continue;
                 }
             } else if (this.modals.map((m) => m.customId).includes(component.customId)) {
-                const chosenModal = this.modals.find((component => m => m.customId === component.customId)(component));
+                const chosenModal = this.modals.find(
+                    (
+                        (component) => (m) =>
+                            m.customId === component.customId
+                    )(component)
+                );
                 await component.showModal(chosenModal!.modal);
                 await this.interaction.editReply({
                     embeds: [
@@ -364,7 +381,12 @@
         const modals = this.modals;
         const typedReturnValue = returnValue as
             | { cancelled: true }
-            | { success: boolean; components: Record<string, CustomBoolean<unknown>>; modals: typeof modals; newReason?: string }
+            | {
+                  success: boolean;
+                  components: Record<string, CustomBoolean<unknown>>;
+                  modals: typeof modals;
+                  newReason?: string;
+              }
             | { newReason: string; components: Record<string, CustomBoolean<unknown>>; modals: typeof modals }
             | { components: Record<string, CustomBoolean<unknown>>; modals: typeof modals };
 
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 62aee7c..19aa00b 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -836,9 +836,7 @@
     }
 }
 
-export class Plugins {
-    
-}
+// export class Plugins {}
 
 export interface GuildConfig {
     id: string;
