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")
