diff --git a/.editorconfig b/.editorconfig
index 9141329..a3284ca 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -6,3 +6,4 @@
 charset = utf-8
 indent_style = space
 indent_size = 4
+max_line_length = 120
diff --git a/.eslintrc.json b/.eslintrc.json
index 5eed00e..59c8e80 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -5,11 +5,7 @@
         "node": true
     },
     "ignorePatterns": ["dist/"],
-    "extends": [
-        "eslint:recommended",
-        "plugin:@typescript-eslint/strict",
-        "prettier"
-    ],
+    "extends": ["eslint:recommended", "plugin:@typescript-eslint/strict", "prettier"],
     "parser": "@typescript-eslint/parser",
     "parserOptions": {
         "ecmaVersion": "latest",
diff --git a/ClicksMigratingProblems/index.js b/ClicksMigratingProblems/index.js
index a9132f8..e5b302c 100644
--- a/ClicksMigratingProblems/index.js
+++ b/ClicksMigratingProblems/index.js
@@ -48,11 +48,7 @@
             },
             invite: {
                 enabled: data.invite ? data.invite.enabled : false,
-                channels: data.invite
-                    ? data.invite.whitelist.channels.map((channel) =>
-                          channel.toString()
-                      )
-                    : []
+                channels: data.invite ? data.invite.whitelist.channels.map((channel) => channel.toString()) : []
             },
             pings: {
                 mass: 5,
@@ -66,11 +62,7 @@
                 message: null,
                 role: null
             },
-            role: data.welcome
-                ? data.welcome.role !== null
-                    ? data.welcome.role.toString()
-                    : null
-                : null,
+            role: data.welcome ? (data.welcome.role !== null ? data.welcome.role.toString() : null) : null,
             channel: data.welcome
                 ? data.welcome.message.text !== null
                     ? data.welcome.message.channel.toString()
@@ -82,15 +74,11 @@
         logging: {
             logs: {
                 enabled: true,
-                channel: data.log_info.log_channel
-                    ? data.log_info.log_channel.toString()
-                    : null,
+                channel: data.log_info.log_channel ? data.log_info.log_channel.toString() : null,
                 toLog: "3fffff"
             },
             staff: {
-                channel: data.log_info.staff
-                    ? data.log_info.staff.toString()
-                    : null
+                channel: data.log_info.staff ? data.log_info.staff.toString() : null
             }
         },
         verify: {
@@ -99,18 +87,10 @@
         },
         tickets: {
             enabled: data.modmail ? data.modmail.cat !== null : null,
-            category: data.modmail
-                ? data.modmail.cat !== null
-                    ? data.modmail.cat.toString()
-                    : null
-                : null,
+            category: data.modmail ? (data.modmail.cat !== null ? data.modmail.cat.toString() : null) : null,
             types: "3f",
             customTypes: null,
-            supportRole: data.modmail
-                ? data.modmail.mention !== null
-                    ? data.modmail.mention.toString()
-                    : null
-                : null,
+            supportRole: data.modmail ? (data.modmail.mention !== null ? data.modmail.mention.toString() : null) : null,
             maxTickets: data.modmail ? data.modmail.max : 5
         },
         moderation: {
@@ -145,11 +125,7 @@
         tags: data.tags
     };
     // Insert the new data into the database
-    await collection.updateOne(
-        { id: data.guild_info.id.toString() },
-        { $set: newData },
-        { upsert: true }
-    );
+    await collection.updateOne({ id: data.guild_info.id.toString() }, { $set: newData }, { upsert: true });
     // Delete the old file
     fs.unlinkSync(`./oldData/${file}`);
     console.log(`└ Successfully migrated file ${file}`);
diff --git a/ClicksMigratingProblems/randomPunishments.js b/ClicksMigratingProblems/randomPunishments.js
index 4ea01d2..af9c908 100644
--- a/ClicksMigratingProblems/randomPunishments.js
+++ b/ClicksMigratingProblems/randomPunishments.js
@@ -7,50 +7,21 @@
 
 for (let i = 0; i < 100; i++) {
     // Select a type
-    let type = [
-        "join",
-        "unban",
-        "leave",
-        "ban",
-        "softban",
-        "kick",
-        "mute",
-        "purge",
-        "warn",
-        "nickname"
-    ][Math.floor(Math.random() * 9)];
+    let type = ["join", "unban", "leave", "ban", "softban", "kick", "mute", "purge", "warn", "nickname"][
+        Math.floor(Math.random() * 9)
+    ];
     // Select a random date in the last year
-    let date = new Date(
-        new Date().getTime() - Math.floor(Math.random() * 31536000000)
-    );
+    let date = new Date(new Date().getTime() - Math.floor(Math.random() * 31536000000));
     // Add to database
     await collection.insertOne({
         type: type,
         occurredAt: date,
         user: "438733159748599813",
         guild: "864185037078790195",
-        moderator: [
-            "unban",
-            "ban",
-            "softban",
-            "kick",
-            "mute",
-            "purge",
-            "warn"
-        ].includes(type)
+        moderator: ["unban", "ban", "softban", "kick", "mute", "purge", "warn"].includes(type)
             ? "438733159748599813"
             : null,
-        reason: [
-            "unban",
-            "ban",
-            "softban",
-            "kick",
-            "mute",
-            "purge",
-            "warn"
-        ].includes(type)
-            ? "Test"
-            : null,
+        reason: ["unban", "ban", "softban", "kick", "mute", "purge", "warn"].includes(type) ? "Test" : null,
         before: type === "nickname" ? "TestBefore" : null,
         after: type === "nickname" ? "TestAfter" : null,
         amount: type === "purge" ? Math.floor(Math.random() * 100) : null
diff --git a/Installer.js b/Installer.js
index 0a93596..6ce907a 100644
--- a/Installer.js
+++ b/Installer.js
@@ -1,9 +1,12 @@
 let format;
 try {
-    format = await import("./dist/config/format.js");
+    format = (await import("./dist/config/format.js")).default;
 } catch (e) {
     console.log("Please run `yarn` and `yarn build` first.");
+    process.exit(1);
 }
 
 await format(true);
 process.exit(0);
+
+export {};
diff --git a/package.json b/package.json
index 7a0052d..09e29b7 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,8 @@
         "force-dev": "rm -rf dist && eslint . --fix; tsc-suppress && node --experimental-json-modules --enable-source-maps dist/index.js",
         "lint": "echo 'Style checking...'; prettier --check .; echo 'Linting...'; eslint .; echo 'To auto-fix everything possible, please run `yarn lint-fix`'; true",
         "lint-fix": "echo 'Fixing eslint issues...'; eslint . --fix; echo 'Reformatting...'; prettier --write --loglevel warn --cache .; true",
-        "lint-list": "echo 'Style checking...'; prettier --check .; echo 'Linting...'; eslint .; echo 'To view errors in more detail, please run `yarn lint`; true"
+        "lint-list": "echo 'Style checking...'; prettier --check .; echo 'Linting...'; eslint .; echo 'To view errors in more detail, please run `yarn lint`; true",
+        "setup": "node Installer.js"
     },
     "repository": {
         "type": "git",
diff --git a/src/Unfinished/all.ts b/src/Unfinished/all.ts
index 453a467..1c6ce20 100644
--- a/src/Unfinished/all.ts
+++ b/src/Unfinished/all.ts
@@ -23,11 +23,7 @@
     data: object;
     checkFunction: (member) => boolean;
     inverted = false;
-    constructor(
-        name: (data) => string | string,
-        data: object,
-        check: (member) => boolean
-    ) {
+    constructor(name: (data) => string | string, data: object, check: (member) => boolean) {
         if (typeof name === "function") {
             this.name = name(data);
         } else {
@@ -64,10 +60,7 @@
             render: "joined",
             before: (date) =>
                 new Filter(
-                    (_data) =>
-                        `Joined server before <t:${Math.round(
-                            date.getTime() / 1000
-                        )}:D>`,
+                    (_data) => `Joined server before <t:${Math.round(date.getTime() / 1000)}:D>`,
                     { date: date, type: Date, render: "before" },
                     (member) => {
                         return member.joinedTimestamp < date.getTime();
@@ -116,10 +109,7 @@
             render: "created",
             before: (date) =>
                 new Filter(
-                    (_data) =>
-                        `Account created before <t:${Math.round(
-                            date.getTime() / 1000
-                        )}:D>`,
+                    (_data) => `Account created before <t:${Math.round(date.getTime() / 1000)}:D>`,
                     { date: date, type: Date, render: "before" },
                     (member) => {
                         return member.user.createdTimestamp < date.getTime();
@@ -167,9 +157,7 @@
     }
 };
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     await interaction.reply({
         embeds: LoadingEmbed,
         ephemeral: true,
@@ -215,29 +203,20 @@
                 new EmojiEmbed()
                     .setTitle("Role all")
                     .setDescription(
-                        (all
-                            ? "All of the following must be true:"
-                            : "Any of the following must be true") +
+                        (all ? "All of the following must be true:" : "Any of the following must be true") +
                             "\n" +
                             filters
                                 .map((f) => {
                                     count++;
                                     return (
-                                        (count === 1
-                                            ? getEmojiByName("ICONS.FILTER")
-                                            : all
-                                            ? "**and** "
-                                            : "**or** ") +
+                                        (count === 1 ? getEmojiByName("ICONS.FILTER") : all ? "**and** " : "**or** ") +
                                         (f.inverted ? "**not** " : "") +
                                         `${f.name}`
                                     );
                                 })
                                 .join("\n") +
                             "\n\n" +
-                            `This will affect ${addPlural(
-                                affected.length,
-                                "member"
-                            )}`
+                            `This will affect ${addPlural(affected.length, "member")}`
                     )
                     .setEmoji("GUILD.ROLES.CREATE")
                     .setStatus("Success")
@@ -261,21 +240,13 @@
                         .setLabel("Apply")
                         .setStyle("PRIMARY")
                         .setCustomId("apply")
-                        .setEmoji(
-                            client.emojis.cache.get(
-                                getEmojiByName("CONTROL.TICK", "id")
-                            )
-                        )
+                        .setEmoji(client.emojis.cache.get(getEmojiByName("CONTROL.TICK", "id")))
                         .setDisabled(affected.length === 0),
                     new MessageButton()
                         .setLabel("Add filter")
                         .setStyle("PRIMARY")
                         .setCustomId("add")
-                        .setEmoji(
-                            client.emojis.cache.get(
-                                getEmojiByName("ICONS.FILTER", "id")
-                            )
-                        )
+                        .setEmoji(client.emojis.cache.get(getEmojiByName("ICONS.FILTER", "id")))
                         .setDisabled(filters.length >= 25)
                 ])
             ]
@@ -285,19 +256,14 @@
     return;
 };
 
-const check = async (
-    interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = async (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     const member = interaction.member as GuildMember;
     const me = interaction.guild.me!;
-    if (!me.permissions.has("MANAGE_ROLES"))
-        throw "I do not have the *Manage Roles* permission";
+    if (!me.permissions.has("MANAGE_ROLES")) throw "I do not have the *Manage Roles* permission";
     // Allow the owner to role anyone
     if (member.id === interaction.guild.ownerId) return true;
     // Check if the user has manage_roles permission
-    if (!member.permissions.has("MANAGE_ROLES"))
-        throw "You do not have the *Manage Roles* permission";
+    if (!member.permissions.has("MANAGE_ROLES")) throw "You do not have the *Manage Roles* permission";
     // Allow role
     return true;
 };
diff --git a/src/Unfinished/categorisationTest.ts b/src/Unfinished/categorisationTest.ts
index 8c25eb2..2da2be3 100644
--- a/src/Unfinished/categorisationTest.ts
+++ b/src/Unfinished/categorisationTest.ts
@@ -1,11 +1,5 @@
 import { LoadingEmbed } from "../utils/defaultEmbeds.js";
-import {
-    CommandInteraction,
-    GuildChannel,
-    MessageActionRow,
-    MessageButton,
-    MessageSelectMenu
-} from "discord.js";
+import { CommandInteraction, GuildChannel, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
 import { SlashCommandBuilder } from "@discordjs/builders";
 // @ts-expect-error
 import type { WrappedCheck } from "jshaiku";
@@ -14,14 +8,10 @@
 import addPlural from "../utils/plurals.js";
 import getEmojiByName from "../utils/getEmojiByName.js";
 
-const command = new SlashCommandBuilder()
-    .setName("categorise")
-    .setDescription("Categorises your servers channels");
+const command = new SlashCommandBuilder().setName("categorise").setDescription("Categorises your servers channels");
 
 const callback = async (interaction: CommandInteraction): Promise<unknown> => {
-    const channels = interaction.guild.channels.cache.filter(
-        (c) => c.type !== "GUILD_CATEGORY"
-    );
+    const channels = interaction.guild.channels.cache.filter((c) => c.type !== "GUILD_CATEGORY");
     const categorised = {};
     await interaction.reply({ embeds: LoadingEmbed, ephemeral: true });
     const predicted = {};
@@ -50,10 +40,7 @@
     for (const c of channels) {
         // convert channel to a channel if its a string
         let channel: string | GuildChannel;
-        if (typeof c === "string")
-            channel = interaction.guild.channels.cache.get(
-                channel as string
-            ).id;
+        if (typeof c === "string") channel = interaction.guild.channels.cache.get(channel as string).id;
         else channel = (c[0] as unknown as GuildChannel).id;
         console.log(channel);
         if (!predicted[channel]) predicted[channel] = [];
@@ -63,10 +50,7 @@
                     .setTitle("Categorise")
                     .setDescription(
                         `Select all types that apply to <#${channel}>.\n\n` +
-                            `${addPlural(
-                                predicted[channel].length,
-                                "Suggestion"
-                            )}: ${predicted[channel].join(", ")}`
+                            `${addPlural(predicted[channel].length, "Suggestion")}: ${predicted[channel].join(", ")}`
                     )
                     .setEmoji("CHANNEL.CATEGORY.CREATE")
                     .setStatus("Success")
@@ -77,9 +61,7 @@
                         .setCustomId("selected")
                         .setMaxValues(Object.keys(types).length)
                         .setMinValues(1)
-                        .setPlaceholder(
-                            "Select all types that apply to this channel"
-                        )
+                        .setPlaceholder("Select all types that apply to this channel")
                         .setOptions(
                             Object.keys(types).map((type) => ({
                                 label: type,
@@ -93,20 +75,12 @@
                         .setCustomId("accept")
                         .setStyle("SUCCESS")
                         .setDisabled(predicted[channel].length === 0)
-                        .setEmoji(
-                            client.emojis.cache.get(
-                                getEmojiByName("ICONS.TICK", "id")
-                            )
-                        ),
+                        .setEmoji(client.emojis.cache.get(getEmojiByName("ICONS.TICK", "id"))),
                     new MessageButton()
                         .setLabel('Use "Other"')
                         .setCustomId("reject")
                         .setStyle("SECONDARY")
-                        .setEmoji(
-                            client.emojis.cache.get(
-                                getEmojiByName("ICONS.CROSS", "id")
-                            )
-                        )
+                        .setEmoji(client.emojis.cache.get(getEmojiByName("ICONS.CROSS", "id")))
                 ])
             ]
         });
@@ -122,10 +96,9 @@
                         .setStatus("Danger")
                         .setDescription(
                             `Select all types that apply to <#${channel}>.\n\n` +
-                                `${addPlural(
-                                    predicted[channel].length,
-                                    "Suggestion"
-                                )}: ${predicted[channel].join(", ")}`
+                                `${addPlural(predicted[channel].length, "Suggestion")}: ${predicted[channel].join(
+                                    ", "
+                                )}`
                         )
                         .setFooter({ text: "Message timed out" })
                 ]
@@ -147,10 +120,7 @@
     console.log(categorised);
 };
 
-const check = (
-    _interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     return true;
 };
 
diff --git a/src/actions/createModActionTicket.ts b/src/actions/createModActionTicket.ts
index 41f949c..0eca621 100644
--- a/src/actions/createModActionTicket.ts
+++ b/src/actions/createModActionTicket.ts
@@ -11,24 +11,11 @@
     customReason?: string
 ) {
     const config = await client.database.guilds.read(guild.id);
-    const {
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderChannel,
-        renderDelta
-    } = client.logger;
+    const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger;
     const overwrites = [
         {
             id: member,
-            allow: [
-                "VIEW_CHANNEL",
-                "SEND_MESSAGES",
-                "ATTACH_FILES",
-                "ADD_REACTIONS",
-                "READ_MESSAGE_HISTORY"
-            ],
+            allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
             type: "member"
         }
     ] as Discord.OverwriteResolvable[];
@@ -40,13 +27,7 @@
     if (config.tickets.supportRole !== null) {
         overwrites.push({
             id: guild.roles.cache.get(config.tickets.supportRole),
-            allow: [
-                "VIEW_CHANNEL",
-                "SEND_MESSAGES",
-                "ATTACH_FILES",
-                "ADD_REACTIONS",
-                "READ_MESSAGE_HISTORY"
-            ],
+            allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
             type: "role"
         });
     }
@@ -67,16 +48,10 @@
     try {
         await c.send({
             content:
-                `<@${member.id}>` +
-                (config.tickets.supportRole !== null
-                    ? ` • <@&${config.tickets.supportRole}>`
-                    : ""),
+                `<@${member.id}>` + (config.tickets.supportRole !== null ? ` • <@&${config.tickets.supportRole}>` : ""),
             allowedMentions: {
                 users: [member.id],
-                roles:
-                    config.tickets.supportRole !== null
-                        ? [config.tickets.supportRole]
-                        : []
+                roles: config.tickets.supportRole !== null ? [config.tickets.supportRole] : []
             }
         });
         await c.send({
@@ -85,14 +60,8 @@
                     .setTitle("New Ticket")
                     .setDescription(
                         "Ticket created by a Moderator\n" +
-                            `**Support type:** ${
-                                customReason
-                                    ? customReason
-                                    : "Appeal submission"
-                            }\n` +
-                            (reason !== null
-                                ? `**Reason:**\n> ${reason}\n`
-                                : "") +
+                            `**Support type:** ${customReason ? customReason : "Appeal submission"}\n` +
+                            (reason !== null ? `**Reason:**\n> ${reason}\n` : "") +
                             `**Ticket ID:** \`${c.id}\`\n` +
                             "Type `/ticket close` to close this ticket."
                     )
@@ -121,10 +90,7 @@
             list: {
                 ticketFor: entry(member.id, renderUser(member)),
                 createdBy: entry(createdBy.id, renderUser(createdBy)),
-                created: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                ),
+                created: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                 ticketChannel: entry(c.id, renderChannel(c))
             },
             hidden: {
diff --git a/src/actions/roleMenu.ts b/src/actions/roleMenu.ts
index dc224e8..e7f1874 100644
--- a/src/actions/roleMenu.ts
+++ b/src/actions/roleMenu.ts
@@ -1,11 +1,22 @@
-import { MessageButton } from "discord.js";
+import { Interaction, MessageButton } from "discord.js";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 import { MessageActionRow, MessageSelectMenu } from "discord.js";
 import getEmojiByName from "../utils/getEmojiByName.js";
 import client from "../utils/client.js";
 import { LoadingEmbed } from "../utils/defaultEmbeds.js";
+import type { GuildConfig } from "../utils/database.js";
 
-export async function callback(interaction) {
+export interface RoleMenuSchema {
+    guild: string;
+    guildName: string;
+    guildIcon: string;
+    user: string;
+    username: string;
+    data: GuildConfig["roleMenu"]["options"];
+    interaction: Interaction;
+}
+
+export async function callback(interaction: Interaction) {
     const config = await client.database.guilds.read(interaction.guild.id);
     if (!config.roleMenu.enabled)
         return await interaction.reply({
@@ -25,9 +36,7 @@
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Roles")
-                    .setDescription(
-                        "There are no roles available. Please contact a staff member or try again later."
-                    )
+                    .setDescription("There are no roles available. Please contact a staff member or try again later.")
                     .setStatus("Danger")
                     .setEmoji("CONTROL.BLOCKCROSS")
             ],
@@ -39,8 +48,7 @@
         let code = "";
         let length = 5;
         let itt = 0;
-        const chars =
-            "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+        const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
         let valid = false;
         while (!valid) {
             itt += 1;
@@ -66,14 +74,13 @@
             interaction: interaction
         };
         let up = true;
-        try {
-            const status = await fetch(client.config.baseUrl).then(
-                (res) => res.status
-            );
+        up = false; // FIXME: Role menu does not yet exist, so the web UI is never up
+        /*        try {
+            const status = await fetch(client.config.baseUrl).then((res) => res.status);
             if (status !== 200) up = false;
         } catch {
             up = false;
-        }
+        }*/
         m = await interaction.editReply({
             embeds: [
                 new EmojiEmbed()
@@ -88,13 +95,8 @@
                         .setLabel("Online")
                         .setStyle("LINK")
                         .setDisabled(!up)
-                        .setURL(
-                            `${client.config.baseUrl}nucleus/rolemenu?code=${code}`
-                        ),
-                    new MessageButton()
-                        .setLabel("Manual")
-                        .setStyle("PRIMARY")
-                        .setCustomId("manual")
+                        .setURL(`${client.config.baseUrl}nucleus/rolemenu?code=${code}`),
+                    new MessageButton().setLabel("Manual").setStyle("PRIMARY").setCustomId("manual")
                 ])
             ]
         });
@@ -116,13 +118,9 @@
                     .setEmoji("GUILD.GREEN")
                     .setDescription(
                         `**${object.name}**` +
-                            (object.description
-                                ? `\n${object.description}`
-                                : "") +
+                            (object.description ? `\n${object.description}` : "") +
                             `\n\nSelect ${object.min}` +
-                            (object.min !== object.max
-                                ? ` to ${object.max}`
-                                : "") +
+                            (object.min !== object.max ? ` to ${object.max}` : "") +
                             ` role${object.max === 1 ? "" : "s"} to add.`
                     )
                     .setStatus("Success")
@@ -145,9 +143,7 @@
                                       .setLabel("Skip")
                                       .setStyle("SECONDARY")
                                       .setCustomId("skip")
-                                      .setEmoji(
-                                          getEmojiByName("CONTROL.RIGHT", "id")
-                                      )
+                                      .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
                               ]
                             : []
                     )
@@ -193,13 +189,9 @@
             });
         }
     }
-    let rolesToRemove = config.roleMenu.options
-        .map((o) => o.options.map((o) => o.role))
-        .flat();
+    let rolesToRemove = config.roleMenu.options.map((o) => o.options.map((o) => o.role)).flat();
     const memberRoles = interaction.member.roles.cache.map((r) => r.id);
-    rolesToRemove = rolesToRemove
-        .filter((r) => memberRoles.includes(r))
-        .filter((r) => !rolesToAdd.includes(r));
+    rolesToRemove = rolesToRemove.filter((r) => memberRoles.includes(r)).filter((r) => !rolesToAdd.includes(r));
     rolesToAdd = rolesToAdd.filter((r) => !memberRoles.includes(r));
     try {
         await interaction.member.roles.remove(rolesToRemove);
@@ -222,9 +214,7 @@
         embeds: [
             new EmojiEmbed()
                 .setTitle("Roles")
-                .setDescription(
-                    "Roles have been added. You may close this message."
-                )
+                .setDescription("Roles have been added. You may close this message.")
                 .setStatus("Success")
                 .setEmoji("GUILD.GREEN")
         ],
diff --git a/src/actions/tickets/create.ts b/src/actions/tickets/create.ts
index ca5147a..d6bf822 100644
--- a/src/actions/tickets/create.ts
+++ b/src/actions/tickets/create.ts
@@ -6,20 +6,11 @@
 
 function capitalize(s: string) {
     s = s.replace(/([A-Z])/g, " $1");
-    return s.length < 3
-        ? s.toUpperCase()
-        : s[0].toUpperCase() + s.slice(1).toLowerCase();
+    return s.length < 3 ? s.toUpperCase() : s[0].toUpperCase() + s.slice(1).toLowerCase();
 }
 
 export default async function (interaction) {
-    const {
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderChannel,
-        renderDelta
-    } = client.logger;
+    const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger;
 
     const config = await client.database.guilds.read(interaction.guild.id);
     if (!config.tickets.enabled || !config.tickets.category) {
@@ -27,9 +18,7 @@
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Tickets are disabled")
-                    .setDescription(
-                        "Please enable tickets in the configuration to use this command."
-                    )
+                    .setDescription("Please enable tickets in the configuration to use this command.")
                     .setFooter({
                         text: interaction.member.permissions.has("MANAGE_GUILD")
                             ? "You can enable it by running /settings tickets"
@@ -41,17 +30,11 @@
             ephemeral: true
         });
     }
-    const category = interaction.guild.channels.cache.get(
-        config.tickets.category
-    ) as Discord.CategoryChannel;
+    const category = interaction.guild.channels.cache.get(config.tickets.category) as Discord.CategoryChannel;
     let count = 0;
     category.children.forEach((element) => {
         if (!(element.type === "GUILD_TEXT")) return;
-        if (
-            (element as Discord.TextChannel).topic.includes(
-                `${interaction.member.user.id}`
-            )
-        ) {
+        if ((element as Discord.TextChannel).topic.includes(`${interaction.member.user.id}`)) {
             if ((element as Discord.TextChannel).topic.endsWith("Active")) {
                 count++;
             }
@@ -76,8 +59,7 @@
     if (config.tickets.customTypes && config.tickets.useCustom) {
         ticketTypes = config.tickets.customTypes;
         custom = true;
-    } else if (config.tickets.types)
-        ticketTypes = toHexArray(config.tickets.types, tickets);
+    } else if (config.tickets.types) ticketTypes = toHexArray(config.tickets.types, tickets);
     else ticketTypes = [];
     let chosenType;
     let splitFormattedTicketTypes = [];
@@ -85,29 +67,17 @@
         let formattedTicketTypes = [];
         formattedTicketTypes = ticketTypes.map((type) => {
             if (custom) {
-                return new MessageButton()
-                    .setLabel(type)
-                    .setStyle("PRIMARY")
-                    .setCustomId(type);
+                return new MessageButton().setLabel(type).setStyle("PRIMARY").setCustomId(type);
             } else {
                 return new MessageButton()
                     .setLabel(capitalize(type))
                     .setStyle("PRIMARY")
                     .setCustomId(type)
-                    .setEmoji(
-                        getEmojiByName(
-                            "TICKETS." + type.toString().toUpperCase(),
-                            "id"
-                        )
-                    );
+                    .setEmoji(getEmojiByName("TICKETS." + type.toString().toUpperCase(), "id"));
             }
         });
         for (let i = 0; i < formattedTicketTypes.length; i += 5) {
-            splitFormattedTicketTypes.push(
-                new MessageActionRow().addComponents(
-                    formattedTicketTypes.slice(i, i + 5)
-                )
-            );
+            splitFormattedTicketTypes.push(new MessageActionRow().addComponents(formattedTicketTypes.slice(i, i + 5)));
         }
         const m = await interaction.reply({
             embeds: [
@@ -142,21 +112,12 @@
                     .setLabel(capitalize(type))
                     .setStyle(chosenType === type ? "SUCCESS" : "SECONDARY")
                     .setCustomId(type)
-                    .setEmoji(
-                        getEmojiByName(
-                            "TICKETS." + type.toString().toUpperCase(),
-                            "id"
-                        )
-                    )
+                    .setEmoji(getEmojiByName("TICKETS." + type.toString().toUpperCase(), "id"))
                     .setDisabled(true);
             }
         });
         for (let i = 0; i < formattedTicketTypes.length; i += 5) {
-            splitFormattedTicketTypes.push(
-                new MessageActionRow().addComponents(
-                    formattedTicketTypes.slice(i, i + 5)
-                )
-            );
+            splitFormattedTicketTypes.push(new MessageActionRow().addComponents(formattedTicketTypes.slice(i, i + 5)));
         }
         component.update({
             embeds: [
@@ -171,11 +132,7 @@
     } else {
         chosenType = null;
         await interaction.reply({
-            embeds: [
-                new EmojiEmbed()
-                    .setTitle("Create Ticket")
-                    .setEmoji("GUILD.TICKET.OPEN")
-            ],
+            embeds: [new EmojiEmbed().setTitle("Create Ticket").setEmoji("GUILD.TICKET.OPEN")],
             ephemeral: true,
             components: splitFormattedTicketTypes
         });
@@ -183,13 +140,7 @@
     const overwrites = [
         {
             id: interaction.member,
-            allow: [
-                "VIEW_CHANNEL",
-                "SEND_MESSAGES",
-                "ATTACH_FILES",
-                "ADD_REACTIONS",
-                "READ_MESSAGE_HISTORY"
-            ],
+            allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
             type: "member"
         }
     ] as Discord.OverwriteResolvable[];
@@ -201,31 +152,21 @@
     if (config.tickets.supportRole !== null) {
         overwrites.push({
             id: interaction.guild.roles.cache.get(config.tickets.supportRole),
-            allow: [
-                "VIEW_CHANNEL",
-                "SEND_MESSAGES",
-                "ATTACH_FILES",
-                "ADD_REACTIONS",
-                "READ_MESSAGE_HISTORY"
-            ],
+            allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
             type: "role"
         });
     }
 
     let c;
     try {
-        c = await interaction.guild.channels.create(
-            interaction.member.user.username,
-            {
-                type: "GUILD_TEXT",
-                topic: `${interaction.member.user.id} Active`,
-                parent: config.tickets.category,
-                nsfw: false,
-                permissionOverwrites:
-                    overwrites as Discord.OverwriteResolvable[],
-                reason: "Creating ticket"
-            }
-        );
+        c = await interaction.guild.channels.create(interaction.member.user.username, {
+            type: "GUILD_TEXT",
+            topic: `${interaction.member.user.id} Active`,
+            parent: config.tickets.category,
+            nsfw: false,
+            permissionOverwrites: overwrites as Discord.OverwriteResolvable[],
+            reason: "Creating ticket"
+        });
     } catch (e) {
         return await interaction.editReply({
             embeds: [
@@ -241,24 +182,15 @@
         await c.send({
             content:
                 `<@${interaction.member.user.id}>` +
-                (config.tickets.supportRole !== null
-                    ? ` • <@&${config.tickets.supportRole}>`
-                    : ""),
+                (config.tickets.supportRole !== null ? ` • <@&${config.tickets.supportRole}>` : ""),
             allowedMentions: {
                 users: [(interaction.member as Discord.GuildMember).id],
-                roles:
-                    config.tickets.supportRole !== null
-                        ? [config.tickets.supportRole]
-                        : []
+                roles: config.tickets.supportRole !== null ? [config.tickets.supportRole] : []
             }
         });
-        let content = interaction.options
-            ? interaction.options.getString("message") || ""
-            : "";
+        let content = interaction.options ? interaction.options.getString("message") || "" : "";
         if (content) content = `**Message:**\n> ${content}\n`;
-        const emoji = custom
-            ? ""
-            : getEmojiByName("TICKETS." + chosenType.toUpperCase());
+        const emoji = custom ? "" : getEmojiByName("TICKETS." + chosenType.toUpperCase());
         await c.send({
             embeds: [
                 new EmojiEmbed()
@@ -266,9 +198,7 @@
                     .setDescription(
                         `Ticket created by <@${interaction.member.user.id}>\n` +
                             `**Support type:** ${
-                                chosenType !== null
-                                    ? emoji + " " + capitalize(chosenType)
-                                    : "General"
+                                chosenType !== null ? emoji + " " + capitalize(chosenType) : "General"
                             }\n` +
                             `**Ticket ID:** \`${c.id}\`\n${content}\n` +
                             "Type `/ticket close` to close this ticket."
@@ -296,14 +226,8 @@
                 timestamp: new Date().getTime()
             },
             list: {
-                ticketFor: entry(
-                    interaction.member.user.id,
-                    renderUser(interaction.member.user)
-                ),
-                created: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                ),
+                ticketFor: entry(interaction.member.user.id, renderUser(interaction.member.user)),
+                created: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                 ticketChannel: entry(c.id, renderChannel(c))
             },
             hidden: {
@@ -318,9 +242,7 @@
         embeds: [
             new EmojiEmbed()
                 .setTitle("Create Ticket")
-                .setDescription(
-                    `Ticket created. You can view it here: <#${c.id}>`
-                )
+                .setDescription(`Ticket created. You can view it here: <#${c.id}>`)
                 .setStatus("Success")
                 .setEmoji("GUILD.TICKET.OPEN")
         ],
diff --git a/src/actions/tickets/delete.ts b/src/actions/tickets/delete.ts
index 6509c03..d692a1e 100644
--- a/src/actions/tickets/delete.ts
+++ b/src/actions/tickets/delete.ts
@@ -4,14 +4,7 @@
 import getEmojiByName from "../../utils/getEmojiByName.js";
 
 export default async function (interaction) {
-    const {
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderChannel,
-        renderDelta
-    } = client.logger;
+    const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger;
 
     const config = await client.database.guilds.read(interaction.guild.id);
     let thread = false;
@@ -21,9 +14,7 @@
     if (
         !channel.parent ||
         config.tickets.category !== channel.parent.id ||
-        (thread
-            ? threadChannel.parent.parent.id !== config.tickets.category
-            : false)
+        (thread ? threadChannel.parent.parent.id !== config.tickets.category : false)
     ) {
         return interaction.reply({
             embeds: [
@@ -61,22 +52,10 @@
             list: {
                 ticketFor: entry(
                     channel.topic.split(" ")[0],
-                    renderUser(
-                        (
-                            await interaction.guild.members.fetch(
-                                channel.topic.split(" ")[0]
-                            )
-                        ).user
-                    )
+                    renderUser((await interaction.guild.members.fetch(channel.topic.split(" ")[0])).user)
                 ),
-                deletedBy: entry(
-                    interaction.member.user.id,
-                    renderUser(interaction.member.user)
-                ),
-                deleted: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                )
+                deletedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)),
+                deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
             },
             hidden: {
                 guild: interaction.guild.id
@@ -109,16 +88,8 @@
         ] as Discord.OverwriteResolvable[];
         if (config.tickets.supportRole !== null) {
             overwrites.push({
-                id: interaction.guild.roles.cache.get(
-                    config.tickets.supportRole
-                ),
-                allow: [
-                    "VIEW_CHANNEL",
-                    "SEND_MESSAGES",
-                    "ATTACH_FILES",
-                    "ADD_REACTIONS",
-                    "READ_MESSAGE_HISTORY"
-                ],
+                id: interaction.guild.roles.cache.get(config.tickets.supportRole),
+                allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
                 type: "role"
             });
         }
@@ -136,22 +107,10 @@
             list: {
                 ticketFor: entry(
                     channel.topic.split(" ")[0],
-                    renderUser(
-                        (
-                            await interaction.guild.members.fetch(
-                                channel.topic.split(" ")[0]
-                            )
-                        ).user
-                    )
+                    renderUser((await interaction.guild.members.fetch(channel.topic.split(" ")[0])).user)
                 ),
-                closedBy: entry(
-                    interaction.member.user.id,
-                    renderUser(interaction.member.user)
-                ),
-                closed: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                ),
+                closedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)),
+                closed: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                 ticketChannel: entry(channel.id, renderChannel(channel))
             },
             hidden: {
@@ -184,12 +143,7 @@
                                       .setLabel("Create Transcript and Delete")
                                       .setStyle("PRIMARY")
                                       .setCustomId("createtranscript")
-                                      .setEmoji(
-                                          getEmojiByName(
-                                              "CONTROL.DOWNLOAD",
-                                              "id"
-                                          )
-                                      )
+                                      .setEmoji(getEmojiByName("CONTROL.DOWNLOAD", "id"))
                               ]
                             : []
                     )
@@ -219,8 +173,7 @@
         }
     });
     if (deleted) {
-        const { log, NucleusColors, entry, renderUser, renderDelta } =
-            member.client.logger;
+        const { log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger;
         const data = {
             meta: {
                 type: "ticketPurge",
@@ -233,10 +186,7 @@
             list: {
                 ticketFor: entry(member, renderUser(member)),
                 deletedBy: entry(null, "Member left server"),
-                deleted: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                ),
+                deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                 ticketsDeleted: deleted
             },
             hidden: {
diff --git a/src/api/index.ts b/src/api/index.ts
index 2c4baba..f77fe70 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -105,15 +105,11 @@
         const code = req.params.code;
         const secret = req.body.secret;
         if (secret === client.config.verifySecret) {
-            const guild = await client.guilds.fetch(
-                client.roleMenu[code].guild
-            );
+            const guild = await client.guilds.fetch(client.roleMenu[code].guild);
             if (!guild) {
                 return res.status(404);
             }
-            const member = await guild.members.fetch(
-                client.roleMenu[code].user
-            );
+            const member = await guild.members.fetch(client.roleMenu[code].user);
             if (!member) {
                 return res.status(404);
             }
diff --git a/src/commands/help.ts b/src/commands/help.ts
index 921318e..df44aaa 100644
--- a/src/commands/help.ts
+++ b/src/commands/help.ts
@@ -2,18 +2,13 @@
 import { SlashCommandBuilder } from "@discordjs/builders";
 import { WrappedCheck } from "jshaiku";
 
-const command = new SlashCommandBuilder()
-    .setName("help")
-    .setDescription("Shows help for commands");
+const command = new SlashCommandBuilder().setName("help").setDescription("Shows help for commands");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     interaction.reply("hel p"); // TODO: FINISH THIS FOR RELEASE
 };
 
-const check = (
-    _interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     return true;
 };
 
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 4560c8b..87bfd28 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -1,9 +1,4 @@
-import {
-    CommandInteraction,
-    GuildMember,
-    MessageActionRow,
-    MessageButton
-} from "discord.js";
+import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -15,12 +10,7 @@
     builder
         .setName("ban")
         .setDescription("Bans a user from the server")
-        .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription("The user to ban")
-                .setRequired(true)
-        )
+        .addUserOption((option) => option.setName("user").setDescription("The user to ban").setRequired(true))
         .addNumberOption((option) =>
             option
                 .setName("delete")
@@ -43,21 +33,14 @@
             .setDescription(
                 keyValueList({
                     user: renderUser(interaction.options.getUser("user")),
-                    reason: reason
-                        ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ")
-                        : "*No reason provided*"
+                    reason: reason ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ") : "*No reason provided*"
                 }) +
                     `The user **will${notify ? "" : " not"}** be notified\n` +
                     `${addPlurals(
-                        interaction.options.getInteger("delete")
-                            ? interaction.options.getInteger("delete")
-                            : 0,
+                        interaction.options.getInteger("delete") ? interaction.options.getInteger("delete") : 0,
                         "day"
                     )} of messages will be deleted\n\n` +
-                    `Are you sure you want to ban <@!${
-                        (interaction.options.getMember("user") as GuildMember)
-                            .id
-                    }>?`
+                    `Are you sure you want to ban <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
             )
             .setColor("Danger")
             .addReasonButton(reason ?? "")
@@ -66,8 +49,7 @@
         if (confirmation.cancelled) return;
         if (confirmation.success) break;
         if (confirmation.newReason) reason = confirmation.newReason;
-        if (confirmation.components)
-            notify = confirmation.components.notify.active;
+        if (confirmation.components) notify = confirmation.components.notify.active;
     }
     if (confirmation.success) {
         let dmd = false;
@@ -75,9 +57,7 @@
         const config = await client.database.guilds.read(interaction.guild.id);
         try {
             if (notify) {
-                dm = await (
-                    interaction.options.getMember("user") as GuildMember
-                ).send({
+                dm = await (interaction.options.getMember("user") as GuildMember).send({
                     embeds: [
                         new EmojiEmbed()
                             .setEmoji("PUNISH.BAN.RED")
@@ -112,15 +92,8 @@
                 days: Number(interaction.options.getNumber("delete") ?? 0),
                 reason: reason ?? "No reason provided"
             });
-            await client.database.history.create(
-                "ban",
-                interaction.guild.id,
-                member.user,
-                interaction.user,
-                reason
-            );
-            const { log, NucleusColors, entry, renderUser, renderDelta } =
-                client.logger;
+            await client.database.history.create("ban", interaction.guild.id, member.user, interaction.user, reason);
+            const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
             const data = {
                 meta: {
                     type: "memberBan",
@@ -133,22 +106,10 @@
                 list: {
                     memberId: entry(member.user.id, `\`${member.user.id}\``),
                     name: entry(member.user.id, renderUser(member.user)),
-                    banned: entry(
-                        new Date().getTime(),
-                        renderDelta(new Date().getTime())
-                    ),
-                    bannedBy: entry(
-                        interaction.user.id,
-                        renderUser(interaction.user)
-                    ),
-                    reason: entry(
-                        reason,
-                        reason ? `\n> ${reason}` : "*No reason provided.*"
-                    ),
-                    accountCreated: entry(
-                        member.user.createdAt,
-                        renderDelta(member.user.createdAt)
-                    ),
+                    banned: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                    bannedBy: entry(interaction.user.id, renderUser(interaction.user)),
+                    reason: entry(reason, reason ? `\n> ${reason}` : "*No reason provided.*"),
+                    accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
                     serverMemberCount: interaction.guild.memberCount
                 },
                 hidden: {
@@ -162,9 +123,7 @@
                     new EmojiEmbed()
                         .setEmoji("PUNISH.BAN.RED")
                         .setTitle("Ban")
-                        .setDescription(
-                            "Something went wrong and the user was not banned"
-                        )
+                        .setDescription("Something went wrong and the user was not banned")
                         .setStatus("Danger")
                 ],
                 components: []
@@ -178,10 +137,7 @@
                 new EmojiEmbed()
                     .setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
                     .setTitle("Ban")
-                    .setDescription(
-                        "The member was banned" +
-                            (failed ? ", but could not be notified" : "")
-                    )
+                    .setDescription("The member was banned" + (failed ? ", but could not be notified" : ""))
                     .setStatus(failed ? "Warning" : "Success")
             ],
             components: []
@@ -204,30 +160,24 @@
     const member = interaction.member as GuildMember;
     const me = interaction.guild.me!;
     const apply = interaction.options.getMember("user") as GuildMember;
-    if (member === null || me === null || apply === null)
-        throw "That member is not in the server";
+    if (member === null || me === null || apply === null) throw "That member is not in the server";
     const memberPos = member.roles ? member.roles.highest.position : 0;
     const mePos = me.roles ? me.roles.highest.position : 0;
     const applyPos = apply.roles ? apply.roles.highest.position : 0;
     // Do not allow banning the owner
-    if (member.id === interaction.guild.ownerId)
-        throw "You cannot ban the owner of the server";
+    if (member.id === interaction.guild.ownerId) throw "You cannot ban the owner of the server";
     // Check if Nucleus can ban the member
-    if (!(mePos > applyPos))
-        throw "I do not have a role higher than that member";
+    if (!(mePos > applyPos)) throw "I do not have a role higher than that member";
     // Check if Nucleus has permission to ban
-    if (!me.permissions.has("BAN_MEMBERS"))
-        throw "I do not have the *Ban Members* permission";
+    if (!me.permissions.has("BAN_MEMBERS")) throw "I do not have the *Ban Members* permission";
     // Do not allow banning Nucleus
     if (member.id === interaction.guild.me.id) throw "I cannot ban myself";
     // Allow the owner to ban anyone
     if (member.id === interaction.guild.ownerId) return true;
     // Check if the user has ban_members permission
-    if (!member.permissions.has("BAN_MEMBERS"))
-        throw "You do not have the *Ban Members* permission";
+    if (!member.permissions.has("BAN_MEMBERS")) throw "You do not have the *Ban Members* permission";
     // Check if the user is below on the role list
-    if (!(memberPos > applyPos))
-        throw "You do not have a role higher than that member";
+    if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
     // Allow ban
     return true;
 };
diff --git a/src/commands/mod/info.ts b/src/commands/mod/info.ts
index 9837273..af30989 100644
--- a/src/commands/mod/info.ts
+++ b/src/commands/mod/info.ts
@@ -18,10 +18,7 @@
         .setName("info")
         .setDescription("Shows moderator information about a user")
         .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription("The user to get information about")
-                .setRequired(true)
+            option.setName("user").setDescription("The user to get information about").setRequired(true)
         );
 
 const types = {
@@ -39,11 +36,9 @@
 };
 
 function historyToString(history: HistorySchema) {
-    let s = `${getEmojiByName(types[history.type].emoji)} ${
-        history.amount ? history.amount + " " : ""
-    }${types[history.type].text} on <t:${Math.round(
-        history.occurredAt.getTime() / 1000
-    )}:F>`;
+    let s = `${getEmojiByName(types[history.type].emoji)} ${history.amount ? history.amount + " " : ""}${
+        types[history.type].text
+    } on <t:${Math.round(history.occurredAt.getTime() / 1000)}:F>`;
     if (history.moderator) {
         s += ` by <@${history.moderator}>`;
     }
@@ -71,13 +66,8 @@
         return this.content.reduce((acc, cur) => acc + cur.rendered.length, 0);
     };
     generateName = () => {
-        const first = Math.round(
-            this.content[0].data.occurredAt.getTime() / 1000
-        );
-        const last = Math.round(
-            this.content[this.content.length - 1].data.occurredAt.getTime() /
-                1000
-        );
+        const first = Math.round(this.content[0].data.occurredAt.getTime() / 1000);
+        const last = Math.round(this.content[this.content.length - 1].data.occurredAt.getTime() / 1000);
         if (first === last) {
             return (this.name = `<t:${first}:F>`);
         }
@@ -109,22 +99,14 @@
     let openFilterPane = false;
     while (true) {
         if (refresh) {
-            history = await client.database.history.read(
-                member.guild.id,
-                member.id,
-                currentYear
-            );
-            history = history
-                .sort((a, b) => b.occurredAt.getTime() - a.occurredAt.getTime())
-                .reverse();
+            history = await client.database.history.read(member.guild.id, member.id, currentYear);
+            history = history.sort((a, b) => b.occurredAt.getTime() - a.occurredAt.getTime()).reverse();
             if (openFilterPane) {
                 let tempFilteredTypes = filteredTypes;
                 if (filteredTypes.length === 0) {
                     tempFilteredTypes = Object.keys(types);
                 }
-                history = history.filter((h) =>
-                    tempFilteredTypes.includes(h.type)
-                );
+                history = history.filter((h) => tempFilteredTypes.includes(h.type));
             }
             refresh = false;
         }
@@ -132,11 +114,7 @@
         if (history.length > 0) {
             current = new TimelineSection();
             history.forEach((event) => {
-                if (
-                    current.contentLength() + historyToString(event).length >
-                        2000 ||
-                    current.content.length === 5
-                ) {
+                if (current.contentLength() + historyToString(event).length > 2000 || current.content.length === 5) {
                     groups.push(current);
                     current.generateName();
                     current = new TimelineSection();
@@ -162,9 +140,7 @@
                                       label: value.text,
                                       value: key,
                                       default: filteredTypes.includes(key),
-                                      emoji: client.emojis.resolve(
-                                          getEmojiByName(value.emoji, "id")
-                                      )
+                                      emoji: client.emojis.resolve(getEmojiByName(value.emoji, "id"))
                                   }))
                               )
                               .setMinValues(1)
@@ -181,22 +157,13 @@
                     .setLabel((currentYear - 1).toString())
                     .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
                     .setStyle("SECONDARY"),
-                new MessageButton()
-                    .setCustomId("prevPage")
-                    .setLabel("Previous page")
-                    .setStyle("PRIMARY"),
-                new MessageButton()
-                    .setCustomId("today")
-                    .setLabel("Today")
-                    .setStyle("PRIMARY"),
+                new MessageButton().setCustomId("prevPage").setLabel("Previous page").setStyle("PRIMARY"),
+                new MessageButton().setCustomId("today").setLabel("Today").setStyle("PRIMARY"),
                 new MessageButton()
                     .setCustomId("nextPage")
                     .setLabel("Next page")
                     .setStyle("PRIMARY")
-                    .setDisabled(
-                        pageIndex >= groups.length - 1 &&
-                            currentYear === new Date().getFullYear()
-                    ),
+                    .setDisabled(pageIndex >= groups.length - 1 && currentYear === new Date().getFullYear()),
                 new MessageButton()
                     .setCustomId("nextYear")
                     .setLabel((currentYear + 1).toString())
@@ -220,13 +187,8 @@
         const end =
             "\n\nJanuary " +
             currentYear.toString() +
-            pageIndicator(
-                Math.max(groups.length, 1),
-                groups.length === 0 ? 1 : pageIndex
-            ) +
-            (currentYear === new Date().getFullYear()
-                ? monthNames[new Date().getMonth()]
-                : "December") +
+            pageIndicator(Math.max(groups.length, 1), groups.length === 0 ? 1 : pageIndex) +
+            (currentYear === new Date().getFullYear() ? monthNames[new Date().getMonth()] : "December") +
             " " +
             currentYear.toString();
         if (groups.length > 0) {
@@ -235,22 +197,13 @@
                 embeds: [
                     new EmojiEmbed()
                         .setEmoji("MEMBER.JOIN")
-                        .setTitle(
-                            "Moderation history for " + member.user.username
-                        )
+                        .setTitle("Moderation history for " + member.user.username)
                         .setDescription(
-                            `**${toRender.name}**\n\n` +
-                                toRender.content
-                                    .map((c) => c.rendered)
-                                    .join("\n") +
-                                end
+                            `**${toRender.name}**\n\n` + toRender.content.map((c) => c.rendered).join("\n") + end
                         )
                         .setStatus("Success")
                         .setFooter({
-                            text:
-                                openFilterPane && filteredTypes.length
-                                    ? "Filters are currently enabled"
-                                    : ""
+                            text: openFilterPane && filteredTypes.length ? "Filters are currently enabled" : ""
                         })
                 ],
                 components: components
@@ -260,18 +213,11 @@
                 embeds: [
                     new EmojiEmbed()
                         .setEmoji("MEMBER.JOIN")
-                        .setTitle(
-                            "Moderation history for " + member.user.username
-                        )
-                        .setDescription(
-                            `**${currentYear}**\n\n*No events*` + "\n\n" + end
-                        )
+                        .setTitle("Moderation history for " + member.user.username)
+                        .setDescription(`**${currentYear}**\n\n*No events*` + "\n\n" + end)
                         .setStatus("Success")
                         .setFooter({
-                            text:
-                                openFilterPane && filteredTypes.length
-                                    ? "Filters are currently enabled"
-                                    : ""
+                            text: openFilterPane && filteredTypes.length ? "Filters are currently enabled" : ""
                         })
                 ],
                 components: components
@@ -285,9 +231,7 @@
                 embeds: [
                     new EmojiEmbed()
                         .setEmoji("MEMBER.JOIN")
-                        .setTitle(
-                            "Moderation history for " + member.user.username
-                        )
+                        .setTitle("Moderation history for " + member.user.username)
                         .setDescription(m.embeds[0].description)
                         .setStatus("Danger")
                         .setFooter({ text: "Message timed out" })
@@ -342,18 +286,11 @@
     }
 }
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     let m;
     const member = interaction.options.getMember("user") as Discord.GuildMember;
     await interaction.reply({
-        embeds: [
-            new EmojiEmbed()
-                .setEmoji("NUCLEUS.LOADING")
-                .setTitle("Downloading Data")
-                .setStatus("Danger")
-        ],
+        embeds: [new EmojiEmbed().setEmoji("NUCLEUS.LOADING").setTitle("Downloading Data").setStatus("Danger")],
         ephemeral: true,
         fetchReply: true
     });
@@ -415,9 +352,7 @@
                 embeds: [
                     new EmojiEmbed()
                         .setTitle("Mod notes for " + member.user.username)
-                        .setDescription(
-                            "Modal opened. If you can't see it, click back and try again."
-                        )
+                        .setDescription("Modal opened. If you can't see it, click back and try again.")
                         .setStatus("Success")
                         .setEmoji("GUILD.TICKET.OPEN")
                 ],
@@ -443,11 +378,7 @@
             }
             if (out.fields) {
                 const toAdd = out.fields.getTextInputValue("note") || null;
-                await client.database.notes.create(
-                    member.guild.id,
-                    member.id,
-                    toAdd
-                );
+                await client.database.notes.create(member.guild.id, member.id, toAdd);
             } else {
                 continue;
             }
@@ -460,8 +391,7 @@
 
 const check = (interaction: CommandInteraction) => {
     const member = interaction.member as GuildMember;
-    if (!member.permissions.has("MODERATE_MEMBERS"))
-        throw "You do not have the *Moderate Members* permission";
+    if (!member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the *Moderate Members* permission";
     return true;
 };
 
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index 59c2f81..f10563e 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -1,9 +1,4 @@
-import {
-    CommandInteraction,
-    GuildMember,
-    MessageActionRow,
-    MessageButton
-} from "discord.js";
+import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
 import humanizeDuration from "humanize-duration";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -15,16 +10,9 @@
     builder
         .setName("kick")
         .setDescription("Kicks a user from the server")
-        .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription("The user to kick")
-                .setRequired(true)
-        );
+        .addUserOption((option) => option.setName("user").setDescription("The user to kick").setRequired(true));
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     const { renderUser } = client.logger;
     // TODO:[Modals] Replace this with a modal
     let reason = null;
@@ -37,15 +25,10 @@
             .setDescription(
                 keyValueList({
                     user: renderUser(interaction.options.getUser("user")),
-                    reason: reason
-                        ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ")
-                        : "*No reason provided*"
+                    reason: reason ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ") : "*No reason provided*"
                 }) +
                     `The user **will${notify ? "" : " not"}** be notified\n\n` +
-                    `Are you sure you want to kick <@!${
-                        (interaction.options.getMember("user") as GuildMember)
-                            .id
-                    }>?`
+                    `Are you sure you want to kick <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
             )
             .setColor("Danger")
             .addReasonButton(reason ?? "")
@@ -64,9 +47,7 @@
         const config = await client.database.guilds.read(interaction.guild.id);
         try {
             if (notify) {
-                dm = await (
-                    interaction.options.getMember("user") as GuildMember
-                ).send({
+                dm = await (interaction.options.getMember("user") as GuildMember).send({
                     embeds: [
                         new EmojiEmbed()
                             .setEmoji("PUNISH.KICK.RED")
@@ -96,19 +77,10 @@
             dmd = false;
         }
         try {
-            (interaction.options.getMember("user") as GuildMember).kick(
-                reason ?? "No reason provided."
-            );
+            (interaction.options.getMember("user") as GuildMember).kick(reason ?? "No reason provided.");
             const member = interaction.options.getMember("user") as GuildMember;
-            await client.database.history.create(
-                "kick",
-                interaction.guild.id,
-                member.user,
-                interaction.user,
-                reason
-            );
-            const { log, NucleusColors, entry, renderUser, renderDelta } =
-                client.logger;
+            await client.database.history.create("kick", interaction.guild.id, member.user, interaction.user, reason);
+            const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
             const data = {
                 meta: {
                     type: "memberKick",
@@ -121,35 +93,17 @@
                 list: {
                     memberId: entry(member.id, `\`${member.id}\``),
                     name: entry(member.id, renderUser(member.user)),
-                    joined: entry(
-                        member.joinedAt,
-                        renderDelta(member.joinedAt)
-                    ),
-                    kicked: entry(
-                        new Date().getTime(),
-                        renderDelta(new Date().getTime())
-                    ),
-                    kickedBy: entry(
-                        interaction.user.id,
-                        renderUser(interaction.user)
-                    ),
-                    reason: entry(
-                        reason,
-                        reason ? `\n> ${reason}` : "*No reason provided.*"
-                    ),
+                    joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
+                    kicked: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                    kickedBy: entry(interaction.user.id, renderUser(interaction.user)),
+                    reason: entry(reason, reason ? `\n> ${reason}` : "*No reason provided.*"),
                     timeInServer: entry(
                         new Date().getTime() - member.joinedTimestamp,
-                        humanizeDuration(
-                            new Date().getTime() - member.joinedTimestamp,
-                            {
-                                round: true
-                            }
-                        )
+                        humanizeDuration(new Date().getTime() - member.joinedTimestamp, {
+                            round: true
+                        })
                     ),
-                    accountCreated: entry(
-                        member.user.createdAt,
-                        renderDelta(member.user.createdAt)
-                    ),
+                    accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
                     serverMemberCount: member.guild.memberCount
                 },
                 hidden: {
@@ -163,9 +117,7 @@
                     new EmojiEmbed()
                         .setEmoji("PUNISH.KICK.RED")
                         .setTitle("Kick")
-                        .setDescription(
-                            "Something went wrong and the user was not kicked"
-                        )
+                        .setDescription("Something went wrong and the user was not kicked")
                         .setStatus("Danger")
                 ],
                 components: []
@@ -179,10 +131,7 @@
                 new EmojiEmbed()
                     .setEmoji(`PUNISH.KICK.${failed ? "YELLOW" : "GREEN"}`)
                     .setTitle("Kick")
-                    .setDescription(
-                        "The member was kicked" +
-                            (failed ? ", but could not be notified" : "")
-                    )
+                    .setDescription("The member was kicked" + (failed ? ", but could not be notified" : ""))
                     .setStatus(failed ? "Warning" : "Success")
             ],
             components: []
@@ -205,30 +154,24 @@
     const member = interaction.member as GuildMember;
     const me = interaction.guild.me!;
     const apply = interaction.options.getMember("user") as GuildMember;
-    if (member === null || me === null || apply === null)
-        throw "That member is not in the server";
+    if (member === null || me === null || apply === null) throw "That member is not in the server";
     const memberPos = member.roles ? member.roles.highest.position : 0;
     const mePos = me.roles ? me.roles.highest.position : 0;
     const applyPos = apply.roles ? apply.roles.highest.position : 0;
     // Do not allow kicking the owner
-    if (member.id === interaction.guild.ownerId)
-        throw "You cannot kick the owner of the server";
+    if (member.id === interaction.guild.ownerId) throw "You cannot kick the owner of the server";
     // Check if Nucleus can kick the member
-    if (!(mePos > applyPos))
-        throw "I do not have a role higher than that member";
+    if (!(mePos > applyPos)) throw "I do not have a role higher than that member";
     // Check if Nucleus has permission to kick
-    if (!me.permissions.has("KICK_MEMBERS"))
-        throw "I do not have the *Kick Members* permission";
+    if (!me.permissions.has("KICK_MEMBERS")) throw "I do not have the *Kick Members* permission";
     // Do not allow kicking Nucleus
     if (member.id === interaction.guild.me.id) throw "I cannot kick myself";
     // Allow the owner to kick anyone
     if (member.id === interaction.guild.ownerId) return true;
     // Check if the user has kick_members permission
-    if (!member.permissions.has("KICK_MEMBERS"))
-        throw "You do not have the *Kick Members* permission";
+    if (!member.permissions.has("KICK_MEMBERS")) throw "You do not have the *Kick Members* permission";
     // Check if the user is below on the role list
-    if (!(memberPos > applyPos))
-        throw "You do not have a role higher than that member";
+    if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
     // Allow kick
     return true;
 };
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index b430191..dc44e5a 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -1,11 +1,5 @@
 import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, {
-    CommandInteraction,
-    GuildMember,
-    Message,
-    MessageActionRow,
-    MessageButton
-} from "discord.js";
+import Discord, { CommandInteraction, GuildMember, Message, MessageActionRow, MessageButton } from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -13,29 +7,17 @@
 import keyValueList from "../../utils/generateKeyValueList.js";
 import humanizeDuration from "humanize-duration";
 import client from "../../utils/client.js";
-import {
-    areTicketsEnabled,
-    create
-} from "../../actions/createModActionTicket.js";
+import { areTicketsEnabled, create } from "../../actions/createModActionTicket.js";
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
     builder
         .setName("mute")
-        .setDescription(
-            "Mutes a member, stopping them from talking in the server"
-        )
-        .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription("The user to mute")
-                .setRequired(true)
-        )
+        .setDescription("Mutes a member, stopping them from talking in the server")
+        .addUserOption((option) => option.setName("user").setDescription("The user to mute").setRequired(true))
         .addIntegerOption((option) =>
             option
                 .setName("days")
-                .setDescription(
-                    "The number of days to mute the user for | Default: 0"
-                )
+                .setDescription("The number of days to mute the user for | Default: 0")
                 .setMinValue(0)
                 .setMaxValue(27)
                 .setRequired(false)
@@ -43,9 +25,7 @@
         .addIntegerOption((option) =>
             option
                 .setName("hours")
-                .setDescription(
-                    "The number of hours to mute the user for | Default: 0"
-                )
+                .setDescription("The number of hours to mute the user for | Default: 0")
                 .setMinValue(0)
                 .setMaxValue(23)
                 .setRequired(false)
@@ -53,9 +33,7 @@
         .addIntegerOption((option) =>
             option
                 .setName("minutes")
-                .setDescription(
-                    "The number of minutes to mute the user for | Default: 0"
-                )
+                .setDescription("The number of minutes to mute the user for | Default: 0")
                 .setMinValue(0)
                 .setMaxValue(59)
                 .setRequired(false)
@@ -63,17 +41,14 @@
         .addIntegerOption((option) =>
             option
                 .setName("seconds")
-                .setDescription(
-                    "The number of seconds to mute the user for | Default: 0"
-                )
+                .setDescription("The number of seconds to mute the user for | Default: 0")
                 .setMinValue(0)
                 .setMaxValue(59)
                 .setRequired(false)
         );
 
 const callback = async (interaction: CommandInteraction): Promise<unknown> => {
-    const { log, NucleusColors, renderUser, entry, renderDelta } =
-        client.logger;
+    const { log, NucleusColors, renderUser, entry, renderDelta } = client.logger;
     const user = interaction.options.getMember("user") as GuildMember;
     const time = {
         days: interaction.options.getInteger("days") ?? 0,
@@ -82,19 +57,12 @@
         seconds: interaction.options.getInteger("seconds") ?? 0
     };
     const config = await client.database.guilds.read(interaction.guild.id);
-    let serverSettingsDescription = config.moderation.mute.timeout
-        ? "given a timeout"
-        : "";
+    let serverSettingsDescription = config.moderation.mute.timeout ? "given a timeout" : "";
     if (config.moderation.mute.role)
         serverSettingsDescription +=
-            (serverSettingsDescription ? " and " : "") +
-            `given the <@&${config.moderation.mute.role}> role`;
+            (serverSettingsDescription ? " and " : "") + `given the <@&${config.moderation.mute.role}> role`;
 
-    let muteTime =
-        time.days * 24 * 60 * 60 +
-        time.hours * 60 * 60 +
-        time.minutes * 60 +
-        time.seconds;
+    let muteTime = time.days * 24 * 60 * 60 + time.hours * 60 * 60 + time.minutes * 60 + time.seconds;
     if (muteTime === 0) {
         const m = (await interaction.reply({
             embeds: [
@@ -106,40 +74,16 @@
             ],
             components: [
                 new MessageActionRow().addComponents([
-                    new Discord.MessageButton()
-                        .setCustomId("1m")
-                        .setLabel("1 Minute")
-                        .setStyle("SECONDARY"),
-                    new Discord.MessageButton()
-                        .setCustomId("10m")
-                        .setLabel("10 Minutes")
-                        .setStyle("SECONDARY"),
-                    new Discord.MessageButton()
-                        .setCustomId("30m")
-                        .setLabel("30 Minutes")
-                        .setStyle("SECONDARY"),
-                    new Discord.MessageButton()
-                        .setCustomId("1h")
-                        .setLabel("1 Hour")
-                        .setStyle("SECONDARY")
+                    new Discord.MessageButton().setCustomId("1m").setLabel("1 Minute").setStyle("SECONDARY"),
+                    new Discord.MessageButton().setCustomId("10m").setLabel("10 Minutes").setStyle("SECONDARY"),
+                    new Discord.MessageButton().setCustomId("30m").setLabel("30 Minutes").setStyle("SECONDARY"),
+                    new Discord.MessageButton().setCustomId("1h").setLabel("1 Hour").setStyle("SECONDARY")
                 ]),
                 new MessageActionRow().addComponents([
-                    new Discord.MessageButton()
-                        .setCustomId("6h")
-                        .setLabel("6 Hours")
-                        .setStyle("SECONDARY"),
-                    new Discord.MessageButton()
-                        .setCustomId("12h")
-                        .setLabel("12 Hours")
-                        .setStyle("SECONDARY"),
-                    new Discord.MessageButton()
-                        .setCustomId("1d")
-                        .setLabel("1 Day")
-                        .setStyle("SECONDARY"),
-                    new Discord.MessageButton()
-                        .setCustomId("1w")
-                        .setLabel("1 Week")
-                        .setStyle("SECONDARY")
+                    new Discord.MessageButton().setCustomId("6h").setLabel("6 Hours").setStyle("SECONDARY"),
+                    new Discord.MessageButton().setCustomId("12h").setLabel("12 Hours").setStyle("SECONDARY"),
+                    new Discord.MessageButton().setCustomId("1d").setLabel("1 Day").setStyle("SECONDARY"),
+                    new Discord.MessageButton().setCustomId("1w").setLabel("1 Week").setStyle("SECONDARY")
                 ]),
                 new MessageActionRow().addComponents([
                     new Discord.MessageButton()
@@ -228,9 +172,7 @@
                     time: `${humanizeDuration(muteTime * 1000, {
                         round: true
                     })}`,
-                    reason: reason
-                        ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ")
-                        : "*No reason provided*"
+                    reason: reason ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ") : "*No reason provided*"
                 }) +
                     "The user will be " +
                     serverSettingsDescription +
@@ -244,12 +186,7 @@
                 "Create appeal ticket",
                 !(await areTicketsEnabled(interaction.guild.id)),
                 async () =>
-                    await create(
-                        interaction.guild,
-                        interaction.options.getUser("user"),
-                        interaction.user,
-                        reason
-                    ),
+                    await create(interaction.guild, interaction.options.getUser("user"), interaction.user, reason),
                 "An appeal ticket will be created when Confirm is clicked",
                 "CONTROL.TICKET",
                 createAppealTicket
@@ -291,17 +228,9 @@
                                         ? ` for:\n> ${reason}`
                                         : ".\n\n" +
                                           `You will be unmuted at: <t:${
-                                              Math.round(
-                                                  new Date().getTime() / 1000
-                                              ) + muteTime
-                                          }:D> at <t:${
-                                              Math.round(
-                                                  new Date().getTime() / 1000
-                                              ) + muteTime
-                                          }:T> (<t:${
-                                              Math.round(
-                                                  new Date().getTime() / 1000
-                                              ) + muteTime
+                                              Math.round(new Date().getTime() / 1000) + muteTime
+                                          }:D> at <t:${Math.round(new Date().getTime() / 1000) + muteTime}:T> (<t:${
+                                              Math.round(new Date().getTime() / 1000) + muteTime
                                           }:R>)`) +
                                     (confirmation.components.appeal.response
                                         ? `You can appeal this here: <#${confirmation.components.appeal.response}>`
@@ -331,10 +260,7 @@
         let errors = 0;
         try {
             if (config.moderation.mute.timeout) {
-                await member.timeout(
-                    muteTime * 1000,
-                    reason || "No reason provided"
-                );
+                await member.timeout(muteTime * 1000, reason || "No reason provided");
                 if (config.moderation.mute.role !== null) {
                     await member.roles.add(config.moderation.mute.role);
                     await client.database.eventScheduler.schedule(
@@ -354,15 +280,11 @@
         try {
             if (config.moderation.mute.role !== null) {
                 await member.roles.add(config.moderation.mute.role);
-                await client.database.eventScheduler.schedule(
-                    "unmuteRole",
-                    new Date().getTime() + muteTime * 1000,
-                    {
-                        guild: interaction.guild.id,
-                        user: user.id,
-                        role: config.moderation.mute.role
-                    }
-                );
+                await client.database.eventScheduler.schedule("unmuteRole", new Date().getTime() + muteTime * 1000, {
+                    guild: interaction.guild.id,
+                    user: user.id,
+                    role: config.moderation.mute.role
+                });
             }
         } catch (e) {
             console.log(e);
@@ -374,9 +296,7 @@
                     new EmojiEmbed()
                         .setEmoji("PUNISH.MUTE.RED")
                         .setTitle("Mute")
-                        .setDescription(
-                            "Something went wrong and the user was not muted"
-                        )
+                        .setDescription("Something went wrong and the user was not muted")
                         .setStatus("Danger")
                 ],
                 components: []
@@ -384,13 +304,7 @@
             if (dmd) await dm.delete();
             return;
         }
-        await client.database.history.create(
-            "mute",
-            interaction.guild.id,
-            member.user,
-            interaction.user,
-            reason
-        );
+        await client.database.history.create("mute", interaction.guild.id, member.user, interaction.user, reason);
         const failed = !dmd && notify;
         await interaction.editReply({
             embeds: [
@@ -424,14 +338,8 @@
                     new Date().getTime() + muteTime * 1000,
                     renderDelta(new Date().getTime() + muteTime * 1000)
                 ),
-                muted: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime() - 1000)
-                ),
-                mutedBy: entry(
-                    interaction.member.user.id,
-                    renderUser(interaction.member.user)
-                ),
+                muted: entry(new Date().getTime(), renderDelta(new Date().getTime() - 1000)),
+                mutedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)),
                 reason: entry(reason, reason ? reason : "*No reason provided*")
             },
             hidden: {
@@ -457,30 +365,24 @@
     const member = interaction.member as GuildMember;
     const me = interaction.guild.me!;
     const apply = interaction.options.getMember("user") as GuildMember;
-    if (member === null || me === null || apply === null)
-        throw "That member is not in the server";
+    if (member === null || me === null || apply === null) throw "That member is not in the server";
     const memberPos = member.roles ? member.roles.highest.position : 0;
     const mePos = me.roles ? me.roles.highest.position : 0;
     const applyPos = apply.roles ? apply.roles.highest.position : 0;
     // Do not allow muting the owner
-    if (member.id === interaction.guild.ownerId)
-        throw "You cannot mute the owner of the server";
+    if (member.id === interaction.guild.ownerId) throw "You cannot mute the owner of the server";
     // Check if Nucleus can mute the member
-    if (!(mePos > applyPos))
-        throw "I do not have a role higher than that member";
+    if (!(mePos > applyPos)) throw "I do not have a role higher than that member";
     // Check if Nucleus has permission to mute
-    if (!me.permissions.has("MODERATE_MEMBERS"))
-        throw "I do not have the *Moderate Members* permission";
+    if (!me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the *Moderate Members* permission";
     // Do not allow muting Nucleus
     if (member.id === me.id) throw "I cannot mute myself";
     // Allow the owner to mute anyone
     if (member.id === interaction.guild.ownerId) return true;
     // Check if the user has moderate_members permission
-    if (!member.permissions.has("MODERATE_MEMBERS"))
-        throw "You do not have the *Moderate Members* permission";
+    if (!member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the *Moderate Members* permission";
     // Check if the user is below on the role list
-    if (!(memberPos > applyPos))
-        throw "You do not have a role higher than that member";
+    if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
     // Allow mute
     return true;
 };
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index c3d6b33..cba14f4 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -9,22 +9,12 @@
     builder
         .setName("nick")
         .setDescription("Changes a users nickname")
-        .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription("The user to change")
-                .setRequired(true)
-        )
+        .addUserOption((option) => option.setName("user").setDescription("The user to change").setRequired(true))
         .addStringOption((option) =>
-            option
-                .setName("name")
-                .setDescription("The name to set | Leave blank to clear")
-                .setRequired(false)
+            option.setName("name").setDescription("The name to set | Leave blank to clear").setRequired(false)
         );
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     const { renderUser } = client.logger;
     // TODO:[Modals] Replace this with a modal
     let notify = true;
@@ -37,19 +27,12 @@
                 keyValueList({
                     user: renderUser(interaction.options.getUser("user")),
                     "new nickname": `${
-                        interaction.options.getString("name")
-                            ? interaction.options.getString("name")
-                            : "*No nickname*"
+                        interaction.options.getString("name") ? interaction.options.getString("name") : "*No nickname*"
                     }`
                 }) +
                     `The user **will${notify ? "" : " not"}** be notified\n\n` +
-                    `Are you sure you want to ${
-                        interaction.options.getString("name")
-                            ? "change"
-                            : "clear"
-                    } <@!${
-                        (interaction.options.getMember("user") as GuildMember)
-                            .id
+                    `Are you sure you want to ${interaction.options.getString("name") ? "change" : "clear"} <@!${
+                        (interaction.options.getMember("user") as GuildMember).id
                     }>'s nickname?`
             )
             .setColor("Danger")
@@ -74,23 +57,17 @@
         let dm;
         try {
             if (notify) {
-                dm = await (
-                    interaction.options.getMember("user") as GuildMember
-                ).send({
+                dm = await (interaction.options.getMember("user") as GuildMember).send({
                     embeds: [
                         new EmojiEmbed()
                             .setEmoji("PUNISH.NICKNAME.RED")
                             .setTitle("Nickname changed")
                             .setDescription(
                                 `Your nickname was ${
-                                    interaction.options.getString("name")
-                                        ? "changed"
-                                        : "cleared"
+                                    interaction.options.getString("name") ? "changed" : "cleared"
                                 } in ${interaction.guild.name}.` +
                                     (interaction.options.getString("name")
-                                        ? ` it is now: ${interaction.options.getString(
-                                              "name"
-                                          )}`
+                                        ? ` it is now: ${interaction.options.getString("name")}`
                                         : "") +
                                     "\n\n" +
                                     (confirmation.components.appeal.response
@@ -119,8 +96,7 @@
                 before,
                 nickname
             );
-            const { log, NucleusColors, entry, renderUser, renderDelta } =
-                client.logger;
+            const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
             const data = {
                 meta: {
                     type: "memberUpdate",
@@ -134,14 +110,8 @@
                     memberId: entry(member.id, `\`${member.id}\``),
                     before: entry(before, before ? before : "*None*"),
                     after: entry(nickname, nickname ? nickname : "*None*"),
-                    updated: entry(
-                        new Date().getTime(),
-                        renderDelta(new Date().getTime())
-                    ),
-                    updatedBy: entry(
-                        interaction.user.id,
-                        renderUser(interaction.user)
-                    )
+                    updated: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                    updatedBy: entry(interaction.user.id, renderUser(interaction.user))
                 },
                 hidden: {
                     guild: interaction.guild.id
@@ -154,9 +124,7 @@
                     new EmojiEmbed()
                         .setEmoji("PUNISH.NICKNAME.RED")
                         .setTitle("Nickname")
-                        .setDescription(
-                            "Something went wrong and the users nickname could not be changed."
-                        )
+                        .setDescription("Something went wrong and the users nickname could not be changed.")
                         .setStatus("Danger")
                 ],
                 components: []
@@ -199,30 +167,24 @@
     const member = interaction.member as GuildMember;
     const me = interaction.guild.me!;
     const apply = interaction.options.getMember("user") as GuildMember;
-    if (member === null || me === null || apply === null)
-        throw "That member is not in the server";
+    if (member === null || me === null || apply === null) throw "That member is not in the server";
     const memberPos = member.roles ? member.roles.highest.position : 0;
     const mePos = me.roles ? me.roles.highest.position : 0;
     const applyPos = apply.roles ? apply.roles.highest.position : 0;
     // Do not allow any changing of the owner
-    if (member.id === interaction.guild.ownerId)
-        throw "You cannot change the owner's nickname";
+    if (member.id === interaction.guild.ownerId) throw "You cannot change the owner's nickname";
     // Check if Nucleus can change the nickname
-    if (!(mePos > applyPos))
-        throw "I do not have a role higher than that member";
+    if (!(mePos > applyPos)) throw "I do not have a role higher than that member";
     // Check if Nucleus has permission to change the nickname
-    if (!me.permissions.has("MANAGE_NICKNAMES"))
-        throw "I do not have the *Manage Nicknames* permission";
+    if (!me.permissions.has("MANAGE_NICKNAMES")) throw "I do not have the *Manage Nicknames* permission";
     // Allow the owner to change anyone's nickname
     if (member.id === interaction.guild.ownerId) return true;
     // Check if the user has manage_nicknames permission
-    if (!member.permissions.has("MANAGE_NICKNAMES"))
-        throw "You do not have the *Manage Nicknames* permission";
+    if (!member.permissions.has("MANAGE_NICKNAMES")) throw "You do not have the *Manage Nicknames* permission";
     // Allow changing your own nickname
     if (member === apply) return true;
     // Check if the user is below on the role list
-    if (!(memberPos > applyPos))
-        throw "You do not have a role higher than that member";
+    if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
     // Allow change
     return true;
 };
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index b78c423..63a919c 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -1,9 +1,4 @@
-import Discord, {
-    CommandInteraction,
-    GuildChannel,
-    GuildMember,
-    TextChannel
-} from "discord.js";
+import Discord, { CommandInteraction, GuildChannel, GuildMember, TextChannel } from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -24,31 +19,19 @@
                 .setMaxValue(100)
         )
         .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription("The user to purge messages from")
-                .setRequired(false)
+            option.setName("user").setDescription("The user to purge messages from").setRequired(false)
         )
         .addStringOption((option) =>
-            option
-                .setName("reason")
-                .setDescription("The reason for the purge")
-                .setRequired(false)
+            option.setName("reason").setDescription("The reason for the purge").setRequired(false)
         );
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     const user = (interaction.options.getMember("user") as GuildMember) ?? null;
     const channel = interaction.channel as GuildChannel;
     if (
-        ![
-            "GUILD_TEXT",
-            "GUILD_NEWS",
-            "GUILD_NEWS_THREAD",
-            "GUILD_PUBLIC_THREAD",
-            "GUILD_PRIVATE_THREAD"
-        ].includes(channel.type.toString())
+        !["GUILD_TEXT", "GUILD_NEWS", "GUILD_NEWS_THREAD", "GUILD_PUBLIC_THREAD", "GUILD_PRIVATE_THREAD"].includes(
+            channel.type.toString()
+        )
     ) {
         return await interaction.reply({
             embeds: [
@@ -90,32 +73,14 @@
                 ],
                 components: [
                     new Discord.MessageActionRow().addComponents([
-                        new Discord.MessageButton()
-                            .setCustomId("1")
-                            .setLabel("1")
-                            .setStyle("SECONDARY"),
-                        new Discord.MessageButton()
-                            .setCustomId("3")
-                            .setLabel("3")
-                            .setStyle("SECONDARY"),
-                        new Discord.MessageButton()
-                            .setCustomId("5")
-                            .setLabel("5")
-                            .setStyle("SECONDARY")
+                        new Discord.MessageButton().setCustomId("1").setLabel("1").setStyle("SECONDARY"),
+                        new Discord.MessageButton().setCustomId("3").setLabel("3").setStyle("SECONDARY"),
+                        new Discord.MessageButton().setCustomId("5").setLabel("5").setStyle("SECONDARY")
                     ]),
                     new Discord.MessageActionRow().addComponents([
-                        new Discord.MessageButton()
-                            .setCustomId("10")
-                            .setLabel("10")
-                            .setStyle("SECONDARY"),
-                        new Discord.MessageButton()
-                            .setCustomId("25")
-                            .setLabel("25")
-                            .setStyle("SECONDARY"),
-                        new Discord.MessageButton()
-                            .setCustomId("50")
-                            .setLabel("50")
-                            .setStyle("SECONDARY")
+                        new Discord.MessageButton().setCustomId("10").setLabel("10").setStyle("SECONDARY"),
+                        new Discord.MessageButton().setCustomId("25").setLabel("25").setStyle("SECONDARY"),
+                        new Discord.MessageButton().setCustomId("50").setLabel("50").setStyle("SECONDARY")
                     ]),
                     new Discord.MessageActionRow().addComponents([
                         new Discord.MessageButton()
@@ -144,17 +109,12 @@
                 break;
             }
             let messages;
-            await (interaction.channel as TextChannel).messages
-                .fetch({ limit: amount })
-                .then(async (ms) => {
-                    if (user) {
-                        ms = ms.filter((m) => m.author.id === user.id);
-                    }
-                    messages = await (channel as TextChannel).bulkDelete(
-                        ms,
-                        true
-                    );
-                });
+            await (interaction.channel as TextChannel).messages.fetch({ limit: amount }).then(async (ms) => {
+                if (user) {
+                    ms = ms.filter((m) => m.author.id === user.id);
+                }
+                messages = await (channel as TextChannel).bulkDelete(ms, true);
+            });
             if (messages) {
                 deleted = deleted.concat(messages.map((m) => m));
             }
@@ -181,8 +141,7 @@
                 deleted.length
             );
         }
-        const { log, NucleusColors, entry, renderUser, renderChannel } =
-            client.logger;
+        const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
         const data = {
             meta: {
                 type: "channelPurge",
@@ -193,18 +152,9 @@
                 timestamp: new Date().getTime()
             },
             list: {
-                memberId: entry(
-                    interaction.user.id,
-                    `\`${interaction.user.id}\``
-                ),
-                purgedBy: entry(
-                    interaction.user.id,
-                    renderUser(interaction.user)
-                ),
-                channel: entry(
-                    interaction.channel.id,
-                    renderChannel(interaction.channel)
-                ),
+                memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+                purgedBy: entry(interaction.user.id, renderUser(interaction.user)),
+                channel: entry(interaction.channel.id, renderChannel(interaction.channel)),
                 messagesCleared: entry(deleted.length, deleted.length)
             },
             hidden: {
@@ -214,9 +164,7 @@
         log(data);
         let out = "";
         deleted.reverse().forEach((message) => {
-            out += `${message.author.username}#${
-                message.author.discriminator
-            } (${message.author.id}) [${new Date(
+            out += `${message.author.username}#${message.author.discriminator} (${message.author.id}) [${new Date(
                 message.createdTimestamp
             ).toISOString()}]\n`;
             const lines = message.content.split("\n");
@@ -304,29 +252,19 @@
             let messages;
             try {
                 if (!user) {
-                    const toDelete = await (
-                        interaction.channel as TextChannel
-                    ).messages.fetch({
+                    const toDelete = await (interaction.channel as TextChannel).messages.fetch({
                         limit: interaction.options.getInteger("amount")
                     });
-                    messages = await (channel as TextChannel).bulkDelete(
-                        toDelete,
-                        true
-                    );
+                    messages = await (channel as TextChannel).bulkDelete(toDelete, true);
                 } else {
                     const toDelete = (
                         await (
-                            await (
-                                interaction.channel as TextChannel
-                            ).messages.fetch({
+                            await (interaction.channel as TextChannel).messages.fetch({
                                 limit: 100
                             })
                         ).filter((m) => m.author.id === user.id)
                     ).first(interaction.options.getInteger("amount"));
-                    messages = await (channel as TextChannel).bulkDelete(
-                        toDelete,
-                        true
-                    );
+                    messages = await (channel as TextChannel).bulkDelete(toDelete, true);
                 }
             } catch (e) {
                 await interaction.editReply({
@@ -334,9 +272,7 @@
                         new EmojiEmbed()
                             .setEmoji("CHANNEL.PURGE.RED")
                             .setTitle("Purge")
-                            .setDescription(
-                                "Something went wrong and no messages were deleted"
-                            )
+                            .setDescription("Something went wrong and no messages were deleted")
                             .setStatus("Danger")
                     ],
                     components: []
@@ -353,8 +289,7 @@
                     messages.size
                 );
             }
-            const { log, NucleusColors, entry, renderUser, renderChannel } =
-                client.logger;
+            const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
             const data = {
                 meta: {
                     type: "channelPurge",
@@ -365,18 +300,9 @@
                     timestamp: new Date().getTime()
                 },
                 list: {
-                    memberId: entry(
-                        interaction.user.id,
-                        `\`${interaction.user.id}\``
-                    ),
-                    purgedBy: entry(
-                        interaction.user.id,
-                        renderUser(interaction.user)
-                    ),
-                    channel: entry(
-                        interaction.channel.id,
-                        renderChannel(interaction.channel)
-                    ),
+                    memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+                    purgedBy: entry(interaction.user.id, renderUser(interaction.user)),
+                    channel: entry(interaction.channel.id, renderChannel(interaction.channel)),
                     messagesCleared: entry(messages.size, messages.size)
                 },
                 hidden: {
@@ -386,9 +312,7 @@
             log(data);
             let out = "";
             messages.reverse().forEach((message) => {
-                out += `${message.author.username}#${
-                    message.author.discriminator
-                } (${message.author.id}) [${new Date(
+                out += `${message.author.username}#${message.author.discriminator} (${message.author.id}) [${new Date(
                     message.createdTimestamp
                 ).toISOString()}]\n`;
                 const lines = message.content.split("\n");
@@ -472,13 +396,11 @@
     const member = interaction.member as GuildMember;
     const me = interaction.guild.me!;
     // Check if nucleus has the manage_messages permission
-    if (!me.permissions.has("MANAGE_MESSAGES"))
-        throw "I do not have the *Manage Messages* permission";
+    if (!me.permissions.has("MANAGE_MESSAGES")) throw "I do not have the *Manage Messages* permission";
     // Allow the owner to purge
     if (member.id === interaction.guild.ownerId) return true;
     // Check if the user has manage_messages permission
-    if (!member.permissions.has("MANAGE_MESSAGES"))
-        throw "You do not have the *Manage Messages* permission";
+    if (!member.permissions.has("MANAGE_MESSAGES")) throw "You do not have the *Manage Messages* permission";
     // Allow purge
     return true;
 };
diff --git a/src/commands/mod/slowmode.ts b/src/commands/mod/slowmode.ts
index 1a06db1..5565534 100644
--- a/src/commands/mod/slowmode.ts
+++ b/src/commands/mod/slowmode.ts
@@ -34,10 +34,7 @@
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     let time = parseInt(interaction.options.getString("time") ?? "0");
-    if (
-        time === 0 &&
-        (interaction.channel as TextChannel).rateLimitPerUser === 0
-    ) {
+    if (time === 0 && (interaction.channel as TextChannel).rateLimitPerUser === 0) {
         time = 10;
     }
     const confirmation = await new confirmationMessage(interaction)
@@ -45,9 +42,7 @@
         .setTitle("Slowmode")
         .setDescription(
             keyValueList({
-                time: time
-                    ? humanizeDuration(time * 1000, { round: true })
-                    : "No delay"
+                time: time ? humanizeDuration(time * 1000, { round: true }) : "No delay"
             }) + "Are you sure you want to set the slowmode in this channel?"
         )
         .setColor("Danger")
@@ -62,9 +57,7 @@
                     new EmojiEmbed()
                         .setEmoji("CHANNEL.SLOWMODE.OFF")
                         .setTitle("Slowmode")
-                        .setDescription(
-                            "Something went wrong while setting the slowmode"
-                        )
+                        .setDescription("Something went wrong while setting the slowmode")
                         .setStatus("Danger")
                 ],
                 components: []
@@ -100,8 +93,7 @@
     if (!interaction.guild.me.permissions.has("MANAGE_CHANNELS"))
         throw "I do not have the *Manage Channels* permission";
     // Check if the user has manage_channel permission
-    if (!member.permissions.has("MANAGE_CHANNELS"))
-        throw "You do not have the *Manage Channels* permission";
+    if (!member.permissions.has("MANAGE_CHANNELS")) throw "You do not have the *Manage Channels* permission";
     // Allow slowmode
     return true;
 };
diff --git a/src/commands/mod/softban.ts b/src/commands/mod/softban.ts
index f3c475e..57a70dc 100644
--- a/src/commands/mod/softban.ts
+++ b/src/commands/mod/softban.ts
@@ -1,9 +1,4 @@
-import {
-    CommandInteraction,
-    GuildMember,
-    MessageActionRow,
-    MessageButton
-} from "discord.js";
+import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -15,12 +10,7 @@
     builder
         .setName("softban")
         .setDescription("Kicks a user and deletes their messages")
-        .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription("The user to softban")
-                .setRequired(true)
-        )
+        .addUserOption((option) => option.setName("user").setDescription("The user to softban").setRequired(true))
         .addIntegerOption((option) =>
             option
                 .setName("delete")
@@ -30,9 +20,7 @@
                 .setRequired(false)
         );
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     const { renderUser } = client.logger;
     // TODO:[Modals] Replace this with a modal
     let reason = null;
@@ -45,21 +33,14 @@
             .setDescription(
                 keyValueList({
                     user: renderUser(interaction.options.getUser("user")),
-                    reason: reason
-                        ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ")
-                        : "*No reason provided*"
+                    reason: reason ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ") : "*No reason provided*"
                 }) +
                     `The user **will${notify ? "" : " not"}** be notified\n` +
                     `${addPlural(
-                        interaction.options.getInteger("delete")
-                            ? interaction.options.getInteger("delete")
-                            : 0,
+                        interaction.options.getInteger("delete") ? interaction.options.getInteger("delete") : 0,
                         "day"
                     )} of messages will be deleted\n\n` +
-                    `Are you sure you want to softban <@!${
-                        (interaction.options.getMember("user") as GuildMember)
-                            .id
-                    }>?`
+                    `Are you sure you want to softban <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
             )
             .setColor("Danger")
             .addCustomBoolean(
@@ -86,9 +67,7 @@
         const config = await client.database.guilds.read(interaction.guild.id);
         try {
             if (notify) {
-                await (
-                    interaction.options.getMember("user") as GuildMember
-                ).send({
+                await (interaction.options.getMember("user") as GuildMember).send({
                     embeds: [
                         new EmojiEmbed()
                             .setEmoji("PUNISH.BAN.RED")
@@ -130,30 +109,20 @@
                     new EmojiEmbed()
                         .setEmoji("PUNISH.BAN.RED")
                         .setTitle("Softban")
-                        .setDescription(
-                            "Something went wrong and the user was not softbanned"
-                        )
+                        .setDescription("Something went wrong and the user was not softbanned")
                         .setStatus("Danger")
                 ],
                 components: []
             });
         }
-        await client.database.history.create(
-            "softban",
-            interaction.guild.id,
-            member.user,
-            reason
-        );
+        await client.database.history.create("softban", interaction.guild.id, member.user, reason);
         const failed = !dmd && notify;
         await interaction.editReply({
             embeds: [
                 new EmojiEmbed()
                     .setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
                     .setTitle("Softban")
-                    .setDescription(
-                        "The member was softbanned" +
-                            (failed ? ", but could not be notified" : "")
-                    )
+                    .setDescription("The member was softbanned" + (failed ? ", but could not be notified" : ""))
                     .setStatus(failed ? "Warning" : "Success")
             ],
             components: []
@@ -176,30 +145,24 @@
     const member = interaction.member as GuildMember;
     const me = interaction.guild.me!;
     const apply = interaction.options.getMember("user") as GuildMember;
-    if (member === null || me === null || apply === null)
-        throw "That member is not in the server";
+    if (member === null || me === null || apply === null) throw "That member is not in the server";
     const memberPos = member.roles ? member.roles.highest.position : 0;
     const mePos = me.roles ? me.roles.highest.position : 0;
     const applyPos = apply.roles ? apply.roles.highest.position : 0;
     // Do not allow softbanning the owner
-    if (member.id === interaction.guild.ownerId)
-        throw "You cannot softban the owner of the server";
+    if (member.id === interaction.guild.ownerId) throw "You cannot softban the owner of the server";
     // Check if Nucleus can ban the member
-    if (!(mePos > applyPos))
-        throw "I do not have a role higher than that member";
+    if (!(mePos > applyPos)) throw "I do not have a role higher than that member";
     // Check if Nucleus has permission to ban
-    if (!me.permissions.has("BAN_MEMBERS"))
-        throw "I do not have the *Ban Members* permission";
+    if (!me.permissions.has("BAN_MEMBERS")) throw "I do not have the *Ban Members* permission";
     // Do not allow softbanning Nucleus
     if (member.id === me.id) throw "I cannot softban myself";
     // Allow the owner to softban anyone
     if (member.id === interaction.guild.ownerId) return true;
     // Check if the user has ban_members permission
-    if (!member.permissions.has("BAN_MEMBERS"))
-        throw "You do not have the *Ban Members* permission";
+    if (!member.permissions.has("BAN_MEMBERS")) throw "You do not have the *Ban Members* permission";
     // Check if the user is below on the role list
-    if (!(memberPos > applyPos))
-        throw "You do not have a role higher than that member";
+    if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
     // Allow softban
     return true;
 };
diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts
index 06fe647..9ba10e1 100644
--- a/src/commands/mod/unban.ts
+++ b/src/commands/mod/unban.ts
@@ -10,34 +10,21 @@
         .setName("unban")
         .setDescription("Unbans a user")
         .addStringOption((option) =>
-            option
-                .setName("user")
-                .setDescription("The user to unban (Username or ID)")
-                .setRequired(true)
+            option.setName("user").setDescription("The user to unban (Username or ID)").setRequired(true)
         );
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     const bans = await interaction.guild.bans.fetch();
     const user = interaction.options.getString("user");
     let resolved = bans.find((ban) => ban.user.id === user);
-    if (!resolved)
-        resolved = bans.find(
-            (ban) => ban.user.username.toLowerCase() === user.toLowerCase()
-        );
-    if (!resolved)
-        resolved = bans.find(
-            (ban) => ban.user.tag.toLowerCase() === user.toLowerCase()
-        );
+    if (!resolved) resolved = bans.find((ban) => ban.user.username.toLowerCase() === user.toLowerCase());
+    if (!resolved) resolved = bans.find((ban) => ban.user.tag.toLowerCase() === user.toLowerCase());
     if (!resolved) {
         return interaction.reply({
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Unban")
-                    .setDescription(
-                        `Could not find any user called \`${user}\``
-                    )
+                    .setDescription(`Could not find any user called \`${user}\``)
                     .setEmoji("PUNISH.UNBAN.RED")
                     .setStatus("Danger")
             ],
@@ -58,19 +45,10 @@
     if (confirmation.cancelled) return;
     if (confirmation.success) {
         try {
-            await interaction.guild.members.unban(
-                resolved.user as User,
-                "Unban"
-            );
+            await interaction.guild.members.unban(resolved.user as User, "Unban");
             const member = resolved.user as User;
-            await client.database.history.create(
-                "unban",
-                interaction.guild.id,
-                member,
-                interaction.user
-            );
-            const { log, NucleusColors, entry, renderUser, renderDelta } =
-                client.logger;
+            await client.database.history.create("unban", interaction.guild.id, member, interaction.user);
+            const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
             const data = {
                 meta: {
                     type: "memberUnban",
@@ -83,18 +61,9 @@
                 list: {
                     memberId: entry(member.id, `\`${member.id}\``),
                     name: entry(member.id, renderUser(member)),
-                    unbanned: entry(
-                        new Date().getTime(),
-                        renderDelta(new Date().getTime())
-                    ),
-                    unbannedBy: entry(
-                        interaction.user.id,
-                        renderUser(interaction.user)
-                    ),
-                    accountCreated: entry(
-                        member.createdAt,
-                        renderDelta(member.createdAt)
-                    )
+                    unbanned: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                    unbannedBy: entry(interaction.user.id, renderUser(interaction.user)),
+                    accountCreated: entry(member.createdAt, renderDelta(member.createdAt))
                 },
                 hidden: {
                     guild: interaction.guild.id
@@ -107,9 +76,7 @@
                     new EmojiEmbed()
                         .setEmoji("PUNISH.UNBAN.RED")
                         .setTitle("Unban")
-                        .setDescription(
-                            "Something went wrong and the user was not unbanned"
-                        )
+                        .setDescription("Something went wrong and the user was not unbanned")
                         .setStatus("Danger")
                 ],
                 components: []
@@ -143,13 +110,11 @@
     const member = interaction.member as GuildMember;
     const me = interaction.guild.me!;
     // Check if Nucleus can unban members
-    if (!me.permissions.has("BAN_MEMBERS"))
-        throw "I do not have the *Ban Members* permission";
+    if (!me.permissions.has("BAN_MEMBERS")) throw "I do not have the *Ban Members* permission";
     // Allow the owner to unban anyone
     if (member.id === interaction.guild.ownerId) return true;
     // Check if the user has ban_members permission
-    if (!member.permissions.has("BAN_MEMBERS"))
-        throw "You do not have the *Ban Members* permission";
+    if (!member.permissions.has("BAN_MEMBERS")) throw "You do not have the *Ban Members* permission";
     // Allow unban
     return true;
 };
diff --git a/src/commands/mod/unmute.ts b/src/commands/mod/unmute.ts
index f625461..40a2093 100644
--- a/src/commands/mod/unmute.ts
+++ b/src/commands/mod/unmute.ts
@@ -9,18 +9,10 @@
     builder
         .setName("unmute")
         .setDescription("Unmutes a user")
-        .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription("The user to unmute")
-                .setRequired(true)
-        );
+        .addUserOption((option) => option.setName("user").setDescription("The user to unmute").setRequired(true));
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
-    const { log, NucleusColors, renderUser, entry, renderDelta } =
-        client.logger;
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
+    const { log, NucleusColors, renderUser, entry, renderDelta } = client.logger;
     // TODO:[Modals] Replace this with a modal
     let reason = null;
     let notify = false;
@@ -35,10 +27,7 @@
                     reason: `\n> ${reason ? reason : "*No reason provided*"}`
                 }) +
                     `The user **will${notify ? "" : " not"}** be notified\n\n` +
-                    `Are you sure you want to unmute <@!${
-                        (interaction.options.getMember("user") as GuildMember)
-                            .id
-                    }>?`
+                    `Are you sure you want to unmute <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
             )
             .setColor("Danger")
             .addReasonButton(reason ?? "")
@@ -55,18 +44,14 @@
         let dm;
         try {
             if (notify) {
-                dm = await (
-                    interaction.options.getMember("user") as GuildMember
-                ).send({
+                dm = await (interaction.options.getMember("user") as GuildMember).send({
                     embeds: [
                         new EmojiEmbed()
                             .setEmoji("PUNISH.MUTE.GREEN")
                             .setTitle("Unmuted")
                             .setDescription(
                                 `You have been unmuted in ${interaction.guild.name}` +
-                                    (reason
-                                        ? ` for:\n> ${reason}`
-                                        : " with no reason provided.")
+                                    (reason ? ` for:\n> ${reason}` : " with no reason provided.")
                             )
                             .setStatus("Success")
                     ]
@@ -85,9 +70,7 @@
                     new EmojiEmbed()
                         .setEmoji("PUNISH.MUTE.RED")
                         .setTitle("Unmute")
-                        .setDescription(
-                            "Something went wrong and the user was not unmuted"
-                        )
+                        .setDescription("Something went wrong and the user was not unmuted")
                         .setStatus("Danger")
                 ],
                 components: []
@@ -114,14 +97,8 @@
             list: {
                 memberId: entry(member.user.id, `\`${member.user.id}\``),
                 name: entry(member.user.id, renderUser(member.user)),
-                unmuted: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                ),
-                unmutedBy: entry(
-                    interaction.user.id,
-                    renderUser(interaction.user)
-                )
+                unmuted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                unmutedBy: entry(interaction.user.id, renderUser(interaction.user))
             },
             hidden: {
                 guild: interaction.guild.id
@@ -134,10 +111,7 @@
                 new EmojiEmbed()
                     .setEmoji(`PUNISH.MUTE.${failed ? "YELLOW" : "GREEN"}`)
                     .setTitle("Unmute")
-                    .setDescription(
-                        "The member was unmuted" +
-                            (failed ? ", but could not be notified" : "")
-                    )
+                    .setDescription("The member was unmuted" + (failed ? ", but could not be notified" : ""))
                     .setStatus(failed ? "Warning" : "Success")
             ],
             components: []
@@ -160,28 +134,22 @@
     const member = interaction.member as GuildMember;
     const me = interaction.guild.me!;
     const apply = interaction.options.getMember("user") as GuildMember;
-    if (member === null || me === null || apply === null)
-        throw "That member is not in the server";
+    if (member === null || me === null || apply === null) throw "That member is not in the server";
     const memberPos = member.roles ? member.roles.highest.position : 0;
     const mePos = me.roles ? me.roles.highest.position : 0;
     const applyPos = apply.roles ? apply.roles.highest.position : 0;
     // Do not allow unmuting the owner
-    if (member.id === interaction.guild.ownerId)
-        throw "You cannot unmute the owner of the server";
+    if (member.id === interaction.guild.ownerId) throw "You cannot unmute the owner of the server";
     // Check if Nucleus can unmute the member
-    if (!(mePos > applyPos))
-        throw "I do not have a role higher than that member";
+    if (!(mePos > applyPos)) throw "I do not have a role higher than that member";
     // Check if Nucleus has permission to unmute
-    if (!me.permissions.has("MODERATE_MEMBERS"))
-        throw "I do not have the *Moderate Members* permission";
+    if (!me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the *Moderate Members* permission";
     // Allow the owner to unmute anyone
     if (member.id === interaction.guild.ownerId) return true;
     // Check if the user has moderate_members permission
-    if (!member.permissions.has("MODERATE_MEMBERS"))
-        throw "You do not have the *Moderate Members* permission";
+    if (!member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the *Moderate Members* permission";
     // Check if the user is below on the role list
-    if (!(memberPos > applyPos))
-        throw "You do not have a role higher than that member";
+    if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
     // Allow unmute
     return true;
 };
diff --git a/src/commands/mod/viewas.ts b/src/commands/mod/viewas.ts
index f0b2047..577192f 100644
--- a/src/commands/mod/viewas.ts
+++ b/src/commands/mod/viewas.ts
@@ -15,19 +15,13 @@
     builder
         .setName("viewas")
         .setDescription("View the server as a specific member")
-        .addUserOption((option) =>
-            option
-                .setName("member")
-                .setDescription("The member to view as")
-                .setRequired(true)
-        );
+        .addUserOption((option) => option.setName("member").setDescription("The member to view as").setRequired(true));
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     let channels = [];
     let m;
     interaction.guild.channels.cache.forEach((channel) => {
-        if (!channel.parent && channel.type !== "GUILD_CATEGORY")
-            channels.push(channel);
+        if (!channel.parent && channel.type !== "GUILD_CATEGORY") channels.push(channel);
     });
     channels = [channels];
     channels = channels.concat(
@@ -38,11 +32,7 @@
     const autoSortBelow = ["GUILD_VOICE", "GUILD_STAGE_VOICE"];
     channels = channels.map((c) =>
         c.sort((a, b) => {
-            if (
-                autoSortBelow.includes(a.type) &&
-                autoSortBelow.includes(b.type)
-            )
-                return a.position - b.position;
+            if (autoSortBelow.includes(a.type) && autoSortBelow.includes(b.type)) return a.position - b.position;
             if (autoSortBelow.includes(a.type)) return 1;
             if (autoSortBelow.includes(b.type)) return -1;
             return a.position - b.position;
@@ -54,9 +44,7 @@
         if (!b[0].parent) return 1;
         return a[0].parent.position - b[0].parent.position;
     });
-    const member = interaction.options.getMember(
-        "member"
-    ) as Discord.GuildMember;
+    const member = interaction.options.getMember("member") as Discord.GuildMember;
     m = await interaction.reply({
         embeds: [
             new EmojiEmbed()
@@ -76,48 +64,26 @@
                     .setTitle("Viewing as " + member.displayName)
                     .setStatus("Success")
                     .setDescription(
-                        `**${
-                            channels[page][0].parent
-                                ? channels[page][0].parent.name
-                                : "Uncategorised"
-                        }**` +
+                        `**${channels[page][0].parent ? channels[page][0].parent.name : "Uncategorised"}**` +
                             "\n" +
                             channels[page]
                                 .map((c) => {
                                     let channelType = c.type;
-                                    if (
-                                        interaction.guild.rulesChannelId ===
-                                        c.id
-                                    )
-                                        channelType = "RULES";
-                                    else if ("nsfw" in c && c.nsfw)
-                                        channelType += "_NSFW";
-                                    return c
-                                        .permissionsFor(member)
-                                        .has("VIEW_CHANNEL")
-                                        ? `${getEmojiByName(
-                                              "ICONS.CHANNEL." + channelType
-                                          )} ${c.name}\n` +
+                                    if (interaction.guild.rulesChannelId === c.id) channelType = "RULES";
+                                    else if ("nsfw" in c && c.nsfw) channelType += "_NSFW";
+                                    return c.permissionsFor(member).has("VIEW_CHANNEL")
+                                        ? `${getEmojiByName("ICONS.CHANNEL." + channelType)} ${c.name}\n` +
                                               (() => {
-                                                  if (
-                                                      "threads" in c &&
-                                                      c.threads.cache.size > 0
-                                                  ) {
+                                                  if ("threads" in c && c.threads.cache.size > 0) {
                                                       return (
                                                           c.threads.cache
                                                               .map(
                                                                   (t) =>
                                                                       ` ${
-                                                                          getEmojiByName(
-                                                                              "ICONS.CHANNEL.THREAD_PIPE"
-                                                                          ) +
+                                                                          getEmojiByName("ICONS.CHANNEL.THREAD_PIPE") +
                                                                           " " +
-                                                                          getEmojiByName(
-                                                                              "ICONS.CHANNEL.THREAD_CHANNEL"
-                                                                          )
-                                                                      } ${
-                                                                          t.name
-                                                                      }`
+                                                                          getEmojiByName("ICONS.CHANNEL.THREAD_CHANNEL")
+                                                                      } ${t.name}`
                                                               )
                                                               .join("\n") + "\n"
                                                       );
@@ -136,9 +102,7 @@
                     new MessageSelectMenu()
                         .setOptions(
                             channels.map((c, index) => ({
-                                label: c[0].parent
-                                    ? c[0].parent.name
-                                    : "Uncategorised",
+                                label: c[0].parent ? c[0].parent.name : "Uncategorised",
                                 value: index.toString(),
                                 default: page === index
                             }))
@@ -195,8 +159,7 @@
 
 const check = (interaction: CommandInteraction) => {
     const member = interaction.member as GuildMember;
-    if (!member.permissions.has("MANAGE_ROLES"))
-        throw "You do not have the *Manage Roles* permission";
+    if (!member.permissions.has("MANAGE_ROLES")) throw "You do not have the *Manage Roles* permission";
     return true;
 };
 
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 91c876e..5e321d0 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -1,33 +1,18 @@
-import Discord, {
-    CommandInteraction,
-    GuildMember,
-    MessageActionRow,
-    MessageButton
-} from "discord.js";
+import Discord, { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import keyValueList from "../../utils/generateKeyValueList.js";
-import {
-    create,
-    areTicketsEnabled
-} from "../../actions/createModActionTicket.js";
+import { create, areTicketsEnabled } from "../../actions/createModActionTicket.js";
 import client from "../../utils/client.js";
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
     builder
         .setName("warn")
         .setDescription("Warns a user")
-        .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription("The user to warn")
-                .setRequired(true)
-        );
+        .addUserOption((option) => option.setName("user").setDescription("The user to warn").setRequired(true));
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     const { log, NucleusColors, renderUser, entry } = client.logger;
     // TODO:[Modals] Replace this with a modal
     let reason = null;
@@ -41,15 +26,10 @@
             .setDescription(
                 keyValueList({
                     user: renderUser(interaction.options.getUser("user")),
-                    reason: reason
-                        ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ")
-                        : "*No reason provided*"
+                    reason: reason ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ") : "*No reason provided*"
                 }) +
                     `The user **will${notify ? "" : " not"}** be notified\n\n` +
-                    `Are you sure you want to warn <@!${
-                        (interaction.options.getMember("user") as GuildMember)
-                            .id
-                    }>?`
+                    `Are you sure you want to warn <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
             )
             .setColor("Danger")
             .addCustomBoolean(
@@ -57,12 +37,7 @@
                 "Create appeal ticket",
                 !(await areTicketsEnabled(interaction.guild.id)),
                 async () =>
-                    await create(
-                        interaction.guild,
-                        interaction.options.getUser("user"),
-                        interaction.user,
-                        reason
-                    ),
+                    await create(interaction.guild, interaction.options.getUser("user"), interaction.user, reason),
                 "An appeal ticket will be created when Confirm is clicked",
                 "CONTROL.TICKET",
                 createAppealTicket
@@ -91,12 +66,8 @@
         let dmd = false;
         try {
             if (notify) {
-                const config = await client.database.guilds.read(
-                    interaction.guild.id
-                );
-                await (
-                    interaction.options.getMember("user") as GuildMember
-                ).send({
+                const config = await client.database.guilds.read(interaction.guild.id);
+                await (interaction.options.getMember("user") as GuildMember).send({
                     embeds: [
                         new EmojiEmbed()
                             .setEmoji("PUNISH.WARN.RED")
@@ -145,17 +116,10 @@
             },
             list: {
                 user: entry(
-                    (interaction.options.getMember("user") as GuildMember).user
-                        .id,
-                    renderUser(
-                        (interaction.options.getMember("user") as GuildMember)
-                            .user
-                    )
+                    (interaction.options.getMember("user") as GuildMember).user.id,
+                    renderUser((interaction.options.getMember("user") as GuildMember).user)
                 ),
-                warnedBy: entry(
-                    interaction.member.user.id,
-                    renderUser(interaction.member.user)
-                ),
+                warnedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)),
                 reason: reason ? `\n> ${reason}` : "No reason provided"
             },
             hidden: {
@@ -188,9 +152,7 @@
                 components: []
             });
         } else {
-            const canSeeChannel = (
-                interaction.options.getMember("user") as GuildMember
-            )
+            const canSeeChannel = (interaction.options.getMember("user") as GuildMember)
                 .permissionsIn(interaction.channel as Discord.TextChannel)
                 .has("VIEW_CHANNEL");
             const m = (await interaction.editReply({
@@ -198,17 +160,12 @@
                     new EmojiEmbed()
                         .setEmoji("PUNISH.WARN.RED")
                         .setTitle("Warn")
-                        .setDescription(
-                            "The user's DMs are not open\n\nWhat would you like to do?"
-                        )
+                        .setDescription("The user's DMs are not open\n\nWhat would you like to do?")
                         .setStatus("Danger")
                 ],
                 components: [
                     new MessageActionRow().addComponents([
-                        new Discord.MessageButton()
-                            .setCustomId("log")
-                            .setLabel("Ignore and log")
-                            .setStyle("SECONDARY"),
+                        new Discord.MessageButton().setCustomId("log").setLabel("Ignore and log").setStyle("SECONDARY"),
                         new Discord.MessageButton()
                             .setCustomId("here")
                             .setLabel("Warn here")
@@ -245,24 +202,12 @@
                         new EmojiEmbed()
                             .setEmoji("PUNISH.WARN.RED")
                             .setTitle("Warn")
-                            .setDescription(
-                                "You have been warned" +
-                                    (reason ? ` for:\n> ${reason}` : ".")
-                            )
+                            .setDescription("You have been warned" + (reason ? ` for:\n> ${reason}` : "."))
                             .setStatus("Danger")
                     ],
-                    content: `<@!${
-                        (interaction.options.getMember("user") as GuildMember)
-                            .id
-                    }>`,
+                    content: `<@!${(interaction.options.getMember("user") as GuildMember).id}>`,
                     allowedMentions: {
-                        users: [
-                            (
-                                interaction.options.getMember(
-                                    "user"
-                                ) as GuildMember
-                            ).id
-                        ]
+                        users: [(interaction.options.getMember("user") as GuildMember).id]
                     }
                 });
                 return await interaction.editReply({
@@ -316,9 +261,7 @@
                         new EmojiEmbed()
                             .setEmoji("PUNISH.WARN.GREEN")
                             .setTitle("Warn")
-                            .setDescription(
-                                `A ticket was created in <#${ticketChannel}>`
-                            )
+                            .setDescription(`A ticket was created in <#${ticketChannel}>`)
                             .setStatus("Success")
                     ],
                     components: []
@@ -343,8 +286,7 @@
     const member = interaction.member as GuildMember;
     const me = interaction.guild.me!;
     const apply = interaction.options.getMember("user") as GuildMember;
-    if (member === null || me === null || apply === null)
-        throw "That member is not in the server";
+    if (member === null || me === null || apply === null) throw "That member is not in the server";
     const memberPos = member.roles ? member.roles.highest.position : 0;
     const applyPos = apply.roles ? apply.roles.highest.position : 0;
     // Do not allow warning bots
@@ -352,11 +294,9 @@
     // Allow the owner to warn anyone
     if (member.id === interaction.guild.ownerId) return true;
     // Check if the user has moderate_members permission
-    if (!member.permissions.has("MODERATE_MEMBERS"))
-        throw "You do not have the *Moderate Members* permission";
+    if (!member.permissions.has("MODERATE_MEMBERS")) throw "You do not have the *Moderate Members* permission";
     // Check if the user is below on the role list
-    if (!(memberPos > applyPos))
-        throw "You do not have a role higher than that member";
+    if (!(memberPos > applyPos)) throw "You do not have a role higher than that member";
     // Allow warn
     return true;
 };
diff --git a/src/commands/nucleus/guide.ts b/src/commands/nucleus/guide.ts
index b9df446..ffc441a 100644
--- a/src/commands/nucleus/guide.ts
+++ b/src/commands/nucleus/guide.ts
@@ -2,9 +2,7 @@
 import guide from "../../reflex/guide.js";
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
-    builder
-        .setName("guide")
-        .setDescription("Shows the welcome guide for the bot");
+    builder.setName("guide").setDescription("Shows the welcome guide for the bot");
 
 const callback = async (interaction) => {
     guide(interaction.guild, interaction);
diff --git a/src/commands/nucleus/invite.ts b/src/commands/nucleus/invite.ts
index 8ae8c1a..341f7d2 100644
--- a/src/commands/nucleus/invite.ts
+++ b/src/commands/nucleus/invite.ts
@@ -1,8 +1,4 @@
-import {
-    CommandInteraction,
-    MessageActionRow,
-    MessageButton
-} from "discord.js";
+import { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import client from "../../utils/client.js";
@@ -15,9 +11,7 @@
         embeds: [
             new EmojiEmbed()
                 .setTitle("Invite")
-                .setDescription(
-                    "You can invite Nucleus to your server by clicking the button below"
-                )
+                .setDescription("You can invite Nucleus to your server by clicking the button below")
                 .setEmoji("NUCLEUS.LOGO")
                 .setStatus("Danger")
         ],
diff --git a/src/commands/nucleus/ping.ts b/src/commands/nucleus/ping.ts
index 105cda5..59b6393 100644
--- a/src/commands/nucleus/ping.ts
+++ b/src/commands/nucleus/ping.ts
@@ -20,9 +20,7 @@
                 .setDescription(
                     `**Ping:** \`${ping}ms\`\n` +
                         `**To Discord:** \`${client.ws.ping}ms\`\n` +
-                        `**From Expected:** \`±${Math.abs(
-                            ping / 2 - client.ws.ping
-                        )}ms\``
+                        `**From Expected:** \`±${Math.abs(ping / 2 - client.ws.ping)}ms\``
                 )
                 .setEmoji("CHANNEL.SLOWMODE.OFF")
                 .setStatus("Danger")
diff --git a/src/commands/nucleus/premium.ts b/src/commands/nucleus/premium.ts
index 83ba327..9bbc36e 100644
--- a/src/commands/nucleus/premium.ts
+++ b/src/commands/nucleus/premium.ts
@@ -3,9 +3,7 @@
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
-    builder
-        .setName("premium")
-        .setDescription("Information about Nucleus Premium");
+    builder.setName("premium").setDescription("Information about Nucleus Premium");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     interaction.reply({
diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts
index 68eeaa9..a67cd36 100644
--- a/src/commands/nucleus/stats.ts
+++ b/src/commands/nucleus/stats.ts
@@ -11,10 +11,7 @@
         embeds: [
             new EmojiEmbed()
                 .setTitle("Stats")
-                .setDescription(
-                    `**Servers:** ${client.guilds.cache.size}\n` +
-                        `**Ping:** \`${client.ws.ping * 2}ms\``
-                )
+                .setDescription(`**Servers:** ${client.guilds.cache.size}\n` + `**Ping:** \`${client.ws.ping * 2}ms\``)
                 .setStatus("Success")
                 .setEmoji("GUILD.GRAPHS")
         ],
diff --git a/src/commands/nucleus/suggest.ts b/src/commands/nucleus/suggest.ts
index 0f40501..bdd55af 100644
--- a/src/commands/nucleus/suggest.ts
+++ b/src/commands/nucleus/suggest.ts
@@ -10,10 +10,7 @@
         .setName("suggest")
         .setDescription("Sends a suggestion to the developers")
         .addStringOption((option) =>
-            option
-                .setName("suggestion")
-                .setDescription("The suggestion to send")
-                .setRequired(true)
+            option.setName("suggestion").setDescription("The suggestion to send").setRequired(true)
         );
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
@@ -31,18 +28,12 @@
         .send();
     if (confirmation.cancelled) return;
     if (confirmation.success) {
-        await (
-            client.channels.cache.get(
-                "955161206459600976"
-            ) as Discord.TextChannel
-        ).send({
+        await (client.channels.cache.get("955161206459600976") as Discord.TextChannel).send({
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Suggestion")
                     .setDescription(
-                        `**From:** ${renderUser(
-                            interaction.member.user
-                        )}\n**Suggestion:**\n> ${suggestion}`
+                        `**From:** ${renderUser(interaction.member.user)}\n**Suggestion:**\n> ${suggestion}`
                     )
                     .setStatus("Danger")
                     .setEmoji("NUCLEUS.LOGO")
@@ -72,10 +63,7 @@
     }
 };
 
-const check = (
-    _interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     return true;
 };
 
diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts
index 3c36ea1..7903666 100644
--- a/src/commands/privacy.ts
+++ b/src/commands/privacy.ts
@@ -1,9 +1,5 @@
 import { LoadingEmbed } from "./../utils/defaultEmbeds.js";
-import Discord, {
-    CommandInteraction,
-    MessageActionRow,
-    MessageButton
-} from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
 import { SelectMenuOption, SlashCommandBuilder } from "@discordjs/builders";
 import { WrappedCheck } from "jshaiku";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
@@ -14,9 +10,7 @@
 
 const command = new SlashCommandBuilder()
     .setName("privacy")
-    .setDescription(
-        "Information and options for you and your server's settings"
-    );
+    .setDescription("Information and options for you and your server's settings");
 
 class Embed {
     embed: Discord.MessageEmbed;
@@ -91,22 +85,16 @@
                     .setStatus("Danger")
             )
             .setTitle("Link scanning and Transcripts")
-            .setDescription(
-                "Regarding Facebook and AMP filter types, and ticket transcripts"
-            )
+            .setDescription("Regarding Facebook and AMP filter types, and ticket transcripts")
             .setPageId(2)
     ].concat(
-        (interaction.member as Discord.GuildMember).permissions.has(
-            "ADMINISTRATOR"
-        )
+        (interaction.member as Discord.GuildMember).permissions.has("ADMINISTRATOR")
             ? [
                   new Embed()
                       .setEmbed(
                           new EmojiEmbed()
                               .setTitle("Options")
-                              .setDescription(
-                                  "Below are buttons for controlling this servers privacy settings"
-                              )
+                              .setDescription("Below are buttons for controlling this servers privacy settings")
                               .setEmoji("NUCLEUS.LOGO")
                               .setStatus("Danger")
                       )
@@ -178,9 +166,7 @@
             ])
         ]);
         const em = new Discord.MessageEmbed(pages[page].embed);
-        em.setDescription(
-            em.description + "\n\n" + createPageIndicator(pages.length, page)
-        );
+        em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
         em.setFooter({ text: nextFooter ?? "" });
         await interaction.editReply({
             embeds: [em],
@@ -229,20 +215,14 @@
             }
         } else {
             const em = new Discord.MessageEmbed(pages[page].embed);
-            em.setDescription(
-                em.description +
-                    "\n\n" +
-                    createPageIndicator(pages.length, page)
-            );
+            em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
             em.setFooter({ text: "Message closed" });
             interaction.editReply({ embeds: [em], components: [] });
             return;
         }
     }
     const em = new Discord.MessageEmbed(pages[page].embed);
-    em.setDescription(
-        em.description + "\n\n" + createPageIndicator(pages.length, page)
-    );
+    em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
     em.setFooter({ text: "Message timed out" });
     await interaction.editReply({
         embeds: [em],
@@ -250,10 +230,7 @@
     });
 };
 
-const check = (
-    _interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     return true;
 };
 
diff --git a/src/commands/role/user.ts b/src/commands/role/user.ts
index 2557b4b..3b3eb79 100644
--- a/src/commands/role/user.ts
+++ b/src/commands/role/user.ts
@@ -11,16 +11,10 @@
         .setName("user")
         .setDescription("Gives or removes a role from someone")
         .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription("The member to give or remove the role from")
-                .setRequired(true)
+            option.setName("user").setDescription("The member to give or remove the role from").setRequired(true)
         )
         .addRoleOption((option) =>
-            option
-                .setName("role")
-                .setDescription("The role to give or remove")
-                .setRequired(true)
+            option.setName("role").setDescription("The role to give or remove").setRequired(true)
         )
         .addStringOption((option) =>
             option
@@ -33,9 +27,7 @@
                 ])
         );
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     const { renderUser, renderRole } = client.logger;
     const action = interaction.options.getString("action");
     // TODO:[Modals] Replace this with a modal
@@ -48,9 +40,7 @@
                 role: renderRole(interaction.options.getRole("role"))
             }) +
                 `\nAre you sure you want to ${
-                    action === "give"
-                        ? "give the role to"
-                        : "remove the role from"
+                    action === "give" ? "give the role to" : "remove the role from"
                 } ${interaction.options.getUser("user")}?`
         )
         .setColor("Danger")
@@ -70,9 +60,7 @@
                 embeds: [
                     new EmojiEmbed()
                         .setTitle("Role")
-                        .setDescription(
-                            "Something went wrong and the role could not be added"
-                        )
+                        .setDescription("Something went wrong and the role could not be added")
                         .setStatus("Danger")
                         .setEmoji("CONTROL.BLOCKCROSS")
                 ],
@@ -83,11 +71,7 @@
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Role")
-                    .setDescription(
-                        `The role has been ${
-                            action === "give" ? "given" : "removed"
-                        } successfully`
-                    )
+                    .setDescription(`The role has been ${action === "give" ? "given" : "removed"} successfully`)
                     .setStatus("Success")
                     .setEmoji("GUILD.ROLES.CREATE")
             ],
@@ -107,23 +91,17 @@
     }
 };
 
-const check = (
-    interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     const member = interaction.member as GuildMember;
     const me = interaction.guild.me!;
     const apply = interaction.options.getMember("user") as GuildMember;
-    if (member === null || me === null || apply === null)
-        throw "That member is not in the server";
+    if (member === null || me === null || apply === null) throw "That member is not in the server";
     // Check if Nucleus has permission to role
-    if (!me.permissions.has("MANAGE_ROLES"))
-        throw "I do not have the *Manage Roles* permission";
+    if (!me.permissions.has("MANAGE_ROLES")) throw "I do not have the *Manage Roles* permission";
     // Allow the owner to role anyone
     if (member.id === interaction.guild.ownerId) return true;
     // Check if the user has manage_roles permission
-    if (!member.permissions.has("MANAGE_ROLES"))
-        throw "You do not have the *Manage Roles* permission";
+    if (!member.permissions.has("MANAGE_ROLES")) throw "You do not have the *Manage Roles* permission";
     // Allow role
     return true;
 };
diff --git a/src/commands/rolemenu.ts b/src/commands/rolemenu.ts
index 8566966..dd3cb34 100644
--- a/src/commands/rolemenu.ts
+++ b/src/commands/rolemenu.ts
@@ -11,10 +11,7 @@
     await roleMenu(interaction);
 };
 
-const check = (
-    _interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     return true;
 };
 
diff --git a/src/commands/server/about.ts b/src/commands/server/about.ts
index 0a1cc6f..4465be5 100644
--- a/src/commands/server/about.ts
+++ b/src/commands/server/about.ts
@@ -3,9 +3,7 @@
 import { WrappedCheck } from "jshaiku";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
-import generateKeyValueList, {
-    toCapitals
-} from "../../utils/generateKeyValueList.js";
+import generateKeyValueList, { toCapitals } from "../../utils/generateKeyValueList.js";
 import client from "../../utils/client.js";
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -31,18 +29,9 @@
                             (guild.emojis.cache.size > 1
                                 ? `\n> ${guild.emojis.cache
                                       .first(10)
-                                      .map(
-                                          (emoji) =>
-                                              `<${emoji.animated ? "a" : ""}:${
-                                                  emoji.name
-                                              }:${emoji.id}>`
-                                      )
+                                      .map((emoji) => `<${emoji.animated ? "a" : ""}:${emoji.name}:${emoji.id}>`)
                                       .join(" ")}` +
-                                  (guild.emojis.cache.size > 10
-                                      ? ` and ${
-                                            guild.emojis.cache.size - 10
-                                        } more`
-                                      : "")
+                                  (guild.emojis.cache.size > 10 ? ` and ${guild.emojis.cache.size - 10} more` : "")
                                 : ""),
                         icon: `[Discord](${guild.iconURL()})`,
                         "2 factor authentication": `${
@@ -50,19 +39,11 @@
                                 ? `${getEmojiByName("CONTROL.CROSS")} No`
                                 : `${getEmojiByName("CONTROL.TICK")} Yes`
                         }`,
-                        "verification level": `${toCapitals(
-                            guild.verificationLevel
-                        )}`,
+                        "verification level": `${toCapitals(guild.verificationLevel)}`,
                         "explicit content filter": `${toCapitals(
-                            guild.explicitContentFilter
-                                .toString()
-                                .replace(/_/, " ")
+                            guild.explicitContentFilter.toString().replace(/_/, " ")
                         )}`,
-                        "nitro boost level": `${
-                            guild.premiumTier !== "NONE"
-                                ? guild.premiumTier.toString()[-1]
-                                : "0"
-                        }`,
+                        "nitro boost level": `${guild.premiumTier !== "NONE" ? guild.premiumTier.toString()[-1] : "0"}`,
                         channels: `${guild.channels.cache.size}`,
                         roles: `${guild.roles.cache.size}`,
                         members: `${guild.memberCount}`
@@ -74,10 +55,7 @@
     });
 };
 
-const check = (
-    _interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     return true;
 };
 
diff --git a/src/commands/settings/commands.ts b/src/commands/settings/commands.ts
index 13cfa89..19a13e3 100644
--- a/src/commands/settings/commands.ts
+++ b/src/commands/settings/commands.ts
@@ -1,10 +1,5 @@
 import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, {
-    CommandInteraction,
-    MessageActionRow,
-    MessageButton,
-    TextInputComponent
-} from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton, TextInputComponent } from "discord.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
@@ -17,18 +12,10 @@
 const command = (builder: SlashCommandSubcommandBuilder) =>
     builder
         .setName("commands")
-        .setDescription(
-            "Links and text shown to a user after a moderator action is performed"
-        )
-        .addRoleOption((o) =>
-            o
-                .setName("role")
-                .setDescription("The role given when a member is muted")
-        );
+        .setDescription("Links and text shown to a user after a moderator action is performed")
+        .addRoleOption((o) => o.setName("role").setDescription("The role given when a member is muted"));
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     await interaction.reply({
         embeds: LoadingEmbed,
         ephemeral: true,
@@ -75,9 +62,7 @@
                     .setDescription(
                         "These links are shown below the message sent in a user's DM when they are punished.\n\n" +
                             "**Mute Role:** " +
-                            (moderation.mute.role
-                                ? `<@&${moderation.mute.role}>`
-                                : "*None set*")
+                            (moderation.mute.role ? `<@&${moderation.mute.role}>` : "*None set*")
                     )
             ],
             components: [
@@ -117,35 +102,16 @@
                 ]),
                 new MessageActionRow().addComponents([
                     new MessageButton()
-                        .setLabel(
-                            clicked === "clearMuteRole"
-                                ? "Click again to confirm"
-                                : "Clear mute role"
-                        )
+                        .setLabel(clicked === "clearMuteRole" ? "Click again to confirm" : "Clear mute role")
                         .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
                         .setCustomId("clearMuteRole")
                         .setStyle("DANGER")
                         .setDisabled(!moderation.mute.role),
                     new MessageButton()
                         .setCustomId("timeout")
-                        .setLabel(
-                            "Mute timeout " +
-                                (moderation.mute.timeout
-                                    ? "Enabled"
-                                    : "Disabled")
-                        )
-                        .setStyle(
-                            moderation.mute.timeout ? "SUCCESS" : "DANGER"
-                        )
-                        .setEmoji(
-                            getEmojiByName(
-                                "CONTROL." +
-                                    (moderation.mute.timeout
-                                        ? "TICK"
-                                        : "CROSS"),
-                                "id"
-                            )
-                        )
+                        .setLabel("Mute timeout " + (moderation.mute.timeout ? "Enabled" : "Disabled"))
+                        .setStyle(moderation.mute.timeout ? "SUCCESS" : "DANGER")
+                        .setEmoji(getEmojiByName("CONTROL." + (moderation.mute.timeout ? "TICK" : "CROSS"), "id"))
                 ])
             ]
         });
@@ -193,9 +159,7 @@
                         new MessageActionRow<TextInputComponent>().addComponents(
                             new TextInputComponent()
                                 .setCustomId("url")
-                                .setLabel(
-                                    "URL - Type {id} to insert the user's ID"
-                                )
+                                .setLabel("URL - Type {id} to insert the user's ID")
                                 .setMaxLength(2000)
                                 .setRequired(false)
                                 .setStyle("SHORT")
@@ -207,9 +171,7 @@
                 embeds: [
                     new EmojiEmbed()
                         .setTitle("Moderation Links")
-                        .setDescription(
-                            "Modal opened. If you can't see it, click back and try again."
-                        )
+                        .setDescription("Modal opened. If you can't see it, click back and try again.")
                         .setStatus("Success")
                         .setEmoji("GUILD.TICKET.OPEN")
                 ],
@@ -235,14 +197,9 @@
             }
             if (out.fields) {
                 const buttonText = out.fields.getTextInputValue("name");
-                const buttonLink = out.fields
-                    .getTextInputValue("url")
-                    .replace(/{id}/gi, "{id}");
+                const buttonLink = out.fields.getTextInputValue("url").replace(/{id}/gi, "{id}");
                 const current = chosen;
-                if (
-                    current.text !== buttonText ||
-                    current.link !== buttonLink
-                ) {
+                if (current.text !== buttonText || current.link !== buttonLink) {
                     chosen = { text: buttonText, link: buttonLink };
                     await client.database.guilds.write(interaction.guild.id, {
                         ["moderation." + i.customId]: {
@@ -258,10 +215,7 @@
     }
 };
 
-const check = (
-    interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     const member = interaction.member as Discord.GuildMember;
     if (!member.permissions.has("MANAGE_GUILD"))
         throw "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/settings/logs/attachment.ts b/src/commands/settings/logs/attachment.ts
index ea8aa51..8e72651 100644
--- a/src/commands/settings/logs/attachment.ts
+++ b/src/commands/settings/logs/attachment.ts
@@ -1,10 +1,6 @@
 import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
 import { ChannelType } from "discord-api-types/v9";
-import Discord, {
-    CommandInteraction,
-    MessageActionRow,
-    MessageButton
-} from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
 import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
 import confirmationMessage from "../../../utils/confirmationMessage.js";
 import getEmojiByName from "../../../utils/getEmojiByName.js";
@@ -24,9 +20,7 @@
                 .setRequired(false)
         );
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     const m = (await interaction.reply({
         embeds: LoadingEmbed,
         ephemeral: true,
@@ -42,9 +36,7 @@
                     new EmojiEmbed()
                         .setEmoji("CHANNEL.TEXT.DELETE")
                         .setTitle("Attachment Log Channel")
-                        .setDescription(
-                            "The channel you provided is not a valid channel"
-                        )
+                        .setDescription("The channel you provided is not a valid channel")
                         .setStatus("Danger")
                 ]
             });
@@ -55,9 +47,7 @@
                 embeds: [
                     new EmojiEmbed()
                         .setTitle("Attachment Log Channel")
-                        .setDescription(
-                            "You must choose a channel in this server"
-                        )
+                        .setDescription("You must choose a channel in this server")
                         .setStatus("Danger")
                         .setEmoji("CHANNEL.TEXT.DELETE")
                 ]
@@ -79,8 +69,7 @@
                 await client.database.guilds.write(interaction.guild.id, {
                     "logging.attachments.channel": channel.id
                 });
-                const { log, NucleusColors, entry, renderUser, renderChannel } =
-                    client.logger;
+                const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
                 const data = {
                     meta: {
                         type: "attachmentChannelUpdate",
@@ -91,14 +80,8 @@
                         timestamp: new Date().getTime()
                     },
                     list: {
-                        memberId: entry(
-                            interaction.user.id,
-                            `\`${interaction.user.id}\``
-                        ),
-                        changedBy: entry(
-                            interaction.user.id,
-                            renderUser(interaction.user)
-                        ),
+                        memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+                        changedBy: entry(interaction.user.id, renderUser(interaction.user)),
                         channel: entry(channel.id, renderChannel(channel))
                     },
                     hidden: {
@@ -111,9 +94,7 @@
                     embeds: [
                         new EmojiEmbed()
                             .setTitle("Attachment Log Channel")
-                            .setDescription(
-                                "Something went wrong and the attachment log channel could not be set"
-                            )
+                            .setDescription("Something went wrong and the attachment log channel could not be set")
                             .setStatus("Danger")
                             .setEmoji("CHANNEL.TEXT.DELETE")
                     ],
@@ -145,9 +126,7 @@
                         channel
                             ? `Your attachment log channel is currently set to <#${channel}>`
                             : "This server does not have an attachment log channel" +
-                                  (client.database.premium.hasPremium(
-                                      interaction.guild.id
-                                  )
+                                  (client.database.premium.hasPremium(interaction.guild.id)
                                       ? ""
                                       : "\n\nThis server does not have premium, so this feature is disabled")
                     )
@@ -158,15 +137,8 @@
                 new MessageActionRow().addComponents([
                     new MessageButton()
                         .setCustomId("clear")
-                        .setLabel(
-                            clicks ? "Click again to confirm" : "Reset channel"
-                        )
-                        .setEmoji(
-                            getEmojiByName(
-                                clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS",
-                                "id"
-                            )
-                        )
+                        .setLabel(clicks ? "Click again to confirm" : "Reset channel")
+                        .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
                         .setStyle("DANGER")
                         .setDisabled(!channel)
                 ])
@@ -183,9 +155,7 @@
             clicks += 1;
             if (clicks === 2) {
                 clicks = 0;
-                await client.database.guilds.write(interaction.guild.id, null, [
-                    "logging.announcements.channel"
-                ]);
+                await client.database.guilds.write(interaction.guild.id, null, ["logging.announcements.channel"]);
                 channel = undefined;
             }
         } else {
@@ -218,10 +188,7 @@
     });
 };
 
-const check = (
-    interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     const member = interaction.member as Discord.GuildMember;
     if (!member.permissions.has("MANAGE_GUILD"))
         throw "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/settings/logs/channel.ts b/src/commands/settings/logs/channel.ts
index fd64424..21437b2 100644
--- a/src/commands/settings/logs/channel.ts
+++ b/src/commands/settings/logs/channel.ts
@@ -1,10 +1,6 @@
 import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
 import { ChannelType } from "discord-api-types/v9";
-import Discord, {
-    CommandInteraction,
-    MessageActionRow,
-    MessageButton
-} from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
 import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
 import confirmationMessage from "../../../utils/confirmationMessage.js";
 import getEmojiByName from "../../../utils/getEmojiByName.js";
@@ -23,9 +19,7 @@
                 .addChannelTypes([ChannelType.GuildNews, ChannelType.GuildText])
         );
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     const m = (await interaction.reply({
         embeds: LoadingEmbed,
         ephemeral: true,
@@ -41,9 +35,7 @@
                     new EmojiEmbed()
                         .setEmoji("CHANNEL.TEXT.DELETE")
                         .setTitle("Log Channel")
-                        .setDescription(
-                            "The channel you provided is not a valid channel"
-                        )
+                        .setDescription("The channel you provided is not a valid channel")
                         .setStatus("Danger")
                 ]
             });
@@ -54,9 +46,7 @@
                 embeds: [
                     new EmojiEmbed()
                         .setTitle("Log Channel")
-                        .setDescription(
-                            "You must choose a channel in this server"
-                        )
+                        .setDescription("You must choose a channel in this server")
                         .setStatus("Danger")
                         .setEmoji("CHANNEL.TEXT.DELETE")
                 ]
@@ -65,9 +55,7 @@
         const confirmation = await new confirmationMessage(interaction)
             .setEmoji("CHANNEL.TEXT.EDIT")
             .setTitle("Log Channel")
-            .setDescription(
-                `Are you sure you want to set the log channel to <#${channel.id}>?`
-            )
+            .setDescription(`Are you sure you want to set the log channel to <#${channel.id}>?`)
             .setColor("Warning")
             .setInverted(true)
             .send(true);
@@ -77,8 +65,7 @@
                 await client.database.guilds.write(interaction.guild.id, {
                     "logging.logs.channel": channel.id
                 });
-                const { log, NucleusColors, entry, renderUser, renderChannel } =
-                    client.logger;
+                const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
                 const data = {
                     meta: {
                         type: "logChannelUpdate",
@@ -89,14 +76,8 @@
                         timestamp: new Date().getTime()
                     },
                     list: {
-                        memberId: entry(
-                            interaction.user.id,
-                            `\`${interaction.user.id}\``
-                        ),
-                        changedBy: entry(
-                            interaction.user.id,
-                            renderUser(interaction.user)
-                        ),
+                        memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+                        changedBy: entry(interaction.user.id, renderUser(interaction.user)),
                         channel: entry(channel.id, renderChannel(channel))
                     },
                     hidden: {
@@ -110,9 +91,7 @@
                     embeds: [
                         new EmojiEmbed()
                             .setTitle("Log Channel")
-                            .setDescription(
-                                "Something went wrong and the log channel could not be set"
-                            )
+                            .setDescription("Something went wrong and the log channel could not be set")
                             .setStatus("Danger")
                             .setEmoji("CHANNEL.TEXT.DELETE")
                     ],
@@ -152,15 +131,8 @@
                 new MessageActionRow().addComponents([
                     new MessageButton()
                         .setCustomId("clear")
-                        .setLabel(
-                            clicks ? "Click again to confirm" : "Reset channel"
-                        )
-                        .setEmoji(
-                            getEmojiByName(
-                                clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS",
-                                "id"
-                            )
-                        )
+                        .setLabel(clicks ? "Click again to confirm" : "Reset channel")
+                        .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
                         .setStyle("DANGER")
                         .setDisabled(!channel)
                 ])
@@ -177,9 +149,7 @@
             clicks += 1;
             if (clicks === 2) {
                 clicks = 0;
-                await client.database.guilds.write(interaction.guild.id, null, [
-                    "logging.logs.channel"
-                ]);
+                await client.database.guilds.write(interaction.guild.id, null, ["logging.logs.channel"]);
                 channel = undefined;
             }
         } else {
@@ -212,10 +182,7 @@
     });
 };
 
-const check = (
-    interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     const member = interaction.member as Discord.GuildMember;
     if (!member.permissions.has("MANAGE_GUILD"))
         throw "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/settings/logs/events.ts b/src/commands/settings/logs/events.ts
index a1edcaf..a2dcc63 100644
--- a/src/commands/settings/logs/events.ts
+++ b/src/commands/settings/logs/events.ts
@@ -1,10 +1,5 @@
 import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
-import Discord, {
-    CommandInteraction,
-    MessageActionRow,
-    MessageButton,
-    MessageSelectMenu
-} from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import { WrappedCheck } from "jshaiku";
 import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
@@ -35,9 +30,7 @@
 };
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
-    builder
-        .setName("events")
-        .setDescription("Sets what events should be logged");
+    builder.setName("events").setDescription("Sets what events should be logged");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     await interaction.reply({
@@ -75,14 +68,8 @@
                         )
                 ]),
                 new MessageActionRow().addComponents([
-                    new MessageButton()
-                        .setLabel("Select all")
-                        .setStyle("PRIMARY")
-                        .setCustomId("all"),
-                    new MessageButton()
-                        .setLabel("Select none")
-                        .setStyle("DANGER")
-                        .setCustomId("none")
+                    new MessageButton().setLabel("Select all").setStyle("PRIMARY").setCustomId("all"),
+                    new MessageButton().setLabel("Select none").setStyle("DANGER").setCustomId("none")
                 ])
             ]
         });
@@ -95,9 +82,7 @@
         i.deferUpdate();
         if (i.customId === "logs") {
             const selected = i.values;
-            const newLogs = toHexInteger(
-                selected.map((e) => Object.keys(logs)[parseInt(e)])
-            );
+            const newLogs = toHexInteger(selected.map((e) => Object.keys(logs)[parseInt(e)]));
             await client.database.guilds.write(interaction.guild.id, {
                 "logging.logs.toLog": newLogs
             });
@@ -129,10 +114,7 @@
     return;
 };
 
-const check = (
-    interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     const member = interaction.member as Discord.GuildMember;
     if (!member.permissions.has("MANAGE_GUILD"))
         throw "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/settings/logs/staff.ts b/src/commands/settings/logs/staff.ts
index a0df97c..8450bbb 100644
--- a/src/commands/settings/logs/staff.ts
+++ b/src/commands/settings/logs/staff.ts
@@ -1,10 +1,6 @@
 import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
 import { ChannelType } from "discord-api-types/v9";
-import Discord, {
-    CommandInteraction,
-    MessageActionRow,
-    MessageButton
-} from "discord.js";
+import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
 import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
 import confirmationMessage from "../../../utils/confirmationMessage.js";
 import getEmojiByName from "../../../utils/getEmojiByName.js";
@@ -20,16 +16,12 @@
         .addChannelOption((option) =>
             option
                 .setName("channel")
-                .setDescription(
-                    "The channel to set the staff notifications channel to"
-                )
+                .setDescription("The channel to set the staff notifications channel to")
                 .addChannelTypes([ChannelType.GuildNews, ChannelType.GuildText])
                 .setRequired(false)
         );
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<unknown | void> => {
+const callback = async (interaction: CommandInteraction): Promise<unknown | void> => {
     if (!interaction.guild) return;
     const m = (await interaction.reply({
         embeds: LoadingEmbed,
@@ -46,9 +38,7 @@
                     new EmojiEmbed()
                         .setEmoji("CHANNEL.TEXT.DELETE")
                         .setTitle("Staff Notifications Channel")
-                        .setDescription(
-                            "The channel you provided is not a valid channel"
-                        )
+                        .setDescription("The channel you provided is not a valid channel")
                         .setStatus("Danger")
                 ]
             });
@@ -59,9 +49,7 @@
                 embeds: [
                     new EmojiEmbed()
                         .setTitle("Staff Notifications Channel")
-                        .setDescription(
-                            "You must choose a channel in this server"
-                        )
+                        .setDescription("You must choose a channel in this server")
                         .setStatus("Danger")
                         .setEmoji("CHANNEL.TEXT.DELETE")
                 ]
@@ -83,8 +71,7 @@
                 await client.database.guilds.write(interaction.guild.id, {
                     "logging.staff.channel": channel.id
                 });
-                const { log, NucleusColors, entry, renderUser, renderChannel } =
-                    client.logger;
+                const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
                 const data = {
                     meta: {
                         type: "staffChannelUpdate",
@@ -95,14 +82,8 @@
                         timestamp: new Date().getTime()
                     },
                     list: {
-                        memberId: entry(
-                            interaction.user.id,
-                            `\`${interaction.user.id}\``
-                        ),
-                        changedBy: entry(
-                            interaction.user.id,
-                            renderUser(interaction.user)
-                        ),
+                        memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+                        changedBy: entry(interaction.user.id, renderUser(interaction.user)),
                         channel: entry(channel.id, renderChannel(channel))
                     },
                     hidden: {
@@ -115,9 +96,7 @@
                     embeds: [
                         new EmojiEmbed()
                             .setTitle("Staff Notifications Channel")
-                            .setDescription(
-                                "Something went wrong and the staff notifications channel could not be set"
-                            )
+                            .setDescription("Something went wrong and the staff notifications channel could not be set")
                             .setStatus("Danger")
                             .setEmoji("CHANNEL.TEXT.DELETE")
                     ],
@@ -157,15 +136,8 @@
                 new MessageActionRow().addComponents([
                     new MessageButton()
                         .setCustomId("clear")
-                        .setLabel(
-                            clicks ? "Click again to confirm" : "Reset channel"
-                        )
-                        .setEmoji(
-                            getEmojiByName(
-                                clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS",
-                                "id"
-                            )
-                        )
+                        .setLabel(clicks ? "Click again to confirm" : "Reset channel")
+                        .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
                         .setStyle("DANGER")
                         .setDisabled(!channel)
                 ])
@@ -182,9 +154,7 @@
             clicks += 1;
             if (clicks === 2) {
                 clicks = 0;
-                await client.database.guilds.write(interaction.guild.id, null, [
-                    "logging.staff.channel"
-                ]);
+                await client.database.guilds.write(interaction.guild.id, null, ["logging.staff.channel"]);
                 channel = undefined;
             }
         } else {
@@ -217,10 +187,7 @@
     });
 };
 
-const check = (
-    interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     const member = interaction.member as Discord.GuildMember;
     if (!member.permissions.has("MANAGE_GUILD"))
         throw "You must have the *Manage Server* permission to use this command";
diff --git a/src/commands/settings/rolemenu.ts b/src/commands/settings/rolemenu.ts
index beb2f35..93fe70d 100644
--- a/src/commands/settings/rolemenu.ts
+++ b/src/commands/settings/rolemenu.ts
@@ -6,21 +6,14 @@
     builder
         .setName("rolemenu")
         .setDescription("rolemenu") // TODO
-        .addRoleOption((option) =>
-            option
-                .setName("role")
-                .setDescription("The role to give after verifying")
-        ); // FIXME FOR FUCK SAKE
+        .addRoleOption((option) => option.setName("role").setDescription("The role to give after verifying")); // FIXME FOR FUCK SAKE
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     console.log("we changed the charger again because fuck you");
     await interaction.reply("You're mum");
 };
 
-const check = (
-    interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     const member = interaction.member as Discord.GuildMember;
     if (!member.permissions.has("MANAGE_ROLES"))
         throw "You must have the *Manage Roles* permission to use this command";
diff --git a/src/commands/settings/stats.ts b/src/commands/settings/stats.ts
index 507e506..08bf6f8 100644
--- a/src/commands/settings/stats.ts
+++ b/src/commands/settings/stats.ts
@@ -1,10 +1,5 @@
 import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, {
-    CommandInteraction,
-    Message,
-    MessageActionRow,
-    MessageSelectMenu
-} from "discord.js";
+import Discord, { CommandInteraction, Message, MessageActionRow, MessageSelectMenu } from "discord.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
@@ -17,24 +12,16 @@
 const command = (builder: SlashCommandSubcommandBuilder) =>
     builder
         .setName("stats")
-        .setDescription(
-            "Controls channels which update when someone joins or leaves the server"
-        )
-        .addChannelOption((option) =>
-            option.setName("channel").setDescription("The channel to modify")
-        )
+        .setDescription("Controls channels which update when someone joins or leaves the server")
+        .addChannelOption((option) => option.setName("channel").setDescription("The channel to modify"))
         .addStringOption((option) =>
             option
                 .setName("name")
-                .setDescription(
-                    "The new channel name | Enter any text or use the extra variables like {memberCount}"
-                )
+                .setDescription("The new channel name | Enter any text or use the extra variables like {memberCount}")
                 .setAutocomplete(true)
         );
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     singleNotify("statsChannelDeleted", interaction.guild.id, true);
     const m = (await interaction.reply({
         embeds: LoadingEmbed,
@@ -50,9 +37,7 @@
                     new EmojiEmbed()
                         .setEmoji("CHANNEL.TEXT.DELETE")
                         .setTitle("Stats Channel")
-                        .setDescription(
-                            "You can only have 25 stats channels in a server"
-                        )
+                        .setDescription("You can only have 25 stats channels in a server")
                         .setStatus("Danger")
                 ]
             });
@@ -65,9 +50,7 @@
                     new EmojiEmbed()
                         .setEmoji("CHANNEL.TEXT.DELETE")
                         .setTitle("Stats Channel")
-                        .setDescription(
-                            "The channel you provided is not a valid channel"
-                        )
+                        .setDescription("The channel you provided is not a valid channel")
                         .setStatus("Danger")
                 ]
             });
@@ -78,9 +61,7 @@
                 embeds: [
                     new EmojiEmbed()
                         .setTitle("Stats Channel")
-                        .setDescription(
-                            "You must choose a channel in this server"
-                        )
+                        .setDescription("You must choose a channel in this server")
                         .setStatus("Danger")
                         .setEmoji("CHANNEL.TEXT.DELETE")
                 ]
@@ -100,9 +81,7 @@
             .setEmoji("CHANNEL.TEXT.EDIT")
             .setTitle("Stats Channel")
             .setDescription(
-                `Are you sure you want to set <#${
-                    channel.id
-                }> to a stats channel?\n\n*Preview: ${newName.replace(
+                `Are you sure you want to set <#${channel.id}> to a stats channel?\n\n*Preview: ${newName.replace(
                     /^ +| $/g,
                     ""
                 )}*`
@@ -118,8 +97,7 @@
                 await client.database.guilds.write(interaction.guild.id, {
                     [`stats.${channel.id}`]: { name: name, enabled: true }
                 });
-                const { log, NucleusColors, entry, renderUser, renderChannel } =
-                    client.logger;
+                const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
                 const data = {
                     meta: {
                         type: "statsChannelUpdate",
@@ -130,14 +108,8 @@
                         timestamp: new Date().getTime()
                     },
                     list: {
-                        memberId: entry(
-                            interaction.user.id,
-                            `\`${interaction.user.id}\``
-                        ),
-                        changedBy: entry(
-                            interaction.user.id,
-                            renderUser(interaction.user)
-                        ),
+                        memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+                        changedBy: entry(interaction.user.id, renderUser(interaction.user)),
                         channel: entry(channel.id, renderChannel(channel)),
                         name: entry(
                             interaction.options.getString("name"),
@@ -155,9 +127,7 @@
                     embeds: [
                         new EmojiEmbed()
                             .setTitle("Stats Channel")
-                            .setDescription(
-                                "Something went wrong and the stats channel could not be set"
-                            )
+                            .setDescription("Something went wrong and the stats channel could not be set")
                             .setStatus("Danger")
                             .setEmoji("CHANNEL.TEXT.DELETE")
                     ],
@@ -200,14 +170,10 @@
                     Object.keys(stats).length
                         ? [
                               selectMenu
-                                  .setPlaceholder(
-                                      "Select a stats channel to remove, stopping it updating"
-                                  )
+                                  .setPlaceholder("Select a stats channel to remove, stopping it updating")
                                   .addOptions(
                                       Object.keys(stats).map((key) => ({
-                                          label: interaction.guild.channels.cache.get(
-                                              key
-                                          ).name,
+                                          label: interaction.guild.channels.cache.get(key).name,
                                           value: key,
                                           description: `${stats[key].name}`
                                       }))
@@ -215,9 +181,7 @@
                           ]
                         : [
                               selectMenu
-                                  .setPlaceholder(
-                                      "The server has no stats channels"
-                                  )
+                                  .setPlaceholder("The server has no stats channels")
                                   .setDisabled(true)
                                   .setOptions([
                                       {
@@ -252,10 +216,7 @@
     });
 };
 
-const check = (
-    interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     const member = interaction.member as Discord.GuildMember;
     if (!member.permissions.has("MANAGE_CHANNELS"))
         throw "You must have the *Manage Channels* permission to use this command";
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index 206e157..3c6515d 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -15,17 +15,10 @@
     SelectMenuInteraction,
     TextInputComponent
 } from "discord.js";
-import {
-    SelectMenuOption,
-    SlashCommandSubcommandBuilder
-} from "@discordjs/builders";
+import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import { ChannelType } from "discord-api-types/v9";
 import client from "../../utils/client.js";
-import {
-    toHexInteger,
-    toHexArray,
-    tickets as ticketTypes
-} from "../../utils/calculate.js";
+import { toHexInteger, toHexArray, tickets as ticketTypes } from "../../utils/calculate.js";
 import { capitalize } from "../../utils/generateKeyValueList.js";
 import { modalInteractionCollector } from "../../utils/dualCollector.js";
 import { GuildConfig } from "../../utils/database.js";
@@ -33,9 +26,7 @@
 const command = (builder: SlashCommandSubcommandBuilder) =>
     builder
         .setName("tickets")
-        .setDescription(
-            "Shows settings for tickets | Use no arguments to manage custom types"
-        )
+        .setDescription("Shows settings for tickets | Use no arguments to manage custom types")
         .addStringOption((option) =>
             option
                 .setName("enabled")
@@ -56,9 +47,7 @@
         .addNumberOption((option) =>
             option
                 .setName("maxticketsperuser")
-                .setDescription(
-                    "The maximum amount of tickets a user can create | Default: 5"
-                )
+                .setDescription("The maximum amount of tickets a user can create | Default: 5")
                 .setRequired(false)
                 .setMinValue(1)
         )
@@ -71,9 +60,7 @@
                 .setRequired(false)
         );
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     let m = (await interaction.reply({
         embeds: LoadingEmbed,
         ephemeral: true,
@@ -85,28 +72,19 @@
         maxtickets: interaction.options.getNumber("maxticketsperuser"),
         supportping: interaction.options.getRole("supportrole")
     };
-    if (
-        options.enabled !== null ||
-        options.category ||
-        options.maxtickets ||
-        options.supportping
-    ) {
+    if (options.enabled !== null || options.category || options.maxtickets || options.supportping) {
         options.enabled = options.enabled === "yes" ? true : false;
         if (options.category) {
             let channel: GuildChannel;
             try {
-                channel = await interaction.guild.channels.fetch(
-                    options.category.id
-                );
+                channel = await interaction.guild.channels.fetch(options.category.id);
             } catch {
                 return await interaction.editReply({
                     embeds: [
                         new EmojiEmbed()
                             .setEmoji("CHANNEL.TEXT.DELETE")
                             .setTitle("Tickets > Category")
-                            .setDescription(
-                                "The channel you provided is not a valid category"
-                            )
+                            .setDescription("The channel you provided is not a valid category")
                             .setStatus("Danger")
                     ]
                 });
@@ -117,9 +95,7 @@
                     embeds: [
                         new EmojiEmbed()
                             .setTitle("Tickets > Category")
-                            .setDescription(
-                                "You must choose a category in this server"
-                            )
+                            .setDescription("You must choose a category in this server")
                             .setStatus("Danger")
                             .setEmoji("CHANNEL.TEXT.DELETE")
                     ]
@@ -131,9 +107,7 @@
                     embeds: [
                         new EmojiEmbed()
                             .setTitle("Tickets > Max Tickets")
-                            .setDescription(
-                                "You must choose a number greater than 0"
-                            )
+                            .setDescription("You must choose a number greater than 0")
                             .setStatus("Danger")
                             .setEmoji("CHANNEL.TEXT.DELETE")
                     ]
@@ -142,18 +116,14 @@
         let role: Role;
         if (options.supportping) {
             try {
-                role = await interaction.guild.roles.fetch(
-                    options.supportping.id
-                );
+                role = await interaction.guild.roles.fetch(options.supportping.id);
             } catch {
                 return await interaction.editReply({
                     embeds: [
                         new EmojiEmbed()
                             .setEmoji("GUILD.ROLE.DELETE")
                             .setTitle("Tickets > Support Ping")
-                            .setDescription(
-                                "The role you provided is not a valid role"
-                            )
+                            .setDescription("The role you provided is not a valid role")
                             .setStatus("Danger")
                     ]
                 });
@@ -164,9 +134,7 @@
                     embeds: [
                         new EmojiEmbed()
                             .setTitle("Tickets > Support Ping")
-                            .setDescription(
-                                "You must choose a role in this server"
-                            )
+                            .setDescription("You must choose a role in this server")
                             .setStatus("Danger")
                             .setEmoji("GUILD.ROLE.DELETE")
                     ]
@@ -177,15 +145,9 @@
             .setEmoji("GUILD.TICKET.ARCHIVED")
             .setTitle("Tickets")
             .setDescription(
-                (options.category
-                    ? `**Category:** ${options.category.name}\n`
-                    : "") +
-                    (options.maxtickets
-                        ? `**Max Tickets:** ${options.maxtickets}\n`
-                        : "") +
-                    (options.supportping
-                        ? `**Support Ping:** ${options.supportping.name}\n`
-                        : "") +
+                (options.category ? `**Category:** ${options.category.name}\n` : "") +
+                    (options.maxtickets ? `**Max Tickets:** ${options.maxtickets}\n` : "") +
+                    (options.supportping ? `**Support Ping:** ${options.supportping.name}\n` : "") +
                     (options.enabled !== null
                         ? `**Enabled:** ${
                               options.enabled
@@ -201,27 +163,18 @@
         if (confirmation.cancelled) return;
         if (confirmation.success) {
             const toUpdate = {};
-            if (options.enabled !== null)
-                toUpdate["tickets.enabled"] = options.enabled;
-            if (options.category)
-                toUpdate["tickets.category"] = options.category.id;
-            if (options.maxtickets)
-                toUpdate["tickets.maxTickets"] = options.maxtickets;
-            if (options.supportping)
-                toUpdate["tickets.supportRole"] = options.supportping.id;
+            if (options.enabled !== null) toUpdate["tickets.enabled"] = options.enabled;
+            if (options.category) toUpdate["tickets.category"] = options.category.id;
+            if (options.maxtickets) toUpdate["tickets.maxTickets"] = options.maxtickets;
+            if (options.supportping) toUpdate["tickets.supportRole"] = options.supportping.id;
             try {
-                await client.database.guilds.write(
-                    interaction.guild.id,
-                    toUpdate
-                );
+                await client.database.guilds.write(interaction.guild.id, toUpdate);
             } catch (e) {
                 return interaction.editReply({
                     embeds: [
                         new EmojiEmbed()
                             .setTitle("Tickets")
-                            .setDescription(
-                                "Something went wrong and the staff notifications channel could not be set"
-                            )
+                            .setDescription("Something went wrong and the staff notifications channel could not be set")
                             .setStatus("Danger")
                             .setEmoji("GUILD.TICKET.DELETE")
                     ],
@@ -243,8 +196,7 @@
     }
     let data = await client.database.guilds.read(interaction.guild.id);
     data.tickets.customTypes = (data.tickets.customTypes || []).filter(
-        (value: string, index: number, array: string[]) =>
-            array.indexOf(value) === index
+        (value: string, index: number, array: string[]) => array.indexOf(value) === index
     );
     let lastClicked = "";
     let embed: EmojiEmbed;
@@ -261,34 +213,18 @@
         embed = new EmojiEmbed()
             .setTitle("Tickets")
             .setDescription(
-                `${
-                    data.enabled ? "" : getEmojiByName("TICKETS.REPORT")
-                } **Enabled:** ${
-                    data.enabled
-                        ? `${getEmojiByName("CONTROL.TICK")} Yes`
-                        : `${getEmojiByName("CONTROL.CROSS")} No`
+                `${data.enabled ? "" : getEmojiByName("TICKETS.REPORT")} **Enabled:** ${
+                    data.enabled ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
                 }\n` +
-                    `${
-                        data.category ? "" : getEmojiByName("TICKETS.REPORT")
-                    } **Category:** ${
+                    `${data.category ? "" : getEmojiByName("TICKETS.REPORT")} **Category:** ${
                         data.category ? `<#${data.category}>` : "*None set*"
                     }\n` +
-                    `**Max Tickets:** ${
-                        data.maxTickets ? data.maxTickets : "*No limit*"
-                    }\n` +
-                    `**Support Ping:** ${
-                        data.supportRole
-                            ? `<@&${data.supportRole}>`
-                            : "*None set*"
-                    }\n\n` +
-                    (data.useCustom && data.customTypes === null
-                        ? `${getEmojiByName("TICKETS.REPORT")} `
-                        : "") +
+                    `**Max Tickets:** ${data.maxTickets ? data.maxTickets : "*No limit*"}\n` +
+                    `**Support Ping:** ${data.supportRole ? `<@&${data.supportRole}>` : "*None set*"}\n\n` +
+                    (data.useCustom && data.customTypes === null ? `${getEmojiByName("TICKETS.REPORT")} ` : "") +
                     `${data.useCustom ? "Custom" : "Default"} types in use` +
                     "\n\n" +
-                    `${getEmojiByName(
-                        "TICKETS.REPORT"
-                    )} *Indicates a setting stopping tickets from being used*`
+                    `${getEmojiByName("TICKETS.REPORT")} *Indicates a setting stopping tickets from being used*`
             )
             .setStatus("Success")
             .setEmoji("GUILD.TICKET.OPEN");
@@ -297,43 +233,24 @@
             components: [
                 new MessageActionRow().addComponents([
                     new MessageButton()
-                        .setLabel(
-                            "Tickets " + (data.enabled ? "enabled" : "disabled")
-                        )
-                        .setEmoji(
-                            getEmojiByName(
-                                "CONTROL." + (data.enabled ? "TICK" : "CROSS"),
-                                "id"
-                            )
-                        )
+                        .setLabel("Tickets " + (data.enabled ? "enabled" : "disabled"))
+                        .setEmoji(getEmojiByName("CONTROL." + (data.enabled ? "TICK" : "CROSS"), "id"))
                         .setStyle(data.enabled ? "SUCCESS" : "DANGER")
                         .setCustomId("enabled"),
                     new MessageButton()
-                        .setLabel(
-                            lastClicked === "cat"
-                                ? "Click again to confirm"
-                                : "Clear category"
-                        )
+                        .setLabel(lastClicked === "cat" ? "Click again to confirm" : "Clear category")
                         .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
                         .setStyle("DANGER")
                         .setCustomId("clearCategory")
                         .setDisabled(data.category === null),
                     new MessageButton()
-                        .setLabel(
-                            lastClicked === "max"
-                                ? "Click again to confirm"
-                                : "Reset max tickets"
-                        )
+                        .setLabel(lastClicked === "max" ? "Click again to confirm" : "Reset max tickets")
                         .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
                         .setStyle("DANGER")
                         .setCustomId("clearMaxTickets")
                         .setDisabled(data.maxTickets === 5),
                     new MessageButton()
-                        .setLabel(
-                            lastClicked === "sup"
-                                ? "Click again to confirm"
-                                : "Clear support ping"
-                        )
+                        .setLabel(lastClicked === "sup" ? "Click again to confirm" : "Clear support ping")
                         .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
                         .setStyle("DANGER")
                         .setCustomId("clearSupportPing")
@@ -360,42 +277,25 @@
             break;
         }
         i.deferUpdate();
-        if (
-            (i.component as MessageActionRowComponent).customId ===
-            "clearCategory"
-        ) {
+        if ((i.component as MessageActionRowComponent).customId === "clearCategory") {
             if (lastClicked === "cat") {
                 lastClicked = "";
-                await client.database.guilds.write(interaction.guild.id, null, [
-                    "tickets.category"
-                ]);
+                await client.database.guilds.write(interaction.guild.id, null, ["tickets.category"]);
                 data.category = undefined;
             } else lastClicked = "cat";
-        } else if (
-            (i.component as MessageActionRowComponent).customId ===
-            "clearMaxTickets"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "clearMaxTickets") {
             if (lastClicked === "max") {
                 lastClicked = "";
-                await client.database.guilds.write(interaction.guild.id, null, [
-                    "tickets.maxTickets"
-                ]);
+                await client.database.guilds.write(interaction.guild.id, null, ["tickets.maxTickets"]);
                 data.maxTickets = 5;
             } else lastClicked = "max";
-        } else if (
-            (i.component as MessageActionRowComponent).customId ===
-            "clearSupportPing"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "clearSupportPing") {
             if (lastClicked === "sup") {
                 lastClicked = "";
-                await client.database.guilds.write(interaction.guild.id, null, [
-                    "tickets.supportRole"
-                ]);
+                await client.database.guilds.write(interaction.guild.id, null, ["tickets.supportRole"]);
                 data.supportRole = undefined;
             } else lastClicked = "sup";
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "send"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "send") {
             const ticketMessages = [
                 {
                     label: "Create ticket",
@@ -403,13 +303,11 @@
                 },
                 {
                     label: "Issues, questions or feedback?",
-                    description:
-                        "Click below to open a ticket and get help from our staff team"
+                    description: "Click below to open a ticket and get help from our staff team"
                 },
                 {
                     label: "Contact Us",
-                    description:
-                        "Click the button below to speak to us privately"
+                    description: "Click the button below to speak to us privately"
                 }
             ];
             while (true) {
@@ -418,9 +316,7 @@
                     embeds: [
                         new EmojiEmbed()
                             .setTitle("Ticket Button")
-                            .setDescription(
-                                "Select a message template to send in this channel"
-                            )
+                            .setDescription("Select a message template to send in this channel")
                             .setFooter({
                                 text: enabled
                                     ? ""
@@ -462,10 +358,7 @@
                                 .setLabel("Back")
                                 .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
                                 .setStyle("DANGER"),
-                            new MessageButton()
-                                .setCustomId("blank")
-                                .setLabel("Empty")
-                                .setStyle("SECONDARY"),
+                            new MessageButton().setCustomId("blank").setLabel("Empty").setStyle("SECONDARY"),
                             new MessageButton()
                                 .setCustomId("custom")
                                 .setLabel("Custom")
@@ -480,29 +373,14 @@
                 } catch (e) {
                     break;
                 }
-                if (
-                    (i.component as MessageActionRowComponent).customId ===
-                    "template"
-                ) {
+                if ((i.component as MessageActionRowComponent).customId === "template") {
                     i.deferUpdate();
                     await interaction.channel.send({
                         embeds: [
                             new EmojiEmbed()
-                                .setTitle(
-                                    ticketMessages[
-                                        parseInt(
-                                            (i as SelectMenuInteraction)
-                                                .values[0]
-                                        )
-                                    ].label
-                                )
+                                .setTitle(ticketMessages[parseInt((i as SelectMenuInteraction).values[0])].label)
                                 .setDescription(
-                                    ticketMessages[
-                                        parseInt(
-                                            (i as SelectMenuInteraction)
-                                                .values[0]
-                                        )
-                                    ].description
+                                    ticketMessages[parseInt((i as SelectMenuInteraction).values[0])].description
                                 )
                                 .setStatus("Success")
                                 .setEmoji("GUILD.TICKET.OPEN")
@@ -511,41 +389,28 @@
                             new MessageActionRow().addComponents([
                                 new MessageButton()
                                     .setLabel("Create Ticket")
-                                    .setEmoji(
-                                        getEmojiByName("CONTROL.TICK", "id")
-                                    )
+                                    .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
                                     .setStyle("SUCCESS")
                                     .setCustomId("createticket")
                             ])
                         ]
                     });
                     break;
-                } else if (
-                    (i.component as MessageActionRowComponent).customId ===
-                    "blank"
-                ) {
+                } else if ((i.component as MessageActionRowComponent).customId === "blank") {
                     i.deferUpdate();
                     await interaction.channel.send({
                         components: [
                             new MessageActionRow().addComponents([
                                 new MessageButton()
                                     .setLabel("Create Ticket")
-                                    .setEmoji(
-                                        getEmojiByName(
-                                            "TICKETS.SUGGESTION",
-                                            "id"
-                                        )
-                                    )
+                                    .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
                                     .setStyle("SUCCESS")
                                     .setCustomId("createticket")
                             ])
                         ]
                     });
                     break;
-                } else if (
-                    (i.component as MessageActionRowComponent).customId ===
-                    "custom"
-                ) {
+                } else if ((i.component as MessageActionRowComponent).customId === "custom") {
                     await i.showModal(
                         new Discord.Modal()
                             .setCustomId("modal")
@@ -573,9 +438,7 @@
                         embeds: [
                             new EmojiEmbed()
                                 .setTitle("Ticket Button")
-                                .setDescription(
-                                    "Modal opened. If you can't see it, click back and try again."
-                                )
+                                .setDescription("Modal opened. If you can't see it, click back and try again.")
                                 .setStatus("Success")
                                 .setEmoji("GUILD.TICKET.OPEN")
                         ],
@@ -583,9 +446,7 @@
                             new MessageActionRow().addComponents([
                                 new MessageButton()
                                     .setLabel("Back")
-                                    .setEmoji(
-                                        getEmojiByName("CONTROL.LEFT", "id")
-                                    )
+                                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
                                     .setStyle("PRIMARY")
                                     .setCustomId("back")
                             ])
@@ -603,8 +464,7 @@
                     }
                     if (out.fields) {
                         const title = out.fields.getTextInputValue("title");
-                        const description =
-                            out.fields.getTextInputValue("description");
+                        const description = out.fields.getTextInputValue("description");
                         await interaction.channel.send({
                             embeds: [
                                 new EmojiEmbed()
@@ -617,12 +477,7 @@
                                 new MessageActionRow().addComponents([
                                     new MessageButton()
                                         .setLabel("Create Ticket")
-                                        .setEmoji(
-                                            getEmojiByName(
-                                                "TICKETS.SUGGESTION",
-                                                "id"
-                                            )
-                                        )
+                                        .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
                                         .setStyle("SUCCESS")
                                         .setCustomId("createticket")
                                 ])
@@ -634,17 +489,12 @@
                     }
                 }
             }
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "enabled"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "enabled") {
             await client.database.guilds.write(interaction.guild.id, {
                 "tickets.enabled": !data.enabled
             });
             data.enabled = !data.enabled;
-        } else if (
-            (i.component as MessageActionRowComponent).customId ===
-            "manageTypes"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "manageTypes") {
             data = await manageTypes(interaction, data, m as Message);
         } else {
             break;
@@ -656,11 +506,7 @@
     });
 };
 
-async function manageTypes(
-    interaction: CommandInteraction,
-    data: GuildConfig["tickets"],
-    m: Message
-) {
+async function manageTypes(interaction: CommandInteraction, data: GuildConfig["tickets"], m: Message) {
     while (true) {
         if (data.useCustom) {
             const customTypes = data.customTypes;
@@ -671,11 +517,7 @@
                         .setDescription(
                             "**Custom types enabled**\n\n" +
                                 "**Types in use:**\n" +
-                                (customTypes !== null
-                                    ? customTypes
-                                          .map((t) => `> ${t}`)
-                                          .join("\n")
-                                    : "*None set*") +
+                                (customTypes !== null ? customTypes.map((t) => `> ${t}`).join("\n") : "*None set*") +
                                 "\n\n" +
                                 (customTypes === null
                                     ? `${getEmojiByName(
@@ -712,14 +554,10 @@
                             .setCustomId("back"),
                         new MessageButton()
                             .setLabel("Add new type")
-                            .setEmoji(
-                                getEmojiByName("TICKETS.SUGGESTION", "id")
-                            )
+                            .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
                             .setStyle("PRIMARY")
                             .setCustomId("addType")
-                            .setDisabled(
-                                customTypes !== null && customTypes.length >= 25
-                            ),
+                            .setDisabled(customTypes !== null && customTypes.length >= 25),
                         new MessageButton()
                             .setLabel("Switch to default types")
                             .setStyle("SECONDARY")
@@ -735,12 +573,7 @@
                     new SelectMenuOption({
                         label: capitalize(type),
                         value: type,
-                        emoji: client.emojis.cache.get(
-                            getEmojiByName(
-                                `TICKETS.${type.toUpperCase()}`,
-                                "id"
-                            )
-                        ),
+                        emoji: client.emojis.cache.get(getEmojiByName(`TICKETS.${type.toUpperCase()}`, "id")),
                         default: inUse.includes(type)
                     })
                 );
@@ -761,12 +594,7 @@
                             "**Default types enabled**\n\n" +
                                 "**Types in use:**\n" +
                                 inUse
-                                    .map(
-                                        (t) =>
-                                            `> ${getEmojiByName(
-                                                "TICKETS." + t.toUpperCase()
-                                            )} ${capitalize(t)}`
-                                    )
+                                    .map((t) => `> ${getEmojiByName("TICKETS." + t.toUpperCase())} ${capitalize(t)}`)
                                     .join("\n")
                         )
                         .setStatus("Success")
@@ -835,9 +663,7 @@
                 embeds: [
                     new EmojiEmbed()
                         .setTitle("Tickets > Types")
-                        .setDescription(
-                            "Modal opened. If you can't see it, click back and try again."
-                        )
+                        .setDescription("Modal opened. If you can't see it, click back and try again.")
                         .setStatus("Success")
                         .setEmoji("GUILD.TICKET.OPEN")
                 ],
@@ -868,11 +694,7 @@
                 }
                 toAdd = toAdd.substring(0, 80);
                 try {
-                    await client.database.guilds.append(
-                        interaction.guild.id,
-                        "tickets.customTypes",
-                        toAdd
-                    );
+                    await client.database.guilds.append(interaction.guild.id, "tickets.customTypes", toAdd);
                 } catch {
                     continue;
                 }
@@ -885,19 +707,11 @@
             }
         } else if (i.component.customId === "switchToDefault") {
             i.deferUpdate();
-            await client.database.guilds.write(
-                interaction.guild.id,
-                { "tickets.useCustom": false },
-                []
-            );
+            await client.database.guilds.write(interaction.guild.id, { "tickets.useCustom": false }, []);
             data.useCustom = false;
         } else if (i.component.customId === "switchToCustom") {
             i.deferUpdate();
-            await client.database.guilds.write(
-                interaction.guild.id,
-                { "tickets.useCustom": true },
-                []
-            );
+            await client.database.guilds.write(interaction.guild.id, { "tickets.useCustom": true }, []);
             data.useCustom = true;
         } else {
             i.deferUpdate();
diff --git a/src/commands/settings/verify.ts b/src/commands/settings/verify.ts
index e0af802..614ecb9 100644
--- a/src/commands/settings/verify.ts
+++ b/src/commands/settings/verify.ts
@@ -24,15 +24,10 @@
         .setName("verify")
         .setDescription("Manage the role given after typing /verify")
         .addRoleOption((option) =>
-            option
-                .setName("role")
-                .setDescription("The role to give after verifying")
-                .setRequired(false)
+            option.setName("role").setDescription("The role to give after verifying").setRequired(false)
         );
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     const m = (await interaction.reply({
         embeds: LoadingEmbed,
         ephemeral: true,
@@ -48,9 +43,7 @@
                     new EmojiEmbed()
                         .setEmoji("GUILD.ROLES.DELETE")
                         .setTitle("Verify Role")
-                        .setDescription(
-                            "The role you provided is not a valid role"
-                        )
+                        .setDescription("The role you provided is not a valid role")
                         .setStatus("Danger")
                 ]
             });
@@ -70,9 +63,7 @@
         const confirmation = await new confirmationMessage(interaction)
             .setEmoji("GUILD.ROLES.EDIT")
             .setTitle("Verify Role")
-            .setDescription(
-                `Are you sure you want to set the verify role to <@&${role.id}>?`
-            )
+            .setDescription(`Are you sure you want to set the verify role to <@&${role.id}>?`)
             .setColor("Warning")
             .setInverted(true)
             .send(true);
@@ -83,8 +74,7 @@
                     "verify.role": role.id,
                     "verify.enabled": true
                 });
-                const { log, NucleusColors, entry, renderUser, renderRole } =
-                    client.logger;
+                const { log, NucleusColors, entry, renderUser, renderRole } = client.logger;
                 const data = {
                     meta: {
                         type: "verifyRoleChanged",
@@ -95,14 +85,8 @@
                         timestamp: new Date().getTime()
                     },
                     list: {
-                        memberId: entry(
-                            interaction.user.id,
-                            `\`${interaction.user.id}\``
-                        ),
-                        changedBy: entry(
-                            interaction.user.id,
-                            renderUser(interaction.user)
-                        ),
+                        memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+                        changedBy: entry(interaction.user.id, renderUser(interaction.user)),
                         role: entry(role.id, renderRole(role))
                     },
                     hidden: {
@@ -116,9 +100,7 @@
                     embeds: [
                         new EmojiEmbed()
                             .setTitle("Verify Role")
-                            .setDescription(
-                                "Something went wrong while setting the verify role"
-                            )
+                            .setDescription("Something went wrong while setting the verify role")
                             .setStatus("Danger")
                             .setEmoji("GUILD.ROLES.DELETE")
                     ],
@@ -147,9 +129,7 @@
                 new EmojiEmbed()
                     .setTitle("Verify Role")
                     .setDescription(
-                        role
-                            ? `Your verify role is currently set to <@&${role}>`
-                            : "You have not set a verify role"
+                        role ? `Your verify role is currently set to <@&${role}>` : "You have not set a verify role"
                     )
                     .setStatus("Success")
                     .setEmoji("GUILD.ROLES.CREATE")
@@ -158,15 +138,8 @@
                 new MessageActionRow().addComponents([
                     new MessageButton()
                         .setCustomId("clear")
-                        .setLabel(
-                            clicks ? "Click again to confirm" : "Reset role"
-                        )
-                        .setEmoji(
-                            getEmojiByName(
-                                clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS",
-                                "id"
-                            )
-                        )
+                        .setLabel(clicks ? "Click again to confirm" : "Reset role")
+                        .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
                         .setStyle("DANGER")
                         .setDisabled(!role),
                     new MessageButton()
@@ -188,15 +161,10 @@
             clicks += 1;
             if (clicks === 2) {
                 clicks = 0;
-                await client.database.guilds.write(interaction.guild.id, null, [
-                    "verify.role",
-                    "verify.enabled"
-                ]);
+                await client.database.guilds.write(interaction.guild.id, null, ["verify.role", "verify.enabled"]);
                 role = undefined;
             }
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "send"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "send") {
             const verifyMessages = [
                 {
                     label: "Verify",
@@ -204,8 +172,7 @@
                 },
                 {
                     label: "Get verified",
-                    description:
-                        "To get access to the rest of the server, click the button below"
+                    description: "To get access to the rest of the server, click the button below"
                 },
                 {
                     label: "Ready to verify?",
@@ -217,13 +184,9 @@
                     embeds: [
                         new EmojiEmbed()
                             .setTitle("Verify Button")
-                            .setDescription(
-                                "Select a message template to send in this channel"
-                            )
+                            .setDescription("Select a message template to send in this channel")
                             .setFooter({
-                                text: role
-                                    ? ""
-                                    : "You do no have a verify role set so the button will not work."
+                                text: role ? "" : "You do no have a verify role set so the button will not work."
                             })
                             .setStatus(role ? "Success" : "Warning")
                             .setEmoji("GUILD.ROLES.CREATE")
@@ -261,10 +224,7 @@
                                 .setLabel("Back")
                                 .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
                                 .setStyle("DANGER"),
-                            new MessageButton()
-                                .setCustomId("blank")
-                                .setLabel("Empty")
-                                .setStyle("SECONDARY"),
+                            new MessageButton().setCustomId("blank").setLabel("Empty").setStyle("SECONDARY"),
                             new MessageButton()
                                 .setCustomId("custom")
                                 .setLabel("Custom")
@@ -279,29 +239,14 @@
                 } catch (e) {
                     break;
                 }
-                if (
-                    (i.component as MessageActionRowComponent).customId ===
-                    "template"
-                ) {
+                if ((i.component as MessageActionRowComponent).customId === "template") {
                     i.deferUpdate();
                     await interaction.channel.send({
                         embeds: [
                             new EmojiEmbed()
-                                .setTitle(
-                                    verifyMessages[
-                                        parseInt(
-                                            (i as SelectMenuInteraction)
-                                                .values[0]
-                                        )
-                                    ].label
-                                )
+                                .setTitle(verifyMessages[parseInt((i as SelectMenuInteraction).values[0])].label)
                                 .setDescription(
-                                    verifyMessages[
-                                        parseInt(
-                                            (i as SelectMenuInteraction)
-                                                .values[0]
-                                        )
-                                    ].description
+                                    verifyMessages[parseInt((i as SelectMenuInteraction).values[0])].description
                                 )
                                 .setStatus("Success")
                                 .setEmoji("CONTROL.BLOCKTICK")
@@ -310,38 +255,28 @@
                             new MessageActionRow().addComponents([
                                 new MessageButton()
                                     .setLabel("Verify")
-                                    .setEmoji(
-                                        getEmojiByName("CONTROL.TICK", "id")
-                                    )
+                                    .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
                                     .setStyle("SUCCESS")
                                     .setCustomId("verifybutton")
                             ])
                         ]
                     });
                     break;
-                } else if (
-                    (i.component as MessageActionRowComponent).customId ===
-                    "blank"
-                ) {
+                } else if ((i.component as MessageActionRowComponent).customId === "blank") {
                     i.deferUpdate();
                     await interaction.channel.send({
                         components: [
                             new MessageActionRow().addComponents([
                                 new MessageButton()
                                     .setLabel("Verify")
-                                    .setEmoji(
-                                        getEmojiByName("CONTROL.TICK", "id")
-                                    )
+                                    .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
                                     .setStyle("SUCCESS")
                                     .setCustomId("verifybutton")
                             ])
                         ]
                     });
                     break;
-                } else if (
-                    (i.component as MessageActionRowComponent).customId ===
-                    "custom"
-                ) {
+                } else if ((i.component as MessageActionRowComponent).customId === "custom") {
                     await i.showModal(
                         new Discord.Modal()
                             .setCustomId("modal")
@@ -369,9 +304,7 @@
                         embeds: [
                             new EmojiEmbed()
                                 .setTitle("Verify Button")
-                                .setDescription(
-                                    "Modal opened. If you can't see it, click back and try again."
-                                )
+                                .setDescription("Modal opened. If you can't see it, click back and try again.")
                                 .setStatus("Success")
                                 .setEmoji("GUILD.TICKET.OPEN")
                         ],
@@ -379,9 +312,7 @@
                             new MessageActionRow().addComponents([
                                 new MessageButton()
                                     .setLabel("Back")
-                                    .setEmoji(
-                                        getEmojiByName("CONTROL.LEFT", "id")
-                                    )
+                                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
                                     .setStyle("PRIMARY")
                                     .setCustomId("back")
                             ])
@@ -399,8 +330,7 @@
                     }
                     if (out.fields) {
                         const title = out.fields.getTextInputValue("title");
-                        const description =
-                            out.fields.getTextInputValue("description");
+                        const description = out.fields.getTextInputValue("description");
                         await interaction.channel.send({
                             embeds: [
                                 new EmojiEmbed()
@@ -413,9 +343,7 @@
                                 new MessageActionRow().addComponents([
                                     new MessageButton()
                                         .setLabel("Verify")
-                                        .setEmoji(
-                                            getEmojiByName("CONTROL.TICK", "id")
-                                        )
+                                        .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
                                         .setStyle("SUCCESS")
                                         .setCustomId("verifybutton")
                                 ])
diff --git a/src/commands/settings/welcome.ts b/src/commands/settings/welcome.ts
index d2843c5..d1c2011 100644
--- a/src/commands/settings/welcome.ts
+++ b/src/commands/settings/welcome.ts
@@ -19,39 +19,28 @@
 const command = (builder: SlashCommandSubcommandBuilder) =>
     builder
         .setName("welcome")
-        .setDescription(
-            "Messages and roles sent or given when someone joins the server"
-        )
+        .setDescription("Messages and roles sent or given when someone joins the server")
         .addStringOption((option) =>
             option
                 .setName("message")
-                .setDescription(
-                    "The message to send when someone joins the server"
-                )
+                .setDescription("The message to send when someone joins the server")
                 .setAutocomplete(true)
         )
         .addRoleOption((option) =>
-            option
-                .setName("role")
-                .setDescription("The role given when someone joins the server")
+            option.setName("role").setDescription("The role given when someone joins the server")
         )
         .addRoleOption((option) =>
-            option
-                .setName("ping")
-                .setDescription("The role pinged when someone joins the server")
+            option.setName("ping").setDescription("The role pinged when someone joins the server")
         )
         .addChannelOption((option) =>
             option
                 .setName("channel")
-                .setDescription(
-                    "The channel the welcome message should be sent to"
-                )
+                .setDescription("The channel the welcome message should be sent to")
                 .addChannelTypes([ChannelType.GuildText, ChannelType.GuildNews])
         );
 
 const callback = async (interaction: CommandInteraction): Promise<unknown> => {
-    const { renderRole, renderChannel, log, NucleusColors, entry, renderUser } =
-        client.logger;
+    const { renderRole, renderChannel, log, NucleusColors, entry, renderUser } = client.logger;
     await interaction.reply({
         embeds: LoadingEmbed,
         fetchReply: true,
@@ -75,9 +64,7 @@
                     new EmojiEmbed()
                         .setEmoji("GUILD.ROLES.DELETE")
                         .setTitle("Welcome Events")
-                        .setDescription(
-                            "The role you provided is not a valid role"
-                        )
+                        .setDescription("The role you provided is not a valid role")
                         .setStatus("Danger")
                 ]
             });
@@ -91,9 +78,7 @@
                     new EmojiEmbed()
                         .setEmoji("GUILD.ROLES.DELETE")
                         .setTitle("Welcome Events")
-                        .setDescription(
-                            "The channel you provided is not a valid channel"
-                        )
+                        .setDescription("The channel you provided is not a valid channel")
                         .setStatus("Danger")
                 ]
             });
@@ -118,24 +103,14 @@
                 if (ping) toChange["welcome.ping"] = ping.id;
                 if (channel) toChange["welcome.channel"] = channel.id;
                 if (message) toChange["welcome.message"] = message;
-                await client.database.guilds.write(
-                    interaction.guild.id,
-                    toChange
-                );
+                await client.database.guilds.write(interaction.guild.id, toChange);
                 const list = {
-                    memberId: entry(
-                        interaction.user.id,
-                        `\`${interaction.user.id}\``
-                    ),
-                    changedBy: entry(
-                        interaction.user.id,
-                        renderUser(interaction.user)
-                    )
+                    memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+                    changedBy: entry(interaction.user.id, renderUser(interaction.user))
                 };
                 if (role) list.role = entry(role.id, renderRole(role));
                 if (ping) list.ping = entry(ping.id, renderRole(ping));
-                if (channel)
-                    list.channel = entry(channel.id, renderChannel(channel.id));
+                if (channel) list.channel = entry(channel.id, renderChannel(channel.id));
                 if (message) list.message = entry(message, `\`${message}\``);
                 const data = {
                     meta: {
@@ -158,9 +133,7 @@
                     embeds: [
                         new EmojiEmbed()
                             .setTitle("Welcome Events")
-                            .setDescription(
-                                "Something went wrong while updating welcome settings"
-                            )
+                            .setDescription("Something went wrong while updating welcome settings")
                             .setStatus("Danger")
                             .setEmoji("GUILD.ROLES.DELETE")
                     ],
@@ -188,38 +161,22 @@
                 new EmojiEmbed()
                     .setTitle("Welcome Events")
                     .setDescription(
-                        `**Message:** ${
-                            config.welcome.message
-                                ? `\n> ${config.welcome.message}`
-                                : "*None set*"
-                        }\n` +
+                        `**Message:** ${config.welcome.message ? `\n> ${config.welcome.message}` : "*None set*"}\n` +
                             `**Role:** ${
                                 config.welcome.role
-                                    ? renderRole(
-                                          await interaction.guild.roles.fetch(
-                                              config.welcome.role
-                                          )
-                                      )
+                                    ? renderRole(await interaction.guild.roles.fetch(config.welcome.role))
                                     : "*None set*"
                             }\n` +
                             `**Ping:** ${
                                 config.welcome.ping
-                                    ? renderRole(
-                                          await interaction.guild.roles.fetch(
-                                              config.welcome.ping
-                                          )
-                                      )
+                                    ? renderRole(await interaction.guild.roles.fetch(config.welcome.ping))
                                     : "*None set*"
                             }\n` +
                             `**Channel:** ${
                                 config.welcome.channel
                                     ? config.welcome.channel == "dm"
                                         ? "DM"
-                                        : renderChannel(
-                                              await interaction.guild.channels.fetch(
-                                                  config.welcome.channel
-                                              )
-                                          )
+                                        : renderChannel(await interaction.guild.channels.fetch(config.welcome.channel))
                                     : "*None set*"
                             }`
                     )
@@ -229,41 +186,25 @@
             components: [
                 new MessageActionRow().addComponents([
                     new MessageButton()
-                        .setLabel(
-                            lastClicked == "clear-message"
-                                ? "Click again to confirm"
-                                : "Clear Message"
-                        )
+                        .setLabel(lastClicked == "clear-message" ? "Click again to confirm" : "Clear Message")
                         .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
                         .setCustomId("clear-message")
                         .setDisabled(!config.welcome.message)
                         .setStyle("DANGER"),
                     new MessageButton()
-                        .setLabel(
-                            lastClicked == "clear-role"
-                                ? "Click again to confirm"
-                                : "Clear Role"
-                        )
+                        .setLabel(lastClicked == "clear-role" ? "Click again to confirm" : "Clear Role")
                         .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
                         .setCustomId("clear-role")
                         .setDisabled(!config.welcome.role)
                         .setStyle("DANGER"),
                     new MessageButton()
-                        .setLabel(
-                            lastClicked == "clear-ping"
-                                ? "Click again to confirm"
-                                : "Clear Ping"
-                        )
+                        .setLabel(lastClicked == "clear-ping" ? "Click again to confirm" : "Clear Ping")
                         .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
                         .setCustomId("clear-ping")
                         .setDisabled(!config.welcome.ping)
                         .setStyle("DANGER"),
                     new MessageButton()
-                        .setLabel(
-                            lastClicked == "clear-channel"
-                                ? "Click again to confirm"
-                                : "Clear Channel"
-                        )
+                        .setLabel(lastClicked == "clear-channel" ? "Click again to confirm" : "Clear Channel")
                         .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
                         .setCustomId("clear-channel")
                         .setDisabled(!config.welcome.channel)
@@ -335,9 +276,7 @@
 const check = (interaction: CommandInteraction) => {
     const member = interaction.member as Discord.GuildMember;
     if (!member.permissions.has("MANAGE_GUILD"))
-        throw new Error(
-            "You must have the *Manage Server* permission to use this command"
-        );
+        throw new Error("You must have the *Manage Server* permission to use this command");
     return true;
 };
 
diff --git a/src/commands/tag.ts b/src/commands/tag.ts
index 34c3152..d65109d 100644
--- a/src/commands/tag.ts
+++ b/src/commands/tag.ts
@@ -1,9 +1,4 @@
-import {
-    AutocompleteInteraction,
-    CommandInteraction,
-    MessageActionRow,
-    MessageButton
-} from "discord.js";
+import { AutocompleteInteraction, CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
 import { SlashCommandBuilder } from "@discordjs/builders";
 import client from "../utils/client.js";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
@@ -11,13 +6,7 @@
 const command = new SlashCommandBuilder()
     .setName("tag")
     .setDescription("Get and manage the servers tags")
-    .addStringOption((o) =>
-        o
-            .setName("tag")
-            .setDescription("The tag to get")
-            .setAutocomplete(true)
-            .setRequired(true)
-    );
+    .addStringOption((o) => o.setName("tag").setDescription("The tag to get").setAutocomplete(true).setRequired(true));
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     const config = await client.database.guilds.read(interaction.guild.id);
@@ -28,11 +17,7 @@
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Tag")
-                    .setDescription(
-                        `Tag \`${interaction.options.getString(
-                            "tag"
-                        )}\` does not exist`
-                    )
+                    .setDescription(`Tag \`${interaction.options.getString("tag")}\` does not exist`)
                     .setEmoji("PUNISH.NICKNAME.RED")
                     .setStatus("Danger")
             ],
@@ -44,12 +29,7 @@
     if (tag.match(/^(http|https):\/\/[^ "]+$/)) {
         url = tag;
         components = [
-            new MessageActionRow().addComponents([
-                new MessageButton()
-                    .setLabel("Open")
-                    .setURL(url)
-                    .setStyle("LINK")
-            ])
+            new MessageActionRow().addComponents([new MessageButton().setLabel("Open").setURL(url).setStyle("LINK")])
         ];
     }
     return await interaction.reply({
@@ -70,9 +50,7 @@
     return true;
 };
 
-const autocomplete = async (
-    interaction: AutocompleteInteraction
-): Promise<string[]> => {
+const autocomplete = async (interaction: AutocompleteInteraction): Promise<string[]> => {
     if (!interaction.guild) return [];
     const config = await client.database.guilds.read(interaction.guild.id);
     const tags = Object.keys(config.getKey("tags"));
diff --git a/src/commands/tags/create.ts b/src/commands/tags/create.ts
index 5d6621b..6350ad7 100644
--- a/src/commands/tags/create.ts
+++ b/src/commands/tags/create.ts
@@ -9,24 +9,12 @@
     builder
         .setName("create")
         .setDescription("Creates a tag")
+        .addStringOption((o) => o.setName("name").setRequired(true).setDescription("The name of the tag"))
         .addStringOption((o) =>
-            o
-                .setName("name")
-                .setRequired(true)
-                .setDescription("The name of the tag")
-        )
-        .addStringOption((o) =>
-            o
-                .setName("value")
-                .setRequired(true)
-                .setDescription(
-                    "The value of the tag, shown after running /tag name"
-                )
+            o.setName("value").setRequired(true).setDescription("The value of the tag, shown after running /tag name")
         );
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     const name = interaction.options.getString("name");
     const value = interaction.options.getString("value");
     if (name.length > 100)
@@ -34,9 +22,7 @@
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Tag Create")
-                    .setDescription(
-                        "Tag names cannot be longer than 100 characters"
-                    )
+                    .setDescription("Tag names cannot be longer than 100 characters")
                     .setStatus("Danger")
                     .setEmoji("PUNISH.NICKNAME.RED")
             ],
@@ -47,9 +33,7 @@
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Tag Create")
-                    .setDescription(
-                        "Tag values cannot be longer than 1000 characters"
-                    )
+                    .setDescription("Tag values cannot be longer than 1000 characters")
                     .setStatus("Danger")
                     .setEmoji("PUNISH.NICKNAME.RED")
             ],
@@ -110,9 +94,7 @@
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Tag Create")
-                    .setDescription(
-                        "Something went wrong and the tag was not created"
-                    )
+                    .setDescription("Something went wrong and the tag was not created")
                     .setStatus("Danger")
                     .setEmoji("PUNISH.NICKNAME.RED")
             ],
diff --git a/src/commands/tags/delete.ts b/src/commands/tags/delete.ts
index 4d1a1aa..1abdc48 100644
--- a/src/commands/tags/delete.ts
+++ b/src/commands/tags/delete.ts
@@ -9,16 +9,9 @@
     builder
         .setName("delete")
         .setDescription("Deletes a tag")
-        .addStringOption((o) =>
-            o
-                .setName("name")
-                .setRequired(true)
-                .setDescription("The name of the tag")
-        );
+        .addStringOption((o) => o.setName("name").setRequired(true).setDescription("The name of the tag"));
 
-const callback = async (
-    interaction: CommandInteraction
-): Promise<void | unknown> => {
+const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
     const name = interaction.options.getString("name");
     const data = await client.database.guilds.read(interaction.guild.id);
     if (!data.tags[name])
@@ -56,18 +49,14 @@
             ]
         });
     try {
-        await client.database.guilds.write(interaction.guild.id, null, [
-            "tags." + name
-        ]);
+        await client.database.guilds.write(interaction.guild.id, null, ["tags." + name]);
     } catch (e) {
         console.log(e);
         return await interaction.editReply({
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Tag Delete")
-                    .setDescription(
-                        "Something went wrong and the tag was not deleted"
-                    )
+                    .setDescription("Something went wrong and the tag was not deleted")
                     .setStatus("Danger")
                     .setEmoji("PUNISH.NICKNAME.RED")
             ],
diff --git a/src/commands/tags/edit.ts b/src/commands/tags/edit.ts
index 5aaec40..0ce306f 100644
--- a/src/commands/tags/edit.ts
+++ b/src/commands/tags/edit.ts
@@ -9,23 +9,12 @@
     builder
         .setName("edit")
         .setDescription("Edits or renames a tag")
+        .addStringOption((o) => o.setName("name").setRequired(true).setDescription("The tag to edit"))
         .addStringOption((o) =>
-            o
-                .setName("name")
-                .setRequired(true)
-                .setDescription("The tag to edit")
+            o.setName("value").setRequired(false).setDescription("The new value of the tag / Rename")
         )
         .addStringOption((o) =>
-            o
-                .setName("value")
-                .setRequired(false)
-                .setDescription("The new value of the tag / Rename")
-        )
-        .addStringOption((o) =>
-            o
-                .setName("newname")
-                .setRequired(false)
-                .setDescription("The new name of the tag / Edit")
+            o.setName("newname").setRequired(false).setDescription("The new name of the tag / Edit")
         );
 
 const callback = async (interaction: CommandInteraction): Promise<unknown> => {
@@ -49,9 +38,7 @@
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Tag Edit")
-                    .setDescription(
-                        "Tag names cannot be longer than 100 characters"
-                    )
+                    .setDescription("Tag names cannot be longer than 100 characters")
                     .setStatus("Danger")
                     .setEmoji("PUNISH.NICKNAME.RED")
             ],
@@ -62,9 +49,7 @@
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Tag Edit")
-                    .setDescription(
-                        "Tag values cannot be longer than 2000 characters"
-                    )
+                    .setDescription("Tag values cannot be longer than 2000 characters")
                     .setStatus("Danger")
                     .setEmoji("PUNISH.NICKNAME.RED")
             ],
@@ -124,19 +109,13 @@
             toUnset.push(`tags.${name}`);
             toSet[`tags.${newname}`] = data.tags[name];
         }
-        await client.database.guilds.write(
-            interaction.guild.id,
-            toSet === {} ? null : toSet,
-            toUnset
-        );
+        await client.database.guilds.write(interaction.guild.id, toSet === {} ? null : toSet, toUnset);
     } catch (e) {
         return await interaction.editReply({
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Tag Edit")
-                    .setDescription(
-                        "Something went wrong and the tag was not edited"
-                    )
+                    .setDescription("Something went wrong and the tag was not edited")
                     .setStatus("Danger")
                     .setEmoji("PUNISH.NICKNAME.RED")
             ],
@@ -158,9 +137,7 @@
 const check = (interaction: CommandInteraction) => {
     const member = interaction.member as GuildMember;
     if (!member.permissions.has("MANAGE_MESSAGES"))
-        throw new Error(
-            "You must have the *Manage Messages* permission to use this command"
-        );
+        throw new Error("You must have the *Manage Messages* permission to use this command");
     return true;
 };
 
diff --git a/src/commands/tags/list.ts b/src/commands/tags/list.ts
index 070aa8b..e62dee8 100644
--- a/src/commands/tags/list.ts
+++ b/src/commands/tags/list.ts
@@ -106,9 +106,7 @@
             ];
         }
         const em = new Discord.MessageEmbed(pages[page].embed);
-        em.setDescription(
-            em.description + "\n\n" + createPageIndicator(pages.length, page)
-        );
+        em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
         await interaction.editReply({
             embeds: [em],
             components: selectPane.concat([
@@ -145,28 +143,17 @@
         if ((i.component as MessageActionRowComponent).customId === "left") {
             if (page > 0) page--;
             selectPaneOpen = false;
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "right"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "right") {
             if (page < pages.length - 1) page++;
             selectPaneOpen = false;
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "select"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "select") {
             selectPaneOpen = !selectPaneOpen;
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "page"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "page") {
             page = parseInt((i as SelectMenuInteraction).values[0]);
             selectPaneOpen = false;
         } else {
             const em = new Discord.MessageEmbed(pages[page].embed);
-            em.setDescription(
-                em.description +
-                    "\n\n" +
-                    createPageIndicator(pages.length, page) +
-                    " | Message closed"
-            );
+            em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page) + " | Message closed");
             await interaction.editReply({
                 embeds: [em],
                 components: [
@@ -198,12 +185,7 @@
         }
     }
     const em = new Discord.MessageEmbed(pages[page].embed);
-    em.setDescription(
-        em.description +
-            "\n\n" +
-            createPageIndicator(pages.length, page) +
-            " | Message timed out"
-    );
+    em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page) + " | Message timed out");
     await interaction.editReply({
         embeds: [em],
         components: [
diff --git a/src/commands/ticket/close.ts b/src/commands/ticket/close.ts
index 71044dd..e2efcc3 100644
--- a/src/commands/ticket/close.ts
+++ b/src/commands/ticket/close.ts
@@ -2,8 +2,7 @@
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import close from "../../actions/tickets/delete.js";
 
-const command = (builder: SlashCommandSubcommandBuilder) =>
-    builder.setName("close").setDescription("Closes a ticket");
+const command = (builder: SlashCommandSubcommandBuilder) => builder.setName("close").setDescription("Closes a ticket");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     await close(interaction);
diff --git a/src/commands/ticket/create.ts b/src/commands/ticket/create.ts
index 10ec842..3d0b5ce 100644
--- a/src/commands/ticket/create.ts
+++ b/src/commands/ticket/create.ts
@@ -7,10 +7,7 @@
         .setName("create")
         .setDescription("Creates a new modmail ticket")
         .addStringOption((option) =>
-            option
-                .setName("message")
-                .setDescription("The content of the ticket")
-                .setRequired(false)
+            option.setName("message").setDescription("The content of the ticket").setRequired(false)
         );
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index 129359f..64c1ceb 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -9,10 +9,7 @@
     MessageComponentInteraction,
     SelectMenuInteraction
 } from "discord.js";
-import {
-    SelectMenuOption,
-    SlashCommandSubcommandBuilder
-} from "@discordjs/builders";
+import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
 import generateKeyValueList from "../../utils/generateKeyValueList.js";
@@ -24,11 +21,7 @@
         .setName("about")
         .setDescription("Shows info about a user")
         .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription(
-                    "The user to get info about | Default: Yourself"
-                )
+            option.setName("user").setDescription("The user to get info about | Default: Yourself")
         );
 
 class Embed {
@@ -57,8 +50,7 @@
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     if (!interaction.guild) return;
     const { renderUser, renderDelta } = client.logger;
-    const member = (interaction.options.getMember("user") ??
-        interaction.member) as Discord.GuildMember;
+    const member = (interaction.options.getMember("user") ?? interaction.member) as Discord.GuildMember;
     const flags: string[] = [];
     if (
         [
@@ -72,9 +64,7 @@
     }
     if (
         (await client.guilds.cache.get("684492926528651336")?.members.fetch())
-            ?.filter((m: GuildMember) =>
-                m.roles.cache.has("760896837866749972")
-            )
+            ?.filter((m: GuildMember) => m.roles.cache.has("760896837866749972"))
             ?.map((m: GuildMember) => m.id)
             .includes(member.user.id)
     ) {
@@ -115,9 +105,7 @@
     });
     const joinPos = membersArray.findIndex((m) => m.id === member.user.id);
 
-    const roles = member.roles.cache
-        .filter((r) => r.id !== interaction.guild!.id)
-        .sort();
+    const roles = member.roles.cache.filter((r) => r.id !== interaction.guild!.id).sort();
     let s = "";
     let count = 0;
     let ended = false;
@@ -149,12 +137,8 @@
         MENTION_EVERYONE: "Mention Everyone"
     };
     Object.keys(permsArray).map((perm) => {
-        const hasPerm = member.permissions.has(
-            perm as Discord.PermissionString
-        );
-        perms += `${getEmojiByName(
-            "CONTROL." + (hasPerm ? "TICK" : "CROSS")
-        )} ${permsArray[perm]}\n`;
+        const hasPerm = member.permissions.has(perm as Discord.PermissionString);
+        perms += `${getEmojiByName("CONTROL." + (hasPerm ? "TICK" : "CROSS"))} ${permsArray[perm]}\n`;
     });
 
     let selectPaneOpen = false;
@@ -170,11 +154,7 @@
                         flags
                             .map((flag) => {
                                 if (nameReplacements[flag]) {
-                                    return (
-                                        getEmojiByName(`BADGES.${flag}`) +
-                                        " " +
-                                        nameReplacements[flag]
-                                    );
+                                    return getEmojiByName(`BADGES.${flag}`) + " " + nameReplacements[flag];
                                 }
                             })
                             .join("\n") +
@@ -183,26 +163,16 @@
                                 member: renderUser(member.user),
                                 nickname: member.nickname || "*None set*",
                                 id: `\`${member.id}\``,
-                                "joined the server": renderDelta(
-                                    member.joinedTimestamp
-                                ),
-                                "joined discord": renderDelta(
-                                    member.user.createdTimestamp
-                                ),
+                                "joined the server": renderDelta(member.joinedTimestamp),
+                                "joined discord": renderDelta(member.user.createdTimestamp),
                                 "boost status": member.premiumSince
-                                    ? `Started boosting ${renderDelta(
-                                          member.premiumSinceTimestamp
-                                      )}`
+                                    ? `Started boosting ${renderDelta(member.premiumSinceTimestamp)}`
                                     : "*Not boosting*",
                                 "join position": `${joinPos + 1}`
                             })
                     )
-                    .setThumbnail(
-                        member.user.displayAvatarURL({ dynamic: true })
-                    )
-                    .setImage(
-                        (await member.user.fetch()).bannerURL({ format: "gif" })
-                    )
+                    .setThumbnail(member.user.displayAvatarURL({ dynamic: true }))
+                    .setImage((await member.user.fetch()).bannerURL({ format: "gif" }))
             )
             .setTitle("General")
             .setDescription("General information about the user")
@@ -223,9 +193,7 @@
                             (s.length > 0 ? s : "*None*") +
                             "\n"
                     )
-                    .setThumbnail(
-                        member.user.displayAvatarURL({ dynamic: true })
-                    )
+                    .setThumbnail(member.user.displayAvatarURL({ dynamic: true }))
             )
             .setTitle("Roles")
             .setDescription("Roles the user has")
@@ -244,9 +212,7 @@
                             "\n" +
                             perms
                     )
-                    .setThumbnail(
-                        member.user.displayAvatarURL({ dynamic: true })
-                    )
+                    .setThumbnail(member.user.displayAvatarURL({ dynamic: true }))
             )
             .setTitle("Key Permissions")
             .setDescription("Key permissions the user has")
@@ -261,9 +227,7 @@
     let breakReason = "";
     while (true) {
         const em = new Discord.MessageEmbed(embeds[page].embed);
-        em.setDescription(
-            em.description + "\n" + createPageIndicator(embeds.length, page)
-        );
+        em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page));
         let selectPane = [];
 
         if (selectPaneOpen) {
@@ -324,23 +288,15 @@
         if ((i.component as MessageActionRowComponent).customId === "left") {
             if (page > 0) page--;
             selectPaneOpen = false;
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "right"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "right") {
             if (page < embeds.length - 1) page++;
             selectPaneOpen = false;
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "select"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "select") {
             selectPaneOpen = !selectPaneOpen;
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "close"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "close") {
             breakReason = "Message closed";
             break;
-        } else if (
-            (i.component as MessageActionRowComponent).customId === "page"
-        ) {
+        } else if ((i.component as MessageActionRowComponent).customId === "page") {
             page = parseInt((i as SelectMenuInteraction).values[0]);
             selectPaneOpen = false;
         } else {
@@ -349,13 +305,7 @@
         }
     }
     const em = new Discord.MessageEmbed(embeds[page].embed);
-    em.setDescription(
-        em.description +
-            "\n" +
-            createPageIndicator(embeds.length, page) +
-            " | " +
-            breakReason
-    );
+    em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page) + " | " + breakReason);
     await interaction.editReply({
         embeds: [em],
         components: [
diff --git a/src/commands/user/avatar.ts b/src/commands/user/avatar.ts
index 502e9c8..a6c319d 100644
--- a/src/commands/user/avatar.ts
+++ b/src/commands/user/avatar.ts
@@ -10,17 +10,12 @@
         .setName("avatar")
         .setDescription("Shows the avatar of a user")
         .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription(
-                    "The user to get the avatar of | Default: Yourself"
-                )
+            option.setName("user").setDescription("The user to get the avatar of | Default: Yourself")
         );
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     const { renderUser } = client.logger;
-    const member = (interaction.options.getMember("user") ??
-        interaction.member) as Discord.GuildMember;
+    const member = (interaction.options.getMember("user") ?? interaction.member) as Discord.GuildMember;
     await interaction.reply({
         embeds: [
             new EmojiEmbed()
@@ -40,10 +35,7 @@
     });
 };
 
-const check = (
-    _interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     return true;
 };
 
diff --git a/src/commands/user/track.ts b/src/commands/user/track.ts
index 1a4c308..da62880 100644
--- a/src/commands/user/track.ts
+++ b/src/commands/user/track.ts
@@ -1,15 +1,6 @@
 import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, {
-    CommandInteraction,
-    GuildMember,
-    Message,
-    MessageActionRow,
-    MessageButton
-} from "discord.js";
-import {
-    SelectMenuOption,
-    SlashCommandSubcommandBuilder
-} from "@discordjs/builders";
+import Discord, { CommandInteraction, GuildMember, Message, MessageActionRow, MessageButton } from "discord.js";
+import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
 // @ts-expect-error
 import { WrappedCheck } from "jshaiku";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -21,25 +12,13 @@
     builder
         .setName("track")
         .setDescription("Moves a user along a role track")
-        .addUserOption((option) =>
-            option
-                .setName("user")
-                .setDescription("The user to manage")
-                .setRequired(true)
-        );
+        .addUserOption((option) => option.setName("user").setDescription("The user to manage").setRequired(true));
 
-const generateFromTrack = (
-    position: number,
-    active: string | boolean,
-    size: number,
-    disabled: string | boolean
-) => {
+const generateFromTrack = (position: number, active: string | boolean, size: number, disabled: string | boolean) => {
     active = active ? "ACTIVE" : "INACTIVE";
     disabled = disabled ? "GREY." : "";
-    if (position === 0 && size === 1)
-        return "TRACKS.SINGLE." + disabled + active;
-    if (position === size - 1)
-        return "TRACKS.VERTICAL.BOTTOM." + disabled + active;
+    if (position === 0 && size === 1) return "TRACKS.SINGLE." + disabled + active;
+    if (position === size - 1) return "TRACKS.VERTICAL.BOTTOM." + disabled + active;
     if (position === 0) return "TRACKS.VERTICAL.TOP." + disabled + active;
     return "TRACKS.VERTICAL.MIDDLE." + disabled + active;
 };
@@ -66,25 +45,16 @@
         const dropdown = new Discord.MessageSelectMenu()
             .addOptions(
                 config.tracks.map((option, index) => {
-                    const hasRoleInTrack = option.track.some(
-                        (element: string) => {
-                            return memberRoles.cache.has(element);
-                        }
-                    );
+                    const hasRoleInTrack = option.track.some((element: string) => {
+                        return memberRoles.cache.has(element);
+                    });
                     return new SelectMenuOption({
                         default: index === track,
                         label: option.name,
                         value: index.toString(),
-                        description:
-                            option.track.length === 0
-                                ? "No"
-                                : addPlural(option.track.length, "role"),
+                        description: option.track.length === 0 ? "No" : addPlural(option.track.length, "role"),
                         emoji: client.emojis.resolve(
-                            getEmojiByName(
-                                "TRACKS.SINGLE." +
-                                    (hasRoleInTrack ? "ACTIVE" : "INACTIVE"),
-                                "id"
-                            )
+                            getEmojiByName("TRACKS.SINGLE." + (hasRoleInTrack ? "ACTIVE" : "INACTIVE"), "id")
                         )
                     });
                 })
@@ -92,17 +62,9 @@
             .setCustomId("select")
             .setMaxValues(1);
         const allowed = [];
-        generated =
-            "**Track:** " +
-            data.name +
-            "\n" +
-            "**Member:** " +
-            renderUser(member.user) +
-            "\n";
+        generated = "**Track:** " + data.name + "\n" + "**Member:** " + renderUser(member.user) + "\n";
         generated +=
-            (data.nullable
-                ? "Members do not need a role in this track"
-                : "A role in this track is required") + "\n";
+            (data.nullable ? "Members do not need a role in this track" : "A role in this track is required") + "\n";
         generated +=
             (data.retainPrevious
                 ? "When promoted, the user keeps previous roles"
@@ -112,18 +74,12 @@
             data.track
                 .map((role, index) => {
                     const allow =
-                        roles.get(role).position >=
-                            (interaction.member as GuildMember).roles.highest
-                                .position && !managed;
+                        roles.get(role).position >= (interaction.member as GuildMember).roles.highest.position &&
+                        !managed;
                     allowed.push(!allow);
                     return (
                         getEmojiByName(
-                            generateFromTrack(
-                                index,
-                                memberRoles.cache.has(role),
-                                data.track.length,
-                                allow
-                            )
+                            generateFromTrack(index, memberRoles.cache.has(role), data.track.length, allow)
                         ) +
                         " " +
                         roles.get(role).name +
@@ -141,15 +97,11 @@
         let conflictDropdown;
         let currentRoleIndex;
         if (conflict) {
-            generated += `\n\n${getEmojiByName(
-                `PUNISH.WARN.${managed ? "YELLOW" : "RED"}`
-            )} This user has ${selected.length} roles from this track. `;
+            generated += `\n\n${getEmojiByName(`PUNISH.WARN.${managed ? "YELLOW" : "RED"}`)} This user has ${
+                selected.length
+            } roles from this track. `;
             conflictDropdown = [];
-            if (
-                roles.get(selected[0]).position <
-                    memberRoles.highest.position ||
-                managed
-            ) {
+            if (roles.get(selected[0]).position < memberRoles.highest.position || managed) {
                 generated +=
                     "In order to promote or demote this user, you must select which role the member should keep.";
                 selected.forEach((role) => {
@@ -172,10 +124,7 @@
                     "You don't have permission to manage one or more of the users roles, and therefore can't select one to keep.";
             }
         } else {
-            currentRoleIndex =
-                selected.length === 0
-                    ? -1
-                    : data.track.indexOf(selected[0].toString());
+            currentRoleIndex = selected.length === 0 ? -1 : data.track.indexOf(selected[0].toString());
         }
         const m = (await interaction.editReply({
             embeds: [
@@ -187,13 +136,7 @@
             ],
             components: [new MessageActionRow().addComponents(dropdown)]
                 .concat(
-                    conflict && conflictDropdown.length
-                        ? [
-                              new MessageActionRow().addComponents(
-                                  conflictDropdown
-                              )
-                          ]
-                        : []
+                    conflict && conflictDropdown.length ? [new MessageActionRow().addComponents(conflictDropdown)] : []
                 )
                 .concat([
                     new MessageActionRow().addComponents([
@@ -205,9 +148,7 @@
                             .setDisabled(
                                 conflict ||
                                     currentRoleIndex === 0 ||
-                                    (currentRoleIndex === -1
-                                        ? false
-                                        : !allowed[currentRoleIndex - 1])
+                                    (currentRoleIndex === -1 ? false : !allowed[currentRoleIndex - 1])
                             ),
                         new MessageButton()
                             .setEmoji(getEmojiByName("CONTROL.DOWN", "id"))
@@ -218,9 +159,7 @@
                                 conflict ||
                                     (data.nullable
                                         ? currentRoleIndex <= -1
-                                        : currentRoleIndex ===
-                                              data.track.length - 1 ||
-                                          currentRoleIndex <= -1) ||
+                                        : currentRoleIndex === data.track.length - 1 || currentRoleIndex <= -1) ||
                                     !allowed[currentRoleIndex]
                             )
                     ])
@@ -234,9 +173,7 @@
         }
         component.deferUpdate();
         if (component.customId === "conflict") {
-            const rolesToRemove = selected.filter(
-                (role) => role !== component.values[0]
-            );
+            const rolesToRemove = selected.filter((role) => role !== component.values[0]);
             await member.roles.remove(rolesToRemove);
         } else if (component.customId === "promote") {
             if (
@@ -247,16 +184,14 @@
                 if (currentRoleIndex === -1) {
                     await member.roles.add(data.track[data.track.length - 1]);
                 } else if (currentRoleIndex < data.track.length) {
-                    if (!data.retainPrevious)
-                        await member.roles.remove(data.track[currentRoleIndex]);
+                    if (!data.retainPrevious) await member.roles.remove(data.track[currentRoleIndex]);
                     await member.roles.add(data.track[currentRoleIndex - 1]);
                 }
             }
         } else if (component.customId === "demote") {
             if (allowed[currentRoleIndex]) {
                 if (currentRoleIndex === data.track.length - 1) {
-                    if (data.nullable)
-                        await member.roles.remove(data.track[currentRoleIndex]);
+                    if (data.nullable) await member.roles.remove(data.track[currentRoleIndex]);
                 } else if (currentRoleIndex > -1) {
                     await member.roles.remove(data.track[currentRoleIndex]);
                     await member.roles.add(data.track[currentRoleIndex + 1]);
@@ -268,14 +203,9 @@
     }
 };
 
-const check = async (
-    interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
-    const tracks = (await client.database.guilds.read(interaction.guild.id))
-        .tracks;
-    if (tracks.length === 0)
-        throw new Error("This server does not have any tracks");
+const check = async (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
+    const tracks = (await client.database.guilds.read(interaction.guild.id)).tracks;
+    if (tracks.length === 0) throw new Error("This server does not have any tracks");
     const member = interaction.member as GuildMember;
     // Allow the owner to promote anyone
     if (member.id === interaction.guild.ownerId) return true;
@@ -283,12 +213,7 @@
     let managed = false;
     for (const element of tracks) {
         if (!element.track.manageableBy) continue;
-        if (
-            !element.track.manageableBy.some((role) =>
-                member.roles.cache.has(role)
-            )
-        )
-            continue;
+        if (!element.track.manageableBy.some((role) => member.roles.cache.has(role))) continue;
         managed = true;
         break;
     }
diff --git a/src/commands/verify.ts b/src/commands/verify.ts
index 2319284..f2c9c9d 100644
--- a/src/commands/verify.ts
+++ b/src/commands/verify.ts
@@ -4,18 +4,13 @@
 import { WrappedCheck } from "jshaiku";
 import verify from "../reflex/verify.js";
 
-const command = new SlashCommandBuilder()
-    .setName("verify")
-    .setDescription("Get verified in the server");
+const command = new SlashCommandBuilder().setName("verify").setDescription("Get verified in the server");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     verify(interaction);
 };
 
-const check = (
-    _interaction: CommandInteraction,
-    _defaultCheck: WrappedCheck
-) => {
+const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
     return true;
 };
 
diff --git a/src/config/format.ts b/src/config/format.ts
index 7b68ebf..2035754 100644
--- a/src/config/format.ts
+++ b/src/config/format.ts
@@ -3,19 +3,16 @@
 import * as readLine from "node:readline/promises";
 
 const defaultDict = {
-    developmentToken:
-        "Your development bot token (Used for testing in one server, rather than production)",
+    developmentToken: "Your development bot token (Used for testing in one server, rather than production)",
     developmentGuildID: "Your development guild ID",
     enableDevelopment: true,
     token: "Your bot token",
-    managementGuildID:
-        "Your management guild ID (Used for running management commands on the bot)",
+    managementGuildID: "Your management guild ID (Used for running management commands on the bot)",
     owners: [],
     verifySecret:
         "If using verify, enter a code here which matches the secret sent back by your website. You can use a random code if you do not have one already. (Optional)",
     mongoUrl: "Your Mongo connection string, e.g. mongodb://127.0.0.1:27017",
-    baseUrl:
-        "Your website where buttons such as Verify and Role menu will link to, e.g. https://example.com",
+    baseUrl: "Your website where buttons such as Verify and Role menu will link to, e.g. https://example.com",
     pastebinApiKey: "An API key for pastebin (optional)",
     pastebinUsername: "Your pastebin username (optional)",
     pastebinPassword: "Your pastebin password (optional)"
@@ -35,12 +32,8 @@
 
 export default async function (walkthrough = false) {
     if (walkthrough) {
-        console.log(
-            "\x1b[33m🛈  Entering walkthrough mode for any missing values."
-        );
-        console.log(
-            "   \x1b[2mIf you don't want to enter a value, just hit enter.\x1b[0m\n"
-        );
+        console.log("\x1b[33m🛈  Entering walkthrough mode for any missing values.");
+        console.log("   \x1b[2mIf you don't want to enter a value, just hit enter.\x1b[0m\n");
 
         // let toUse = await getInput("\x1b[36m[Installing packages] Use Yarn or NPM? \x1b[0m(\x1b[32my\x1b[0m/\x1b[31mN\x1b[0m) > ");
         // toUse = toUse.toLowerCase() === "y" ? "yarn install" : "npm i";
@@ -59,9 +52,7 @@
         json = JSON.parse(fs.readFileSync("./src/config/main.json", "utf8"));
     } catch (e) {
         console.log("\x1b[31m⚠ No main.json found, creating one.");
-        console.log(
-            "  \x1b[2mYou can edit src/config/main.json directly using template written to the file.\x1b[0m\n"
-        );
+        console.log("  \x1b[2mYou can edit src/config/main.json directly using template written to the file.\x1b[0m\n");
         out = false;
         json = {};
     }
@@ -93,9 +84,7 @@
                         break;
                     }
                     default: {
-                        json[key] = await getInput(
-                            `\x1b[36m${key} \x1b[0m(\x1b[35m${defaultDict[key]}\x1b[0m) > `
-                        );
+                        json[key] = await getInput(`\x1b[36m${key} \x1b[0m(\x1b[35m${defaultDict[key]}\x1b[0m) > `);
                     }
                 }
             } else {
@@ -103,8 +92,7 @@
             }
         }
     }
-    if (walkthrough && !json.mongoUrl)
-        json.mongoUrl = "mongodb://127.0.0.1:27017";
+    if (walkthrough && !json.mongoUrl) json.mongoUrl = "mongodb://127.0.0.1:27017";
     if (!json.mongoUrl.endsWith("/")) json.mongoUrl += "/";
     if (!json.baseUrl.endsWith("/")) json.baseUrl += "/";
     let hosts;
diff --git a/src/events/channelCreate.ts b/src/events/channelCreate.ts
index 7350ebd..19f5c9b 100644
--- a/src/events/channelCreate.ts
+++ b/src/events/channelCreate.ts
@@ -1,19 +1,9 @@
 export const event = "channelCreate";
 
 export async function callback(client, channel) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = channel.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = channel.client.logger;
     const auditLog = await getAuditLog(channel.guild, "CHANNEL_CREATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === channel.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === channel.id).first();
     if (audit.executor.id === client.user.id) return;
     let emoji;
     let readableType;
@@ -73,10 +63,7 @@
                 channel.parent ? channel.parent.name : "Uncategorised"
             ),
             createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                channel.createdTimestamp,
-                renderDelta(channel.createdTimestamp)
-            )
+            created: entry(channel.createdTimestamp, renderDelta(channel.createdTimestamp))
         },
         hidden: {
             guild: channel.guild.id
diff --git a/src/events/channelDelete.ts b/src/events/channelDelete.ts
index defb482..f39e7ed 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -1,15 +1,20 @@
+import {
+    BaseGuildTextChannel,
+    BaseGuildVoiceChannel,
+    GuildChannel,
+    StageChannel,
+    ThreadChannel,
+    VoiceChannel
+} from "discord.js";
+// @ts-expect-error
+import type { HaikuClient } from "jshaiku";
 import getEmojiByName from "../utils/getEmojiByName.js";
 
 export const event = "channelDelete";
-
-export async function callback(client, channel) {
-    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } =
-        client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = client.logger;
 
     const auditLog = await getAuditLog(channel.guild, "CHANNEL_DELETE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === channel.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === channel.id).first();
     if (audit.executor.id === client.user.id) return;
 
     let emoji;
@@ -60,27 +65,26 @@
             channel.parent ? channel.parent.name : "Uncategorised"
         ),
         nsfw: null,
-        created: entry(
-            channel.createdTimestamp,
-            renderDelta(channel.createdTimestamp)
-        ),
+        created: entry(channel.createdTimestamp, renderDelta(channel.createdTimestamp)),
         deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
         deletedBy: entry(audit.executor.id, renderUser(audit.executor))
     };
-    if (channel.topic !== null ?? false)
-        list.topic = entry(
-            channel.topic,
-            `\`\`\`\n${channel.topic.replace("`", "'")}\n\`\`\``
-        );
+    if ((channel instanceof BaseGuildTextChannel || channel instanceof StageChannel) && channel.topic !== null)
+        list.topic = entry(channel.topic, `\`\`\`\n${channel.topic.replace("`", "'")}\n\`\`\``);
     else delete list.topic;
-    if (channel.nsfw !== null ?? false)
+    if (
+        channel instanceof BaseGuildTextChannel ||
+        channel instanceof VoiceChannel ||
+        channel instanceof ThreadChannel
+    ) {
+        const nsfw = channel instanceof ThreadChannel ? (channel as ThreadChannel).parent?.nsfw ?? false : channel.nsfw;
         list.nsfw = entry(
-            channel.nsfw,
-            channel.nsfw
-                ? `${getEmojiByName("CONTROL.TICK")} Yes`
-                : `${getEmojiByName("CONTROL.CROSS")} No`
+            nsfw,
+            nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
         );
-    else delete list.nsfw;
+    } else {
+        delete list.nsfw;
+    }
 
     const data = {
         meta: {
diff --git a/src/events/channelUpdate.ts b/src/events/channelUpdate.ts
index 6717661..a7af453 100644
--- a/src/events/channelUpdate.ts
+++ b/src/events/channelUpdate.ts
@@ -5,22 +5,12 @@
 
 export async function callback(client, oc, nc) {
     const config = await client.memory.readGuildInfo(nc.guild.id);
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderDelta,
-        renderUser,
-        renderChannel
-    } = client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderChannel } = client.logger;
 
     if (nc.parent && nc.parent.id === config.tickets.category) return;
 
     const auditLog = await getAuditLog(nc.guild, "CHANNEL_UPDATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === nc.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === nc.id).first();
     if (audit.executor.id === client.user.id) return;
 
     let emoji: string;
@@ -30,18 +20,11 @@
         channelId: entry(nc.id, `\`${nc.id}\``),
         channel: entry(nc.id, renderChannel(nc)),
         edited: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-        editedBy: entry(
-            audit.executor.id,
-            renderUser((await nc.guild.members.fetch(audit.executor.id)).user)
-        )
+        editedBy: entry(audit.executor.id, renderUser((await nc.guild.members.fetch(audit.executor.id)).user))
     };
-    if (oc.name !== nc.name)
-        changes.name = entry([oc.name, nc.name], `${oc.name} -> ${nc.name}`);
+    if (oc.name !== nc.name) changes.name = entry([oc.name, nc.name], `${oc.name} -> ${nc.name}`);
     if (oc.position !== nc.position)
-        changes.position = entry(
-            [oc.position, nc.position],
-            `${oc.position} -> ${nc.position}`
-        );
+        changes.position = entry([oc.position, nc.position], `${oc.position} -> ${nc.position}`);
 
     switch (nc.type) {
         case "GUILD_TEXT": {
@@ -52,45 +35,28 @@
                 newTopic = nc.topic;
             if (oldTopic) {
                 if (oldTopic.length > 256)
-                    oldTopic = `\`\`\`\n${
-                        oldTopic.replace("`", "'").substring(0, 253) + "..."
-                    }\n\`\`\``;
+                    oldTopic = `\`\`\`\n${oldTopic.replace("`", "'").substring(0, 253) + "..."}\n\`\`\``;
                 else oldTopic = `\`\`\`\n${oldTopic.replace("`", "'")}\n\`\`\``;
             } else {
                 oldTopic = "None";
             }
             if (newTopic) {
                 if (newTopic.length > 256)
-                    newTopic = `\`\`\`\n${
-                        newTopic.replace("`", "'").substring(0, 253) + "..."
-                    }\n\`\`\``;
+                    newTopic = `\`\`\`\n${newTopic.replace("`", "'").substring(0, 253) + "..."}\n\`\`\``;
                 else newTopic = `\`\`\`\n${newTopic.replace("`", "'")}\n\`\`\``;
             } else {
                 newTopic = "None";
             }
             const nsfw = ["", ""];
-            nsfw[0] = oc.nsfw
-                ? `${getEmojiByName("CONTROL.TICK")} Yes`
-                : `${getEmojiByName("CONTROL.CROSS")} No`;
-            nsfw[1] = nc.nsfw
-                ? `${getEmojiByName("CONTROL.TICK")} Yes`
-                : `${getEmojiByName("CONTROL.CROSS")} No`;
+            nsfw[0] = oc.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+            nsfw[1] = nc.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
             if (oc.topic !== nc.topic)
-                changes.description = entry(
-                    [oc.topic, nc.topic],
-                    `\nBefore: ${oldTopic}\nAfter: ${newTopic}`
-                );
-            if (oc.nsfw !== nc.nsfw)
-                changes.nsfw = entry(
-                    [oc.nsfw, nc.nsfw],
-                    `${nsfw[0]} -> ${nsfw[1]}`
-                );
+                changes.description = entry([oc.topic, nc.topic], `\nBefore: ${oldTopic}\nAfter: ${newTopic}`);
+            if (oc.nsfw !== nc.nsfw) changes.nsfw = entry([oc.nsfw, nc.nsfw], `${nsfw[0]} -> ${nsfw[1]}`);
             if (oc.rateLimitPerUser !== nc.rateLimitPerUser)
                 changes.rateLimitPerUser = entry(
                     [oc.rateLimitPerUser, nc.rateLimitPerUser],
-                    `${humanizeDuration(
-                        oc.rateLimitPerUser * 1000
-                    )} -> ${humanizeDuration(nc.rateLimitPerUser * 1000)}`
+                    `${humanizeDuration(oc.rateLimitPerUser * 1000)} -> ${humanizeDuration(nc.rateLimitPerUser * 1000)}`
                 );
 
             break;
@@ -103,27 +69,20 @@
                 newTopic = nc.topic;
             if (oldTopic) {
                 if (oldTopic.length > 256)
-                    oldTopic = `\`\`\`\n${
-                        oldTopic.replace("`", "'").substring(0, 253) + "..."
-                    }\n\`\`\``;
+                    oldTopic = `\`\`\`\n${oldTopic.replace("`", "'").substring(0, 253) + "..."}\n\`\`\``;
                 else oldTopic = `\`\`\`\n${oldTopic.replace("`", "'")}\n\`\`\``;
             } else {
                 oldTopic = "None";
             }
             if (newTopic) {
                 if (newTopic.length > 256)
-                    newTopic = `\`\`\`\n${
-                        newTopic.replace("`", "'").substring(0, 253) + "..."
-                    }\n\`\`\``;
+                    newTopic = `\`\`\`\n${newTopic.replace("`", "'").substring(0, 253) + "..."}\n\`\`\``;
                 else newTopic = `\`\`\`\n${newTopic.replace("`", "'")}\n\`\`\``;
             } else {
                 newTopic = "None";
             }
             if (oc.nsfw !== nc.nsfw)
-                changes.nsfw = entry(
-                    [oc.nsfw, nc.nsfw],
-                    `${oc.nsfw ? "On" : "Off"} -> ${nc.nsfw ? "On" : "Off"}`
-                );
+                changes.nsfw = entry([oc.nsfw, nc.nsfw], `${oc.nsfw ? "On" : "Off"} -> ${nc.nsfw ? "On" : "Off"}`);
             break;
         }
         case "GUILD_VOICE": {
@@ -131,23 +90,16 @@
             readableType = "Voice";
             displayName = "Voice Channel";
             if (oc.bitrate !== nc.bitrate)
-                changes.bitrate = entry(
-                    [oc.bitrate, nc.bitrate],
-                    `${oc.bitrate} -> ${nc.bitrate}`
-                );
+                changes.bitrate = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
             if (oc.userLimit !== nc.userLimit)
                 changes.maxUsers = entry(
                     [oc.userLimit, nc.userLimit],
-                    `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${
-                        nc.userLimit
-                    }`
+                    `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`
                 );
             if (oc.rtcRegion !== nc.rtcRegion)
                 changes.region = entry(
                     [oc.rtcRegion, nc.rtcRegion],
-                    `${oc.rtcRegion || "Automatic"} -> ${
-                        nc.rtcRegion || "Automatic"
-                    }`
+                    `${oc.rtcRegion || "Automatic"} -> ${nc.rtcRegion || "Automatic"}`
                 );
             break;
         }
@@ -159,40 +111,29 @@
                 newTopic = nc.topic;
             if (oldTopic) {
                 if (oldTopic.length > 256)
-                    oldTopic = `\`\`\`\n${
-                        oldTopic.replace("`", "'").substring(0, 253) + "..."
-                    }\n\`\`\``;
+                    oldTopic = `\`\`\`\n${oldTopic.replace("`", "'").substring(0, 253) + "..."}\n\`\`\``;
                 else oldTopic = `\`\`\`\n${oldTopic.replace("`", "'")}\n\`\`\``;
             } else {
                 oldTopic = "None";
             }
             if (newTopic) {
                 if (newTopic.length > 256)
-                    newTopic = `\`\`\`\n${
-                        newTopic.replace("`", "'").substring(0, 253) + "..."
-                    }\n\`\`\``;
+                    newTopic = `\`\`\`\n${newTopic.replace("`", "'").substring(0, 253) + "..."}\n\`\`\``;
                 else newTopic = `\`\`\`\n${newTopic.replace("`", "'")}\n\`\`\``;
             } else {
                 newTopic = "None";
             }
             if (oc.bitrate !== nc.bitrate)
-                changes.bitrate = entry(
-                    [oc.bitrate, nc.bitrate],
-                    `${oc.bitrate} -> ${nc.bitrate}`
-                );
+                changes.bitrate = entry([oc.bitrate, nc.bitrate], `${oc.bitrate} -> ${nc.bitrate}`);
             if (oc.userLimit !== nc.userLimit)
                 changes.maxUsers = entry(
                     [oc.userLimit, nc.userLimit],
-                    `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${
-                        nc.userLimit
-                    }`
+                    `${oc.userLimit ? oc.userLimit : "Unlimited"} -> ${nc.userLimit}`
                 );
             if (oc.rtcRegion !== nc.rtcRegion)
                 changes.region = entry(
                     [oc.rtcRegion, nc.rtcRegion],
-                    `${oc.rtcRegion || "Automatic"} -> ${
-                        nc.rtcRegion || "Automatic"
-                    }`
+                    `${oc.rtcRegion || "Automatic"} -> ${nc.rtcRegion || "Automatic"}`
                 );
             break;
         }
@@ -210,10 +151,7 @@
     }
     const t = oc.type.split("_")[1];
     if (oc.type !== nc.type)
-        changes.type = entry(
-            [oc.type, nc.type],
-            `${t[0] + t.splice(1).toLowerCase()} -> ${readableType}`
-        );
+        changes.type = entry([oc.type, nc.type], `${t[0] + t.splice(1).toLowerCase()} -> ${readableType}`);
     if (!(Object.values(changes).length - 4)) return;
     const data = {
         meta: {
diff --git a/src/events/emojiCreate.ts b/src/events/emojiCreate.ts
index 53f564c..b4e9dfa 100644
--- a/src/events/emojiCreate.ts
+++ b/src/events/emojiCreate.ts
@@ -1,19 +1,9 @@
 export const event = "emojiCreate";
 
 export async function callback(client, emoji) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderEmoji
-    } = emoji.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger;
     const auditLog = await getAuditLog(emoji.guild, "EMOJI_CREATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === emoji.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === emoji.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -28,10 +18,7 @@
             emojiId: entry(emoji.id, `\`${emoji.id}\``),
             emoji: entry(emoji.name, renderEmoji(emoji)),
             createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                emoji.createdTimestamp,
-                renderDelta(emoji.createdTimestamp)
-            )
+            created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp))
         },
         hidden: {
             guild: emoji.guild.id
diff --git a/src/events/emojiDelete.ts b/src/events/emojiDelete.ts
index 041b432..c4b1535 100644
--- a/src/events/emojiDelete.ts
+++ b/src/events/emojiDelete.ts
@@ -1,19 +1,9 @@
 export const event = "emojiDelete";
 
 export async function callback(client, emoji) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderEmoji
-    } = emoji.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger;
     const auditLog = await getAuditLog(emoji.guild, "EMOJI_DELETE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === emoji.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === emoji.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -28,14 +18,8 @@
             emojiId: entry(emoji.id, `\`${emoji.id}\``),
             emoji: entry(emoji.name, renderEmoji(emoji)),
             deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                emoji.createdTimestamp,
-                renderDelta(emoji.createdTimestamp)
-            ),
-            deleted: entry(
-                audit.createdTimestamp,
-                renderDelta(audit.createdTimestamp)
-            )
+            created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp)),
+            deleted: entry(audit.createdTimestamp, renderDelta(audit.createdTimestamp))
         },
         hidden: {
             guild: emoji.guild.id
diff --git a/src/events/emojiUpdate.ts b/src/events/emojiUpdate.ts
index 34b16de..66227d4 100644
--- a/src/events/emojiUpdate.ts
+++ b/src/events/emojiUpdate.ts
@@ -1,15 +1,7 @@
 export const event = "emojiUpdate";
 
 export async function callback(client, oe, ne) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderDelta,
-        renderUser,
-        renderEmoji
-    } = client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderEmoji } = client.logger;
 
     if (oe.name === ne.name) return;
     const auditLog = await getAuditLog(ne.guild, "EMOJI_UPDATE");
@@ -20,10 +12,7 @@
         emojiId: entry(ne.id, `\`${ne.id}\``),
         emoji: entry(ne.id, renderEmoji(ne)),
         edited: entry(ne.createdTimestamp, renderDelta(ne.createdTimestamp)),
-        editedBy: entry(
-            audit.executor.id,
-            renderUser((await ne.guild.members.fetch(audit.executor.id)).user)
-        ),
+        editedBy: entry(audit.executor.id, renderUser((await ne.guild.members.fetch(audit.executor.id)).user)),
         name: entry([oe.name, ne.name], `\`:${oe.name}:\` -> \`:${ne.name}:\``)
     };
     const data = {
diff --git a/src/events/guildBanAdd.ts b/src/events/guildBanAdd.ts
index dd723d3..17c4595 100644
--- a/src/events/guildBanAdd.ts
+++ b/src/events/guildBanAdd.ts
@@ -6,20 +6,11 @@
 export async function callback(client, ban) {
     await statsChannelRemove(client, ban.user);
     purgeByUser(ban.user.id, ban.guild);
-    const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } =
-        ban.user.client.logger;
+    const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = ban.user.client.logger;
     const auditLog = await getAuditLog(ban.guild, "MEMBER_BAN_ADD");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === ban.user.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === ban.user.id).first();
     if (audit.executor.id === client.user.id) return;
-    await client.database.history.create(
-        "ban",
-        ban.guild.id,
-        ban.user,
-        audit.executor,
-        audit.reason
-    );
+    await client.database.history.create("ban", ban.guild.id, ban.user, audit.executor, audit.reason);
     const data = {
         meta: {
             type: "memberBan",
@@ -32,19 +23,10 @@
         list: {
             memberId: entry(ban.user.id, `\`${ban.user.id}\``),
             name: entry(ban.user.id, renderUser(ban.user)),
-            banned: entry(
-                new Date().getTime(),
-                renderDelta(new Date().getTime())
-            ),
+            banned: entry(new Date().getTime(), renderDelta(new Date().getTime())),
             bannedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            reason: entry(
-                audit.reason,
-                audit.reason ? `\n> ${audit.reason}` : "*No reason provided.*"
-            ),
-            accountCreated: entry(
-                ban.user.createdAt,
-                renderDelta(ban.user.createdAt)
-            ),
+            reason: entry(audit.reason, audit.reason ? `\n> ${audit.reason}` : "*No reason provided.*"),
+            accountCreated: entry(ban.user.createdAt, renderDelta(ban.user.createdAt)),
             serverMemberCount: ban.guild.memberCount
         },
         hidden: {
diff --git a/src/events/guildBanRemove.ts b/src/events/guildBanRemove.ts
index 4c2263d..74b7c4e 100644
--- a/src/events/guildBanRemove.ts
+++ b/src/events/guildBanRemove.ts
@@ -6,20 +6,11 @@
 export async function callback(client, ban) {
     await statsChannelRemove(client, ban.user);
     purgeByUser(ban.user.id, ban.guild);
-    const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } =
-        ban.user.client.logger;
+    const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = ban.user.client.logger;
     const auditLog = await getAuditLog(ban.guild, "MEMBER_BAN_REMOVE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === ban.user.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === ban.user.id).first();
     if (audit.executor.id === client.user.id) return;
-    await client.database.history.create(
-        "unban",
-        ban.guild.id,
-        ban.user,
-        audit.executor,
-        audit.reason
-    );
+    await client.database.history.create("unban", ban.guild.id, ban.user, audit.executor, audit.reason);
     const data = {
         meta: {
             type: "memberUnban",
@@ -32,15 +23,9 @@
         list: {
             memberId: entry(ban.user.id, `\`${ban.user.id}\``),
             name: entry(ban.user.id, renderUser(ban.user)),
-            unbanned: entry(
-                new Date().getTime(),
-                renderDelta(new Date().getTime())
-            ),
+            unbanned: entry(new Date().getTime(), renderDelta(new Date().getTime())),
             unbannedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            accountCreated: entry(
-                ban.user.createdAt,
-                renderDelta(ban.user.createdAt)
-            )
+            accountCreated: entry(ban.user.createdAt, renderDelta(ban.user.createdAt))
         },
         hidden: {
             guild: ban.guild.id
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index 4cffe69..08730f2 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -2,18 +2,9 @@
 
 export async function callback(client, before, after) {
     try {
-        const {
-            log,
-            NucleusColors,
-            entry,
-            renderUser,
-            renderDelta,
-            getAuditLog
-        } = after.client.logger;
+        const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = after.client.logger;
         const auditLog = await getAuditLog(after.guild, "MEMBER_UPDATE");
-        const audit = auditLog.entries
-            .filter((entry) => entry.target.id === after.id)
-            .first();
+        const audit = auditLog.entries.filter((entry) => entry.target.id === after.id).first();
         if (audit.executor.id === client.user.id) return;
         if (before.nickname !== after.nickname) {
             await client.database.history.create(
@@ -37,22 +28,10 @@
                 list: {
                     memberId: entry(after.id, `\`${after.id}\``),
                     name: entry(after.user.id, renderUser(after.user)),
-                    before: entry(
-                        before.nickname,
-                        before.nickname ? before.nickname : "*None*"
-                    ),
-                    after: entry(
-                        after.nickname,
-                        after.nickname ? after.nickname : "*None*"
-                    ),
-                    changed: entry(
-                        new Date().getTime(),
-                        renderDelta(new Date().getTime())
-                    ),
-                    changedBy: entry(
-                        audit.executor.id,
-                        renderUser(audit.executor)
-                    )
+                    before: entry(before.nickname, before.nickname ? before.nickname : "*None*"),
+                    after: entry(after.nickname, after.nickname ? after.nickname : "*None*"),
+                    changed: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                    changedBy: entry(audit.executor.id, renderUser(audit.executor))
                 },
                 hidden: {
                     guild: after.guild.id
@@ -89,33 +68,20 @@
                         after.communicationDisabledUntilTimestamp,
                         renderDelta(after.communicationDisabledUntilTimestamp)
                     ),
-                    muted: entry(
-                        new Date().getTime(),
-                        renderDelta(new Date().getTime())
-                    ),
-                    mutedBy: entry(
-                        audit.executor.id,
-                        renderUser(audit.executor)
-                    ),
-                    reason: entry(
-                        audit.reason,
-                        audit.reason ? audit.reason : "\n> *No reason provided*"
-                    )
+                    muted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                    mutedBy: entry(audit.executor.id, renderUser(audit.executor)),
+                    reason: entry(audit.reason, audit.reason ? audit.reason : "\n> *No reason provided*")
                 },
                 hidden: {
                     guild: after.guild.id
                 }
             };
             log(data);
-            client.database.eventScheduler.schedule(
-                "naturalUnmute",
-                after.communicationDisabledUntil,
-                {
-                    guild: after.guild.id,
-                    user: after.id,
-                    expires: after.communicationDisabledUntilTimestamp
-                }
-            );
+            client.database.eventScheduler.schedule("naturalUnmute", after.communicationDisabledUntil, {
+                guild: after.guild.id,
+                user: after.id,
+                expires: after.communicationDisabledUntilTimestamp
+            });
         } else if (
             after.communicationDisabledUntil === null &&
             before.communicationDisabledUntilTimestamp !== null &&
@@ -143,14 +109,8 @@
                 list: {
                     memberId: entry(after.id, `\`${after.id}\``),
                     name: entry(after.user.id, renderUser(after.user)),
-                    unmuted: entry(
-                        new Date().getTime(),
-                        renderDelta(new Date().getTime())
-                    ),
-                    unmutedBy: entry(
-                        audit.executor.id,
-                        renderUser(audit.executor)
-                    )
+                    unmuted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                    unmutedBy: entry(audit.executor.id, renderUser(audit.executor))
                 },
                 hidden: {
                     guild: after.guild.id
diff --git a/src/events/guildUpdate.ts b/src/events/guildUpdate.ts
index 2c87807..a165770 100644
--- a/src/events/guildUpdate.ts
+++ b/src/events/guildUpdate.ts
@@ -4,12 +4,9 @@
 
 export async function callback(client, before, after) {
     await statsChannelUpdate(client, after.me);
-    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } =
-        after.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = after.client.logger;
     const auditLog = await getAuditLog(after, "GUILD_UPDATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === after.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === after.id).first();
     if (audit.executor.id === client.user.id) return;
     const list = {};
 
@@ -32,16 +29,9 @@
         ELEVATED: "Enabled"
     };
 
-    if (before.name !== after.name)
-        list.name = entry(
-            [before.name, after.name],
-            `${before.name} -> ${after.name}`
-        );
+    if (before.name !== after.name) list.name = entry([before.name, after.name], `${before.name} -> ${after.name}`);
     if (before.icon !== after.icon)
-        list.icon = entry(
-            [before.icon, after.icon],
-            `[Before](${before.iconURL()}) -> [After](${after.iconURL()})`
-        );
+        list.icon = entry([before.icon, after.icon], `[Before](${before.iconURL()}) -> [After](${after.iconURL()})`);
     if (before.splash !== after.splash)
         list.splash = entry(
             [before.splash, after.splash],
@@ -55,19 +45,12 @@
     if (before.owner !== after.owner)
         list.owner = entry(
             [before.owner, after.owner],
-            `${renderUser(before.owner.user)} -> ${renderUser(
-                after.owner.user
-            )}`
+            `${renderUser(before.owner.user)} -> ${renderUser(after.owner.user)}`
         );
     if (before.verificationLevel !== after.verificationLevel)
         list.verificationLevel = entry(
-            [
-                verificationLevels[before.verificationLevel],
-                verificationLevels[after.verificationLevel]
-            ],
-            `${verificationLevels[before.verificationLevel]} -> ${
-                verificationLevels[after.verificationLevel]
-            }`
+            [verificationLevels[before.verificationLevel], verificationLevels[after.verificationLevel]],
+            `${verificationLevels[before.verificationLevel]} -> ${verificationLevels[after.verificationLevel]}`
         );
     if (before.explicitContentFilter !== after.explicitContentFilter)
         list.explicitContentFilter = entry(
@@ -86,10 +69,7 @@
         );
 
     if (!Object.keys(list).length) return;
-    list.updated = entry(
-        new Date().getTime(),
-        renderDelta(new Date().getTime())
-    );
+    list.updated = entry(new Date().getTime(), renderDelta(new Date().getTime()));
     list.updatedBy = entry(audit.executor.id, renderUser(audit.executor));
     const data = {
         meta: {
diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts
index 60b90e3..5b0aff1 100644
--- a/src/events/interactionCreate.ts
+++ b/src/events/interactionCreate.ts
@@ -20,25 +20,16 @@
         findAllMatches: true,
         minMatchCharLength: 0
     }).search(typed);
-    return fuse
-        .slice(0, 25)
-        .map((option) => ({ name: option.item, value: option.item }));
+    return fuse.slice(0, 25).map((option) => ({ name: option.item, value: option.item }));
 }
 
 function generateStatsChannelAutocomplete(typed) {
-    const validReplacements = [
-        "serverName",
-        "memberCount",
-        "memberCount:bots",
-        "memberCount:humans"
-    ];
+    const validReplacements = ["serverName", "memberCount", "memberCount:bots", "memberCount:humans"];
     const autocompletions = [];
     const beforeLastOpenBracket = typed.match(/(.*){[^{}]{0,15}$/);
     if (beforeLastOpenBracket !== null) {
         for (const replacement of validReplacements) {
-            autocompletions.push(
-                `${beforeLastOpenBracket[1]} {${replacement}}`
-            );
+            autocompletions.push(`${beforeLastOpenBracket[1]} {${replacement}}`);
         }
     } else {
         for (const replacement of validReplacements) {
@@ -60,9 +51,7 @@
     const beforeLastOpenBracket = typed.match(/(.*){[^{}]{0,15}$/);
     if (beforeLastOpenBracket !== null) {
         for (const replacement of validReplacements) {
-            autocompletions.push(
-                `${beforeLastOpenBracket[1]} {${replacement}}`
-            );
+            autocompletions.push(`${beforeLastOpenBracket[1]} {${replacement}}`);
         }
     } else {
         for (const replacement of validReplacements) {
@@ -93,32 +82,21 @@
         }
     } else if (interaction.type === "APPLICATION_COMMAND_AUTOCOMPLETE") {
         switch (
-            `${
-                interaction.commandName
-            } ${interaction.options.getSubcommandGroup(
+            `${interaction.commandName} ${interaction.options.getSubcommandGroup(
                 false
             )} ${interaction.options.getSubcommand(false)}`
         ) {
             case "tag null null": {
                 return interaction.respond(
-                    getAutocomplete(
-                        interaction.options.getString("tag"),
-                        await tagAutocomplete(interaction)
-                    )
+                    getAutocomplete(interaction.options.getString("tag"), await tagAutocomplete(interaction))
                 );
             }
             case "settings null stats": {
-                return interaction.respond(
-                    generateStatsChannelAutocomplete(
-                        interaction.options.getString("name")
-                    )
-                );
+                return interaction.respond(generateStatsChannelAutocomplete(interaction.options.getString("name")));
             }
             case "settings null welcome": {
                 return interaction.respond(
-                    generateWelcomeMessageAutocomplete(
-                        interaction.options.getString("message")
-                    )
+                    generateWelcomeMessageAutocomplete(interaction.options.getString("message"))
                 );
             }
         }
diff --git a/src/events/inviteCreate.ts b/src/events/inviteCreate.ts
index 5461307..7b23bb2 100644
--- a/src/events/inviteCreate.ts
+++ b/src/events/inviteCreate.ts
@@ -2,19 +2,9 @@
 export const event = "inviteCreate";
 
 export async function callback(client, invite) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = invite.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = invite.client.logger;
     const auditLog = await getAuditLog(invite.guild, "INVITE_CREATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === invite.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === invite.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -28,15 +18,9 @@
         list: {
             channel: entry(invite.channel.id, renderChannel(invite.channel)),
             link: entry(invite.url, invite.url),
-            expires: entry(
-                invite.maxAge,
-                invite.maxAge ? humanizeDuration(invite.maxAge * 1000) : "Never"
-            ),
+            expires: entry(invite.maxAge, invite.maxAge ? humanizeDuration(invite.maxAge * 1000) : "Never"),
             createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                invite.createdTimestamp,
-                renderDelta(invite.createdTimestamp)
-            )
+            created: entry(invite.createdTimestamp, renderDelta(invite.createdTimestamp))
         },
         hidden: {
             guild: invite.guild.id
diff --git a/src/events/inviteDelete.ts b/src/events/inviteDelete.ts
index e5bf241..2cd3bc5 100644
--- a/src/events/inviteDelete.ts
+++ b/src/events/inviteDelete.ts
@@ -2,19 +2,9 @@
 export const event = "inviteDelete";
 
 export async function callback(client, invite) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = invite.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = invite.client.logger;
     const auditLog = await getAuditLog(invite.guild, "INVITE_DELETE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === invite.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === invite.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -28,15 +18,9 @@
         list: {
             channel: entry(invite.channel.id, renderChannel(invite.channel)),
             link: entry(invite.url, invite.url),
-            expires: entry(
-                invite.maxAge,
-                invite.maxAge ? humanizeDuration(invite.maxAge * 1000) : "Never"
-            ),
+            expires: entry(invite.maxAge, invite.maxAge ? humanizeDuration(invite.maxAge * 1000) : "Never"),
             deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            deleted: entry(
-                new Date().getTime(),
-                renderDelta(new Date().getTime())
-            )
+            deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
         },
         hidden: {
             guild: invite.guild.id
diff --git a/src/events/memberJoin.ts b/src/events/memberJoin.ts
index ea0b24d..ebc2934 100644
--- a/src/events/memberJoin.ts
+++ b/src/events/memberJoin.ts
@@ -7,15 +7,8 @@
 export async function callback(_, member) {
     welcome(_, member);
     statsChannelAdd(_, member);
-    const { log, NucleusColors, entry, renderUser, renderDelta } =
-        member.client.logger;
-    await client.database.history.create(
-        "join",
-        member.guild.id,
-        member.user,
-        null,
-        null
-    );
+    const { log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger;
+    await client.database.history.create("join", member.guild.id, member.user, null, null);
     const data = {
         meta: {
             type: "memberJoin",
@@ -29,10 +22,7 @@
             memberId: entry(member.id, `\`${member.id}\``),
             name: entry(member.id, renderUser(member.user)),
             joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
-            accountCreated: entry(
-                member.user.createdAt,
-                renderDelta(member.user.createdAt)
-            ),
+            accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
             serverMemberCount: member.guild.memberCount
         },
         hidden: {
diff --git a/src/events/memberLeave.ts b/src/events/memberLeave.ts
index d170396..00f6d84 100644
--- a/src/events/memberLeave.ts
+++ b/src/events/memberLeave.ts
@@ -6,12 +6,9 @@
 export async function callback(client, member) {
     purgeByUser(member.id, member.guild);
     await statsChannelRemove(client, member);
-    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } =
-        member.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger;
     const auditLog = await getAuditLog(member.guild, "MEMBER_KICK");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === member.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === member.id).first();
     let type = "leave";
     if (audit) {
         if (audit.executor.id === client.user.id) return;
@@ -21,13 +18,7 @@
     }
     let data;
     if (type === "kick") {
-        await client.database.history.create(
-            "kick",
-            member.guild.id,
-            member.user,
-            audit.executor,
-            audit.reason
-        );
+        await client.database.history.create("kick", member.guild.id, member.user, audit.executor, audit.reason);
         data = {
             meta: {
                 type: "memberKick",
@@ -41,21 +32,10 @@
                 memberId: entry(member.id, `\`${member.id}\``),
                 name: entry(member.id, renderUser(member.user)),
                 joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
-                kicked: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                ),
+                kicked: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                 kickedBy: entry(audit.executor.id, renderUser(audit.executor)),
-                reason: entry(
-                    audit.reason,
-                    audit.reason
-                        ? `\n> ${audit.reason}`
-                        : "*No reason provided.*"
-                ),
-                accountCreated: entry(
-                    member.user.createdAt,
-                    renderDelta(member.user.createdAt)
-                ),
+                reason: entry(audit.reason, audit.reason ? `\n> ${audit.reason}` : "*No reason provided.*"),
+                accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
                 serverMemberCount: member.guild.memberCount
             },
             hidden: {
@@ -63,13 +43,7 @@
             }
         };
     } else {
-        await client.database.history.create(
-            "leave",
-            member.guild.id,
-            member.user,
-            null,
-            null
-        );
+        await client.database.history.create("leave", member.guild.id, member.user, null, null);
         data = {
             meta: {
                 type: "memberLeave",
@@ -82,18 +56,9 @@
             list: {
                 memberId: entry(member.id, `\`${member.id}\``),
                 name: entry(member.id, renderUser(member.user)),
-                joined: entry(
-                    member.joinedTimestamp,
-                    renderDelta(member.joinedAt)
-                ),
-                left: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                ),
-                accountCreated: entry(
-                    member.user.createdAt,
-                    renderDelta(member.user.createdAt)
-                ),
+                joined: entry(member.joinedTimestamp, renderDelta(member.joinedAt)),
+                left: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+                accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
                 serverMemberCount: member.guild.memberCount
             },
             hidden: {
diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts
index 7e4a52f..f690885 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -1,13 +1,6 @@
 // @ts-expect-error
 import { HaikuClient } from "jshaiku";
-import {
-    LinkCheck,
-    MalwareCheck,
-    NSFWCheck,
-    SizeCheck,
-    TestString,
-    TestImage
-} from "../reflex/scanners.js";
+import { LinkCheck, MalwareCheck, NSFWCheck, SizeCheck, TestString, TestImage } from "../reflex/scanners.js";
 import logAttachment from "../premium/attachmentLogs.js";
 import createLogException from "../utils/createLogException.js";
 import getEmojiByName from "../utils/getEmojiByName.js";
@@ -27,14 +20,7 @@
         console.log(e);
     }
 
-    const {
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = client.logger;
+    const { log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = client.logger;
 
     const fileNames = await logAttachment(message);
 
@@ -43,9 +29,7 @@
     const filter = getEmojiByName("ICONS.FILTER");
     let attachmentJump = "";
     if (config.logging.attachments.saved[message.channel.id + message.id]) {
-        attachmentJump = ` [[View attachments]](${
-            config.logging.attachments.saved[message.channel.id + message.id]
-        })`;
+        attachmentJump = ` [[View attachments]](${config.logging.attachments.saved[message.channel.id + message.id]})`;
     }
     const list = {
         messageId: entry(message.id, `\`${message.id}\``),
@@ -53,10 +37,7 @@
         sentIn: entry(message.channel.id, renderChannel(message.channel)),
         deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
         mentions: message.mentions.users.size,
-        attachments: entry(
-            message.attachments.size,
-            message.attachments.size + attachmentJump
-        ),
+        attachments: entry(message.attachments.size, message.attachments.size + attachmentJump),
         repliedTo: entry(
             message.reference ? message.reference.messageId : null,
             message.reference
@@ -66,25 +47,14 @@
     };
 
     if (config.filters.invite.enabled) {
-        if (
-            !config.filters.invite.allowed.channels.includes(message.channel.id)
-        ) {
-            if (
-                /(?:https?:\/\/)?discord(?:app)?\.(?:com\/invite|gg)\/[a-zA-Z0-9]+\/?/.test(
-                    content
-                )
-            ) {
-                createLogException(
-                    message.guild.id,
-                    message.channel.id,
-                    message.id
-                );
+        if (!config.filters.invite.allowed.channels.includes(message.channel.id)) {
+            if (/(?:https?:\/\/)?discord(?:app)?\.(?:com\/invite|gg)\/[a-zA-Z0-9]+\/?/.test(content)) {
+                createLogException(message.guild.id, message.channel.id, message.id);
                 message.delete();
                 const data = {
                     meta: {
                         type: "messageDelete",
-                        displayName:
-                            "Message Deleted (Automated, Contained Invite)",
+                        displayName: "Message Deleted (Automated, Contained Invite)",
                         calculateType: "autoModeratorDeleted",
                         color: NucleusColors.red,
                         emoji: "MESSAGE.DELETE",
@@ -94,9 +64,7 @@
                         start:
                             filter +
                             " Contained invite\n\n" +
-                            (content
-                                ? `**Message:**\n\`\`\`${content}\`\`\``
-                                : "**Message:** *Message had no content*")
+                            (content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*")
                     },
                     list: list,
                     hidden: {
@@ -111,21 +79,13 @@
     if (fileNames.files.length > 0) {
         for (const element of fileNames.files) {
             const url = element.url ? element.url : element.local;
-            if (
-                /\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/.test(url)
-            ) {
+            if (/\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/.test(url)) {
                 if (
                     config.filters.images.NSFW &&
-                    !(message.channel instanceof ThreadChannel
-                        ? message.channel.parent?.nsfw
-                        : message.channel.nsfw)
+                    !(message.channel instanceof ThreadChannel ? message.channel.parent?.nsfw : message.channel.nsfw)
                 ) {
                     if (await NSFWCheck(url)) {
-                        createLogException(
-                            message.guild.id,
-                            message.channel.id,
-                            message.id
-                        );
+                        createLogException(message.guild.id, message.channel.id, message.id);
                         await message.delete();
                         const data = {
                             meta: {
@@ -160,11 +120,7 @@
                         config.filters.wordFilter.words.strict
                     );
                     if (check !== null) {
-                        createLogException(
-                            message.guild.id,
-                            message.channel.id,
-                            message.id
-                        );
+                        createLogException(message.guild.id, message.channel.id, message.id);
                         await message.delete();
                         const data = {
                             meta: {
@@ -194,11 +150,7 @@
                 if (config.filters.images.size) {
                     if (url.match(/\.+(webp|png|jpg)$/gi)) {
                         if (!(await SizeCheck(element))) {
-                            createLogException(
-                                message.guild.id,
-                                message.channel.id,
-                                message.id
-                            );
+                            createLogException(message.guild.id, message.channel.id, message.id);
                             await message.delete();
                             const data = {
                                 meta: {
@@ -229,11 +181,7 @@
             }
             if (config.filters.malware) {
                 if (!(await MalwareCheck(url))) {
-                    createLogException(
-                        message.guild.id,
-                        message.channel.id,
-                        message.id
-                    );
+                    createLogException(message.guild.id, message.channel.id, message.id);
                     await message.delete();
                     const data = {
                         meta: {
@@ -280,9 +228,7 @@
                 start:
                     filter +
                     ` Link filtered as ${linkDetectionTypes[0]?.toLowerCase()}\n\n` +
-                    (content
-                        ? `**Message:**\n\`\`\`${content}\`\`\``
-                        : "**Message:** *Message had no content*")
+                    (content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*")
             },
             list: list,
             hidden: {
@@ -299,11 +245,7 @@
             config.filters.wordFilter.words.strict
         );
         if (check !== null) {
-            createLogException(
-                message.guild.id,
-                message.channel.id,
-                message.id
-            );
+            createLogException(message.guild.id, message.channel.id, message.id);
             await message.delete();
             const data = {
                 meta: {
@@ -318,9 +260,7 @@
                     start:
                         filter +
                         " Message contained filtered word\n\n" +
-                        (content
-                            ? `**Message:**\n\`\`\`${content}\`\`\``
-                            : "**Message:** *Message had no content*")
+                        (content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*")
                 },
                 list: list,
                 hidden: {
@@ -342,9 +282,7 @@
                 timestamp: new Date().getTime()
             },
             separate: {
-                start: content
-                    ? `**Message:**\n\`\`\`${content}\`\`\``
-                    : "**Message:** *Message had no content*"
+                start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*"
             },
             list: list,
             hidden: {
@@ -356,11 +294,7 @@
     if (config.filters.pings.roles) {
         for (const roleId in message.mentions.roles) {
             if (!config.filters.pings.allowed.roles.includes(roleId)) {
-                createLogException(
-                    message.guild.id,
-                    message.channel.id,
-                    message.id
-                );
+                createLogException(message.guild.id, message.channel.id, message.id);
                 await message.delete();
                 const data = {
                     meta: {
@@ -385,10 +319,7 @@
             }
         }
     }
-    if (
-        message.mentions.users.size >= config.filters.pings.mass &&
-        config.filters.pings.mass
-    ) {
+    if (message.mentions.users.size >= config.filters.pings.mass && config.filters.pings.mass) {
         createLogException(message.guild.id, message.channel.id, message.id);
         await message.delete();
         const data = {
@@ -401,9 +332,7 @@
                 timestamp: new Date().getTime()
             },
             separate: {
-                start: content
-                    ? `**Message:**\n\`\`\`${content}\`\`\``
-                    : "**Message:** *Message had no content*"
+                start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*"
             },
             list: list,
             hidden: {
diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts
index 4cdbdb2..3a72876 100644
--- a/src/events/messageDelete.ts
+++ b/src/events/messageDelete.ts
@@ -3,25 +3,11 @@
 export async function callback(client, message) {
     try {
         if (message.author.id === client.user.id) return;
-        if (
-            client.noLog.includes(
-                `${message.guild.id}/${message.channel.id}/${message.id}`
-            )
-        )
-            return;
-        const {
-            getAuditLog,
-            log,
-            NucleusColors,
-            entry,
-            renderUser,
-            renderDelta,
-            renderChannel
-        } = message.channel.client.logger;
+        if (client.noLog.includes(`${message.guild.id}/${message.channel.id}/${message.id}`)) return;
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } =
+            message.channel.client.logger;
         const auditLog = await getAuditLog(message.guild, "MEMBER_BAN_ADD");
-        const audit = auditLog.entries
-            .filter((entry) => entry.target.id === message.author.id)
-            .first();
+        const audit = auditLog.entries.filter((entry) => entry.target.id === message.author.id).first();
         if (audit) {
             if (audit.createdAt - 100 < new Date().getTime()) return;
         }
@@ -37,8 +23,9 @@
                 ) ?? []
             ).length;
         let attachmentJump = "";
-        const config = (await client.database.guilds.read(message.guild.id))
-            .logging.attachments.saved[message.channel.id + message.id];
+        const config = (await client.database.guilds.read(message.guild.id)).logging.attachments.saved[
+            message.channel.id + message.id
+        ];
         if (config) {
             attachmentJump = ` [[View attachments]](${config})`;
         }
@@ -52,21 +39,13 @@
                 timestamp: new Date().getTime()
             },
             separate: {
-                start: content
-                    ? `**Message:**\n\`\`\`${content}\`\`\``
-                    : "**Message:** *Message had no content*"
+                start: content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*"
             },
             list: {
                 messageId: entry(message.id, `\`${message.id}\``),
                 sentBy: entry(message.author.id, renderUser(message.author)),
-                sentIn: entry(
-                    message.channel.id,
-                    renderChannel(message.channel)
-                ),
-                deleted: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                ),
+                sentIn: entry(message.channel.id, renderChannel(message.channel)),
+                deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                 mentions: message.mentions.users.size,
                 attachments: entry(attachments, attachments + attachmentJump),
                 repliedTo: entry(
diff --git a/src/events/messageEdit.ts b/src/events/messageEdit.ts
index c83512c..1470832 100644
--- a/src/events/messageEdit.ts
+++ b/src/events/messageEdit.ts
@@ -2,29 +2,20 @@
 
 export async function callback(client, oldMessage, newMessage) {
     if (newMessage.author.id === client.user.id) return;
-    const {
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderNumberDelta,
-        renderChannel
-    } = newMessage.channel.client.logger;
+    const { log, NucleusColors, entry, renderUser, renderDelta, renderNumberDelta, renderChannel } =
+        newMessage.channel.client.logger;
     newMessage.reference = newMessage.reference || {};
     let newContent = newMessage.cleanContent.replaceAll("`", "‘");
     let oldContent = oldMessage.cleanContent.replaceAll("`", "‘");
     let attachmentJump = "";
-    const config = (await client.database.guilds.read(newMessage.guild.id))
-        .logging.attachments.saved[newMessage.channel.id + newMessage.id];
+    const config = (await client.database.guilds.read(newMessage.guild.id)).logging.attachments.saved[
+        newMessage.channel.id + newMessage.id
+    ];
     if (config) {
         attachmentJump = ` [[View attachments]](${config})`;
     }
     if (newContent === oldContent) {
-        if (
-            !oldMessage.flags.has("CROSSPOSTED") &&
-            newMessage.flags.has("CROSSPOSTED")
-        ) {
+        if (!oldMessage.flags.has("CROSSPOSTED") && newMessage.flags.has("CROSSPOSTED")) {
             const data = {
                 meta: {
                     type: "messageAnnounce",
@@ -39,14 +30,8 @@
                 },
                 list: {
                     messageId: entry(newMessage.id, `\`${newMessage.id}\``),
-                    sentBy: entry(
-                        newMessage.author.id,
-                        renderUser(newMessage.author)
-                    ),
-                    sentIn: entry(
-                        newMessage.channel.id,
-                        renderChannel(newMessage.channel)
-                    ),
+                    sentBy: entry(newMessage.author.id, renderUser(newMessage.author)),
+                    sentIn: entry(newMessage.channel.id, renderChannel(newMessage.channel)),
                     sent: entry(
                         new Date(newMessage.createdTimestamp),
                         renderDelta(new Date(newMessage.createdTimestamp))
@@ -55,19 +40,10 @@
                         new Date(newMessage.editedTimestamp),
                         renderDelta(new Date(newMessage.editedTimestamp))
                     ),
-                    mentions: renderNumberDelta(
-                        oldMessage.mentions.users.size,
-                        newMessage.mentions.users.size
-                    ),
+                    mentions: renderNumberDelta(oldMessage.mentions.users.size, newMessage.mentions.users.size),
                     attachments: entry(
-                        renderNumberDelta(
-                            oldMessage.attachments.size,
-                            newMessage.attachments.size
-                        ),
-                        renderNumberDelta(
-                            oldMessage.attachments.size,
-                            newMessage.attachments.size
-                        ) + attachmentJump
+                        renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size),
+                        renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size) + attachmentJump
                     )
                 },
                 hidden: {
@@ -80,10 +56,8 @@
     if (!newMessage.editedTimestamp) {
         return;
     }
-    if (newContent.length > 256)
-        newContent = newContent.substring(0, 253) + "...";
-    if (oldContent.length > 256)
-        oldContent = oldContent.substring(0, 253) + "...";
+    if (newContent.length > 256) newContent = newContent.substring(0, 253) + "...";
+    if (oldContent.length > 256) oldContent = oldContent.substring(0, 253) + "...";
     const data = {
         meta: {
             type: "messageUpdate",
@@ -98,39 +72,19 @@
                 (oldContent
                     ? `**Before:**\n\`\`\`\n${oldContent}\n\`\`\`\n`
                     : "**Before:** *Message had no content*\n") +
-                (newContent
-                    ? `**After:**\n\`\`\`\n${newContent}\n\`\`\``
-                    : "**After:** *Message had no content*"),
+                (newContent ? `**After:**\n\`\`\`\n${newContent}\n\`\`\`` : "**After:** *Message had no content*"),
             end: `[[Jump to message]](${newMessage.url})`
         },
         list: {
             messageId: entry(newMessage.id, `\`${newMessage.id}\``),
             sentBy: entry(newMessage.author.id, renderUser(newMessage.author)),
-            sentIn: entry(
-                newMessage.channel.id,
-                renderChannel(newMessage.channel)
-            ),
-            sent: entry(
-                new Date(newMessage.createdTimestamp),
-                renderDelta(new Date(newMessage.createdTimestamp))
-            ),
-            edited: entry(
-                new Date(newMessage.editedTimestamp),
-                renderDelta(new Date(newMessage.editedTimestamp))
-            ),
-            mentions: renderNumberDelta(
-                oldMessage.mentions.users.size,
-                newMessage.mentions.users.size
-            ),
+            sentIn: entry(newMessage.channel.id, renderChannel(newMessage.channel)),
+            sent: entry(new Date(newMessage.createdTimestamp), renderDelta(new Date(newMessage.createdTimestamp))),
+            edited: entry(new Date(newMessage.editedTimestamp), renderDelta(new Date(newMessage.editedTimestamp))),
+            mentions: renderNumberDelta(oldMessage.mentions.users.size, newMessage.mentions.users.size),
             attachments: entry(
-                renderNumberDelta(
-                    oldMessage.attachments.size,
-                    newMessage.attachments.size
-                ),
-                renderNumberDelta(
-                    oldMessage.attachments.size,
-                    newMessage.attachments.size
-                ) + attachmentJump
+                renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size),
+                renderNumberDelta(oldMessage.attachments.size, newMessage.attachments.size) + attachmentJump
             ),
             repliedTo: entry(
                 newMessage.reference.messageId || null,
diff --git a/src/events/roleCreate.ts b/src/events/roleCreate.ts
index f0051a0..f1b0a91 100644
--- a/src/events/roleCreate.ts
+++ b/src/events/roleCreate.ts
@@ -1,20 +1,10 @@
 export const event = "roleCreate";
 
 export async function callback(client, role) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderRole
-    } = role.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderRole } = role.client.logger;
     if (role.managed) return;
     const auditLog = await getAuditLog(role.guild, "ROLE_CREATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === role.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === role.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -29,10 +19,7 @@
             roleId: entry(role.id, `\`${role.id}\``),
             role: entry(role.name, renderRole(role)),
             createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                role.createdTimestamp,
-                renderDelta(role.createdTimestamp)
-            )
+            created: entry(role.createdTimestamp, renderDelta(role.createdTimestamp))
         },
         hidden: {
             guild: role.guild.id
diff --git a/src/events/roleDelete.ts b/src/events/roleDelete.ts
index 185ea8e..4807e7d 100644
--- a/src/events/roleDelete.ts
+++ b/src/events/roleDelete.ts
@@ -3,13 +3,10 @@
 export const event = "roleDelete";
 
 export async function callback(client, role) {
-    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } =
-        role.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = role.client.logger;
     if (role.managed) return;
     const auditLog = await getAuditLog(role.guild, "ROLE_DELETE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === role.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === role.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -26,26 +23,16 @@
             color: entry(role.hexColor, `\`${role.hexColor}\``),
             showInMemberList: entry(
                 role.hoist,
-                role.hoist
-                    ? `${getEmojiByName("CONTROL.TICK")} Yes`
-                    : `${getEmojiByName("CONTROL.CROSS")} No`
+                role.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
             ),
             mentionable: entry(
                 role.mentionable,
-                role.mentionable
-                    ? `${getEmojiByName("CONTROL.TICK")} Yes`
-                    : `${getEmojiByName("CONTROL.CROSS")} No`
+                role.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
             ),
             members: entry(role.members.size, `${role.members.size}`),
             deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                role.createdTimestamp,
-                renderDelta(role.createdTimestamp)
-            ),
-            deleted: entry(
-                new Date().getTime(),
-                renderDelta(new Date().getTime())
-            )
+            created: entry(role.createdTimestamp, renderDelta(role.createdTimestamp)),
+            deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
         },
         hidden: {
             guild: role.guild.id
diff --git a/src/events/roleUpdate.ts b/src/events/roleUpdate.ts
index be276e5..53bbdee 100644
--- a/src/events/roleUpdate.ts
+++ b/src/events/roleUpdate.ts
@@ -3,15 +3,7 @@
 export const event = "roleUpdate";
 
 export async function callback(client, or, nr) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderDelta,
-        renderUser,
-        renderRole
-    } = client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser, renderRole } = client.logger;
 
     const auditLog = await getAuditLog(nr.guild, "ROLE_UPDATE");
     const audit = auditLog.entries.first();
@@ -21,47 +13,22 @@
         roleId: entry(nr.id, `\`${nr.id}\``),
         role: entry(nr.id, renderRole(nr)),
         edited: entry(new Date().getTime(), renderDelta(new Date().getTime())),
-        editedBy: entry(
-            audit.executor.id,
-            renderUser((await nr.guild.members.fetch(audit.executor.id)).user)
-        )
+        editedBy: entry(audit.executor.id, renderUser((await nr.guild.members.fetch(audit.executor.id)).user))
     };
     const mentionable = ["", ""];
     const hoist = ["", ""];
-    mentionable[0] = or.mentionable
-        ? `${getEmojiByName("CONTROL.TICK")} Yes`
-        : `${getEmojiByName("CONTROL.CROSS")} No`;
-    mentionable[1] = nr.mentionable
-        ? `${getEmojiByName("CONTROL.TICK")} Yes`
-        : `${getEmojiByName("CONTROL.CROSS")} No`;
-    hoist[0] = or.hoist
-        ? `${getEmojiByName("CONTROL.TICK")} Yes`
-        : `${getEmojiByName("CONTROL.CROSS")} No`;
-    hoist[1] = nr.hoist
-        ? `${getEmojiByName("CONTROL.TICK")} Yes`
-        : `${getEmojiByName("CONTROL.CROSS")} No`;
-    if (or.name !== nr.name)
-        changes.name = entry([or.name, nr.name], `${or.name} -> ${nr.name}`);
+    mentionable[0] = or.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+    mentionable[1] = nr.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+    hoist[0] = or.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+    hoist[1] = nr.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`;
+    if (or.name !== nr.name) changes.name = entry([or.name, nr.name], `${or.name} -> ${nr.name}`);
     if (or.position !== nr.position)
-        changes.position = entry(
-            [or.position, nr.position],
-            `${or.position} -> ${nr.position}`
-        );
-    if (or.hoist !== nr.hoist)
-        changes.showInMemberList = entry(
-            [or.hoist, nr.hoist],
-            `${hoist[0]} -> ${hoist[1]}`
-        );
+        changes.position = entry([or.position, nr.position], `${or.position} -> ${nr.position}`);
+    if (or.hoist !== nr.hoist) changes.showInMemberList = entry([or.hoist, nr.hoist], `${hoist[0]} -> ${hoist[1]}`);
     if (or.mentionable !== nr.mentionable)
-        changes.mentionable = entry(
-            [or.mentionable, nr.mentionable],
-            `${mentionable[0]} -> ${mentionable[1]}`
-        );
+        changes.mentionable = entry([or.mentionable, nr.mentionable], `${mentionable[0]} -> ${mentionable[1]}`);
     if (or.hexColor !== nr.hexColor)
-        changes.color = entry(
-            [or.hexColor, nr.hexColor],
-            `\`${or.hexColor}\` -> \`${nr.hexColor}\``
-        );
+        changes.color = entry([or.hexColor, nr.hexColor], `\`${or.hexColor}\` -> \`${nr.hexColor}\``);
 
     if (Object.keys(changes).length === 4) return;
 
diff --git a/src/events/stickerCreate.ts b/src/events/stickerCreate.ts
index 54de270..c538bde 100644
--- a/src/events/stickerCreate.ts
+++ b/src/events/stickerCreate.ts
@@ -1,12 +1,9 @@
 export const event = "stickerCreate";
 
 export async function callback(client, emoji) {
-    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } =
-        emoji.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = emoji.client.logger;
     const auditLog = await getAuditLog(emoji.guild, "STICKER_CREATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === emoji.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === emoji.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -21,10 +18,7 @@
             stickerId: entry(emoji.id, `\`${emoji.id}\``),
             emoji: entry(emoji.name, `\`:${emoji.name}:\``),
             createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                emoji.createdTimestamp,
-                renderDelta(emoji.createdTimestamp)
-            )
+            created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp))
         },
         hidden: {
             guild: emoji.guild.id
diff --git a/src/events/stickerDelete.ts b/src/events/stickerDelete.ts
index f390b5c..7ac17ce 100644
--- a/src/events/stickerDelete.ts
+++ b/src/events/stickerDelete.ts
@@ -1,12 +1,9 @@
 export const event = "stickerDelete";
 
 export async function callback(client, emoji) {
-    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } =
-        emoji.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta } = emoji.client.logger;
     const auditLog = await getAuditLog(emoji.guild, "STICKER_DELETE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === emoji.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === emoji.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -21,14 +18,8 @@
             stickerId: entry(emoji.id, `\`${emoji.id}\``),
             sticker: entry(emoji.name, `\`${emoji.name}\``),
             deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                emoji.createdTimestamp,
-                renderDelta(emoji.createdTimestamp)
-            ),
-            deleted: entry(
-                audit.createdTimestamp,
-                renderDelta(audit.createdTimestamp)
-            )
+            created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp)),
+            deleted: entry(audit.createdTimestamp, renderDelta(audit.createdTimestamp))
         },
         hidden: {
             guild: emoji.guild.id
diff --git a/src/events/stickerUpdate.ts b/src/events/stickerUpdate.ts
index 46c4d17..662f981 100644
--- a/src/events/stickerUpdate.ts
+++ b/src/events/stickerUpdate.ts
@@ -1,8 +1,7 @@
 export const event = "stickerUpdate";
 
 export async function callback(client, oe, ne) {
-    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } =
-        client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = client.logger;
 
     if (oe.name === ne.name) return;
     const auditLog = await getAuditLog(ne.guild, "EMOJI_UPDATE");
@@ -12,10 +11,7 @@
     const changes = {
         stickerId: entry(ne.id, `\`${ne.id}\``),
         edited: entry(ne.createdTimestamp, renderDelta(ne.createdTimestamp)),
-        editedBy: entry(
-            audit.executor.id,
-            renderUser((await ne.guild.members.fetch(audit.executor.id)).user)
-        ),
+        editedBy: entry(audit.executor.id, renderUser((await ne.guild.members.fetch(audit.executor.id)).user)),
         name: entry([oe.name, ne.name], `\`:${oe.name}:\` -> \`:${ne.name}:\``)
     };
     const data = {
diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts
index 4fdedcb..da3cbae 100644
--- a/src/events/threadCreate.ts
+++ b/src/events/threadCreate.ts
@@ -2,19 +2,9 @@
 export const event = "threadCreate";
 
 export async function callback(client, thread) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = thread.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = thread.client.logger;
     const auditLog = await getAuditLog(thread.guild, "THREAD_CREATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === thread.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === thread.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -31,9 +21,7 @@
             parentChannel: entry(thread.parentId, renderChannel(thread.parent)),
             category: entry(
                 thread.parent.parent ? thread.parent.parent.name : "None",
-                thread.parent.parent
-                    ? renderChannel(thread.parent.parent)
-                    : "None"
+                thread.parent.parent ? renderChannel(thread.parent.parent) : "None"
             ),
             autoArchiveDuration: entry(
                 thread.autoArchiveDuration,
@@ -42,10 +30,7 @@
                 })
             ),
             createdBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                thread.createdTimestamp,
-                renderDelta(thread.createdTimestamp)
-            )
+            created: entry(thread.createdTimestamp, renderDelta(thread.createdTimestamp))
         },
         hidden: {
             guild: thread.guild.id
diff --git a/src/events/threadDelete.ts b/src/events/threadDelete.ts
index 0077eff..bfae11a 100644
--- a/src/events/threadDelete.ts
+++ b/src/events/threadDelete.ts
@@ -2,19 +2,9 @@
 export const event = "threadDelete";
 
 export async function callback(client, thread) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = thread.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = thread.client.logger;
     const auditLog = await getAuditLog(thread.guild, "THREAD_UPDATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === thread.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === thread.id).first();
     if (audit.executor.id === client.user.id) return;
     const data = {
         meta: {
@@ -31,9 +21,7 @@
             parentChannel: entry(thread.parentId, renderChannel(thread.parent)),
             category: entry(
                 thread.parent.parent ? thread.parent.parent.name : "None",
-                thread.parent.parent
-                    ? renderChannel(thread.parent.parent)
-                    : "None"
+                thread.parent.parent ? renderChannel(thread.parent.parent) : "None"
             ),
             autoArchiveDuration: entry(
                 thread.autoArchiveDuration,
@@ -43,14 +31,8 @@
             ),
             membersInThread: entry(thread.memberCount, thread.memberCount),
             deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
-            created: entry(
-                thread.createdTimestamp,
-                renderDelta(thread.createdTimestamp)
-            ),
-            deleted: entry(
-                new Date().getTime(),
-                renderDelta(new Date().getTime())
-            )
+            created: entry(thread.createdTimestamp, renderDelta(thread.createdTimestamp)),
+            deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
         },
         hidden: {
             guild: thread.guild.id
diff --git a/src/events/threadUpdate.ts b/src/events/threadUpdate.ts
index ff36ce0..144dc84 100644
--- a/src/events/threadUpdate.ts
+++ b/src/events/threadUpdate.ts
@@ -2,19 +2,9 @@
 export const event = "threadUpdate";
 
 export async function callback(client, before, after) {
-    const {
-        getAuditLog,
-        log,
-        NucleusColors,
-        entry,
-        renderUser,
-        renderDelta,
-        renderChannel
-    } = after.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderChannel } = after.client.logger;
     const auditLog = await getAuditLog(after.guild, "THREAD_UPDATE");
-    const audit = auditLog.entries
-        .filter((entry) => entry.target.id === after.id)
-        .first();
+    const audit = auditLog.entries.filter((entry) => entry.target.id === after.id).first();
     if (audit.executor.id === client.user.id) return;
     const list = {
         threadId: entry(after.id, `\`${after.id}\``),
@@ -22,10 +12,7 @@
         parentChannel: entry(after.parentId, renderChannel(after.parent))
     };
     if (before.name !== after.name) {
-        list.name = entry(
-            [before.name, after.name],
-            `${before.name} -> ${after.name}`
-        );
+        list.name = entry([before.name, after.name], `${before.name} -> ${after.name}`);
     }
     if (before.autoArchiveDuration !== after.autoArchiveDuration) {
         list.autoArchiveDuration = entry(
@@ -40,16 +27,11 @@
     if (before.rateLimitPerUser !== after.rateLimitPerUser) {
         list.slowmode = entry(
             [before.rateLimitPerUser, after.rateLimitPerUser],
-            `${humanizeDuration(
-                before.rateLimitPerUser * 1000
-            )} -> ${humanizeDuration(after.rateLimitPerUser * 1000)}`
+            `${humanizeDuration(before.rateLimitPerUser * 1000)} -> ${humanizeDuration(after.rateLimitPerUser * 1000)}`
         );
     }
     if (!(Object.keys(list).length - 3)) return;
-    list.updated = entry(
-        new Date().getTime(),
-        renderDelta(new Date().getTime())
-    );
+    list.updated = entry(new Date().getTime(), renderDelta(new Date().getTime()));
     list.updatedBy = entry(audit.executor.id, renderUser(audit.executor));
     const data = {
         meta: {
diff --git a/src/events/webhookUpdate.ts b/src/events/webhookUpdate.ts
index ae88cac..2e95c4b 100644
--- a/src/events/webhookUpdate.ts
+++ b/src/events/webhookUpdate.ts
@@ -3,20 +3,9 @@
 import type { HaikuClient } from "jshaiku";
 export const event = "webhookUpdate";
 
-export async function callback(
-    client: HaikuClient,
-    channel: Discord.GuildChannel
-) {
+export async function callback(client: HaikuClient, channel: Discord.GuildChannel) {
     try {
-        const {
-            getAuditLog,
-            log,
-            NucleusColors,
-            entry,
-            renderUser,
-            renderChannel,
-            renderDelta
-        } = client.logger;
+        const { getAuditLog, log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger;
         let auditLogCreate = getAuditLog(channel.guild, "WEBHOOK_CREATE");
         let auditLogUpdate = getAuditLog(channel.guild, "WEBHOOK_UPDATE");
         let auditLogDelete = getAuditLog(channel.guild, "WEBHOOK_DELETE");
@@ -25,15 +14,9 @@
             auditLogUpdate,
             auditLogDelete
         ]);
-        const auditCreate = auditLogCreate.entries
-            .filter((entry) => entry.target.channelId === channel.id)
-            .first();
-        const auditUpdate = auditLogUpdate.entries
-            .filter((entry) => entry.target.channelId === channel.id)
-            .first();
-        const auditDelete = auditLogDelete.entries
-            .filter((entry) => entry.target.channelId === channel.id)
-            .first();
+        const auditCreate = auditLogCreate.entries.filter((entry) => entry.target.channelId === channel.id).first();
+        const auditUpdate = auditLogUpdate.entries.filter((entry) => entry.target.channelId === channel.id).first();
+        const auditDelete = auditLogDelete.entries.filter((entry) => entry.target.channelId === channel.id).first();
         if (!auditCreate && !auditUpdate && !auditDelete) return;
         let audit = auditCreate;
         let action = "Create";
@@ -42,10 +25,7 @@
             updated: { value: string; displayValue: string };
             deleted: { value: string; displayValue: string };
         };
-        if (
-            auditUpdate &&
-            auditUpdate.createdTimestamp > audit.createdTimestamp
-        ) {
+        if (auditUpdate && auditUpdate.createdTimestamp > audit.createdTimestamp) {
             const { before, after } = auditUpdate.changes.reduce(
                 (acc, change) => {
                     acc.before[change.key] = change.old;
@@ -55,40 +35,21 @@
                 { before: {}, after: {} }
             );
             if (before.name !== after.name)
-                list.name = entry(
-                    [before.name, after.name],
-                    `${before.name} -> ${after.name}`
-                );
+                list.name = entry([before.name, after.name], `${before.name} -> ${after.name}`);
             if (before.channel_id !== after.channel_id)
                 list.channel = entry(
                     [before.channel_id, after.channel_id],
-                    renderChannel(
-                        await client.channels.fetch(before.channel_id)
-                    ) +
+                    renderChannel(await client.channels.fetch(before.channel_id)) +
                         " -> " +
-                        renderChannel(
-                            await client.channels.fetch(after.channel_id)
-                        )
+                        renderChannel(await client.channels.fetch(after.channel_id))
                 );
             if (!Object.keys(list).length) return;
-            list.created = entry(
-                auditUpdate.target.createdTimestamp,
-                renderDelta(auditUpdate.target.createdTimestamp)
-            );
-            list.edited = entry(
-                after.editedTimestamp,
-                renderDelta(new Date().getTime())
-            );
-            list.editedBy = entry(
-                auditUpdate.executor.id,
-                renderUser(auditUpdate.executor)
-            );
+            list.created = entry(auditUpdate.target.createdTimestamp, renderDelta(auditUpdate.target.createdTimestamp));
+            list.edited = entry(after.editedTimestamp, renderDelta(new Date().getTime()));
+            list.editedBy = entry(auditUpdate.executor.id, renderUser(auditUpdate.executor));
             audit = auditUpdate;
             action = "Update";
-        } else if (
-            auditDelete &&
-            auditDelete.createdTimestamp > audit.createdTimestamp
-        ) {
+        } else if (auditDelete && auditDelete.createdTimestamp > audit.createdTimestamp) {
             const { before } = auditDelete.changes.reduce(
                 (acc, change) => {
                     acc.before[change.key] = change.old;
@@ -99,29 +60,12 @@
             );
             list = {
                 name: entry(before.name, `${before.name}`),
-                channel: entry(
-                    before.channel_id,
-                    renderChannel(
-                        await client.channels.fetch(before.channel_id)
-                    )
-                ),
-                created: entry(
-                    auditDelete.target.createdTimestamp,
-                    renderDelta(auditDelete.target.createdTimestamp)
-                ),
-                deleted: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                ),
+                channel: entry(before.channel_id, renderChannel(await client.channels.fetch(before.channel_id))),
+                created: entry(auditDelete.target.createdTimestamp, renderDelta(auditDelete.target.createdTimestamp)),
+                deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                 deletedBy: entry(
                     auditDelete.executor.id,
-                    renderUser(
-                        (
-                            await channel.guild.members.fetch(
-                                auditDelete.executor.id
-                            )
-                        ).user
-                    )
+                    renderUser((await channel.guild.members.fetch(auditDelete.executor.id)).user)
                 )
             };
             audit = auditDelete;
@@ -137,26 +81,12 @@
             );
             list = {
                 name: entry(before.name, `${before.name}`),
-                channel: entry(
-                    before.channel_id,
-                    renderChannel(
-                        await client.channels.fetch(before.channel_id)
-                    )
-                ),
+                channel: entry(before.channel_id, renderChannel(await client.channels.fetch(before.channel_id))),
                 createdBy: entry(
                     auditCreate.executor.id,
-                    renderUser(
-                        (
-                            await channel.guild.members.fetch(
-                                auditCreate.executor.id
-                            )
-                        ).user
-                    )
+                    renderUser((await channel.guild.members.fetch(auditCreate.executor.id)).user)
                 ),
-                created: entry(
-                    new Date().getTime(),
-                    renderDelta(new Date().getTime())
-                )
+                created: entry(new Date().getTime(), renderDelta(new Date().getTime()))
             };
         }
         const cols = {
diff --git a/src/index.ts b/src/index.ts
index e40a816..87bbc02 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,9 +1,11 @@
 import { Logger } from "./utils/log.js";
 import runServer from "./api/index.js";
 import Memory from "./utils/memory.js";
+import type { VerifySchema } from "./reflex/verify.js";
 import { Guilds, History, ModNotes, Premium } from "./utils/database.js";
 import client from "./utils/client.js";
 import EventScheduler from "./utils/eventScheduler.js";
+import type { RoleMenuSchema } from "./actions/roleMenu.js";
 
 await client.registerCommandsIn(`dist/commands`);
 await client.registerEventsIn(`dist/events`);
@@ -14,17 +16,23 @@
     console.error(err);
 });
 
-client.logger = new Logger();
-client.verify = {};
-client.roleMenu = {};
-client.memory = new Memory();
-client.noLog = [];
+client.logger = new Logger() as Logger;
+client.verify = {} as Record<string, VerifySchema>;
+client.roleMenu = {} as Record<string, RoleMenuSchema>;
+client.memory = new Memory() as Memory;
+client.noLog = [] as string[];
 client.database = {
     guilds: await new Guilds().setup(),
     history: await new History().setup(),
     notes: await new ModNotes().setup(),
     premium: await new Premium().setup(),
     eventScheduler: await new EventScheduler().start()
+} as {
+    guilds: Guilds;
+    history: History;
+    notes: ModNotes;
+    premium: Premium;
+    eventScheduler: EventScheduler;
 };
 
 await client.login();
diff --git a/src/premium/attachmentLogs.ts b/src/premium/attachmentLogs.ts
index 899cd25..0c491b7 100644
--- a/src/premium/attachmentLogs.ts
+++ b/src/premium/attachmentLogs.ts
@@ -6,11 +6,8 @@
 import addPlural from "../utils/plurals.js";
 import type { Message } from "discord.js";
 
-export default async function logAttachment(
-    message: Message
-): Promise<AttachmentLogSchema> {
-    if (!message.guild)
-        throw new Error("Tried to log an attachment in a non-guild message");
+export default async function logAttachment(message: Message): Promise<AttachmentLogSchema> {
+    if (!message.guild) throw new Error("Tried to log an attachment in a non-guild message");
     const { renderUser, renderChannel, renderDelta } = client.logger;
     const attachments = [];
     for (const attachment of message.attachments.values()) {
@@ -24,11 +21,7 @@
     }
     const links = message.content.match(/https?:\/\/\S+/gi) ?? [];
     for (const link of links) {
-        if (
-            link
-                .toLowerCase()
-                .match(/\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/gi)
-        ) {
+        if (link.toLowerCase().match(/\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/gi)) {
             attachments.push({
                 local: await saveAttachment(link),
                 url: link,
@@ -39,8 +32,7 @@
     }
     if (attachments.length === 0) return { files: [] };
     if (client.database.premium.hasPremium(message.guild.id)) {
-        const channel = (await client.database.guilds.read(message.guild.id))
-            .logging.attachments.channel;
+        const channel = (await client.database.guilds.read(message.guild.id)).logging.attachments.channel;
         if (!channel) {
             singleNotify(
                 "noAttachmentLogChannel",
@@ -63,17 +55,13 @@
         const m = await channelObj.send({
             embeds: [
                 new EmojiEmbed()
-                    .setTitle(
-                        `${addPlural(attachments.length, "Attachment")} Sent`
-                    )
+                    .setTitle(`${addPlural(attachments.length, "Attachment")} Sent`)
                     .setDescription(
                         keyValueList({
                             messageId: `\`${message.id}\``,
                             sentBy: renderUser(message.author),
                             sentIn: renderChannel(message.channel),
-                            sent: renderDelta(
-                                new Date(message.createdTimestamp)
-                            )
+                            sent: renderDelta(new Date(message.createdTimestamp))
                         }) + `\n[[Jump to message]](${message.url})`
                     )
                     .setEmoji("ICONS.ATTACHMENT")
@@ -83,8 +71,7 @@
         });
         // await client.database.guilds.write(interaction.guild.id, {[`tags.${name}`]: value});
         client.database.guilds.write(message.guild.id, {
-            [`logging.attachments.saved.${message.channel.id}${message.id}`]:
-                m.url
+            [`logging.attachments.saved.${message.channel.id}${message.id}`]: m.url
         });
         return { files: attachments, jump: m.url };
     } else {
diff --git a/src/premium/createTranscript.ts b/src/premium/createTranscript.ts
index 3d7f4c6..5fbb8ad 100644
--- a/src/premium/createTranscript.ts
+++ b/src/premium/createTranscript.ts
@@ -1,4 +1,12 @@
-import { MessageActionRow, MessageButton, TextChannel } from "discord.js";
+import {
+    CommandInteraction,
+    DMChannel,
+    Message,
+    MessageActionRow,
+    MessageButton,
+    PartialGroupDMChannel,
+    TextChannel
+} from "discord.js";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../utils/getEmojiByName.js";
 import { PasteClient, Publicity, ExpireDate } from "pastebin-api";
@@ -7,35 +15,28 @@
 
 const pbClient = new PasteClient(config.pastebinApiKey);
 
-export default async function (interaction) {
-    const { log, NucleusColors, entry, renderUser, renderDelta } =
-        client.logger;
+export default async function (interaction: CommandInteraction) {
+    if (interaction.channel === null) return;
+    if (interaction.channel instanceof DMChannel) return;
+    const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
 
-    let messages = [];
-    let deleted = 100;
+    let messages: Message[] = [];
+    let deletedCount: number;
 
-    while (deleted === 100) {
-        let fetched;
-        await (interaction.channel as TextChannel).messages
-            .fetch({ limit: 100 })
-            .then(async (ms) => {
-                fetched = await (interaction.channel as TextChannel).bulkDelete(
-                    ms,
-                    true
-                );
-            });
-        deleted = fetched.size;
-        if (fetched) {
-            messages = messages.concat(fetched.map((m) => m));
-        }
-    }
+    do {
+        const fetched = await (interaction.channel as TextChannel).messages.fetch({ limit: 100 });
+        const deleted = await (interaction.channel as TextChannel).bulkDelete(fetched, true);
+        deletedCount = deleted.size;
+        messages = messages.concat(Array.from(deleted.values()));
+    } while (deletedCount === 100);
+
     let out = "";
     messages.reverse().forEach((message) => {
         if (!message.author.bot) {
             const sentDate = new Date(message.createdTimestamp);
-            out += `${message.author.username}#${
-                message.author.discriminator
-            } (${message.author.id}) [${sentDate.toUTCString()}]\n`;
+            out += `${message.author.username}#${message.author.discriminator} (${
+                message.author.id
+            }) [${sentDate.toUTCString()}]\n`;
             const lines = message.content.split("\n");
             lines.forEach((line) => {
                 out += `> ${line}\n`;
@@ -43,24 +44,18 @@
             out += "\n\n";
         }
     });
-    const member = interaction.channel.guild.members.cache.get(
-        interaction.channel.topic.split(" ")[0]
-    );
+    const member = interaction.channel.guild.members.cache.get(interaction.channel.topic.split(" ")[0]);
     let m;
     if (out !== "") {
         const url = await pbClient.createPaste({
             code: out,
             expireDate: ExpireDate.Never,
-            name: `Ticket Transcript for ${member.user.username}#${
-                member.user.discriminator
-            } (Created at ${new Date(
+            name: `Ticket Transcript for ${member.user.username}#${member.user.discriminator} (Created at ${new Date(
                 interaction.channel.createdTimestamp
             ).toDateString()})`,
             publicity: Publicity.Unlisted
         });
-        const guildConfig = await client.database.guilds.read(
-            interaction.guild.id
-        );
+        const guildConfig = await client.database.guilds.read(interaction.guild.id);
         m = await interaction.reply({
             embeds: [
                 new EmojiEmbed()
@@ -76,10 +71,7 @@
             ],
             components: [
                 new MessageActionRow().addComponents([
-                    new MessageButton()
-                        .setLabel("View")
-                        .setStyle("LINK")
-                        .setURL(url),
+                    new MessageButton().setLabel("View").setStyle("LINK").setURL(url),
                     new MessageButton()
                         .setLabel("Delete")
                         .setStyle("DANGER")
@@ -131,22 +123,10 @@
         list: {
             ticketFor: entry(
                 interaction.channel.topic.split(" ")[0],
-                renderUser(
-                    (
-                        await interaction.guild.members.fetch(
-                            interaction.channel.topic.split(" ")[0]
-                        )
-                    ).user
-                )
+                renderUser((await interaction.guild.members.fetch(interaction.channel.topic.split(" ")[0])).user)
             ),
-            deletedBy: entry(
-                interaction.member.user.id,
-                renderUser(interaction.member.user)
-            ),
-            deleted: entry(
-                new Date().getTime(),
-                renderDelta(new Date().getTime())
-            )
+            deletedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)),
+            deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
         },
         hidden: {
             guild: interaction.guild.id
diff --git a/src/reflex/guide.ts b/src/reflex/guide.ts
index 0b09f69..849c880 100644
--- a/src/reflex/guide.ts
+++ b/src/reflex/guide.ts
@@ -29,17 +29,13 @@
 }
 
 export default async (guild, interaction?) => {
-    let c = guild.publicUpdatesChannel
-        ? guild.publicUpdatesChannel
-        : guild.systemChannel;
+    let c = guild.publicUpdatesChannel ? guild.publicUpdatesChannel : guild.systemChannel;
     c = c
         ? c
         : guild.channels.cache.find(
               (ch) =>
                   ch.type === "GUILD_TEXT" &&
-                  ch
-                      .permissionsFor(guild.roles.everyone)
-                      .has("SEND_MESSAGES") &&
+                  ch.permissionsFor(guild.roles.everyone).has("SEND_MESSAGES") &&
                   ch.permissionsFor(guild.me).has("EMBED_LINKS")
           );
     const pages = [
@@ -96,18 +92,14 @@
                             `**${getEmojiByName(
                                 "PUNISH.MUTE.GREEN"
                             )} Unmute:** The user is able to send messages in the server.\n` +
-                            `**${getEmojiByName(
-                                "PUNISH.KICK.RED"
-                            )} Kick:** The user is removed from the server.\n` +
+                            `**${getEmojiByName("PUNISH.KICK.RED")} Kick:** The user is removed from the server.\n` +
                             `**${getEmojiByName(
                                 "PUNISH.SOFTBAN"
                             )} Softban:** Kicks the user, deleting their messages from every channel.\n` +
                             `**${getEmojiByName(
                                 "PUNISH.BAN.RED"
                             )} Ban:** The user is removed from the server, and they are unable to rejoin.\n` +
-                            `**${getEmojiByName(
-                                "PUNISH.BAN.GREEN"
-                            )} Unban:** The user is able to rejoin the server.`
+                            `**${getEmojiByName("PUNISH.BAN.GREEN")} Unban:** The user is able to rejoin the server.`
                     )
                     .setEmoji("PUNISH.BAN.RED")
                     .setStatus("Danger")
@@ -209,9 +201,7 @@
     let page = 0;
 
     const f = async (component) => {
-        return (component.member as Discord.GuildMember).permissions.has(
-            "MANAGE_GUILD"
-        );
+        return (component.member as Discord.GuildMember).permissions.has("MANAGE_GUILD");
     };
 
     let selectPaneOpen = false;
@@ -261,22 +251,14 @@
         ]);
         if (interaction) {
             const em = new Discord.MessageEmbed(pages[page].embed);
-            em.setDescription(
-                em.description +
-                    "\n\n" +
-                    createPageIndicator(pages.length, page)
-            );
+            em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
             await interaction.editReply({
                 embeds: [em],
                 components: components
             });
         } else {
             const em = new Discord.MessageEmbed(pages[page].embed);
-            em.setDescription(
-                em.description +
-                    "\n\n" +
-                    createPageIndicator(pages.length, page)
-            );
+            em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
             await m.edit({
                 embeds: [em],
                 components: components,
@@ -311,11 +293,7 @@
         } else {
             if (interaction) {
                 const em = new Discord.MessageEmbed(pages[page].embed);
-                em.setDescription(
-                    em.description +
-                        "\n\n" +
-                        createPageIndicator(pages.length, page)
-                );
+                em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
                 em.setFooter({ text: "Message closed" });
                 interaction.editReply({
                     embeds: [em],
@@ -329,9 +307,7 @@
                             new MessageButton()
                                 .setCustomId("select")
                                 .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
-                                .setStyle(
-                                    selectPaneOpen ? "PRIMARY" : "SECONDARY"
-                                )
+                                .setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY")
                                 .setDisabled(true),
                             new MessageButton()
                                 .setCustomId("right")
@@ -349,9 +325,9 @@
     }
     if (interaction) {
         const em = new Discord.MessageEmbed(pages[page].embed);
-        em.setDescription(
-            em.description + "\n\n" + createPageIndicator(pages.length, page)
-        ).setFooter({ text: "Message timed out" });
+        em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page)).setFooter({
+            text: "Message timed out"
+        });
         await interaction.editReply({
             embeds: [em],
             components: [
@@ -376,9 +352,9 @@
         });
     } else {
         const em = new Discord.MessageEmbed(pages[page].embed);
-        em.setDescription(
-            em.description + "\n\n" + createPageIndicator(pages.length, page)
-        ).setFooter({ text: "Message timed out" });
+        em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page)).setFooter({
+            text: "Message timed out"
+        });
         await m.edit({
             embeds: [em],
             components: [
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index 2f6f526..bd60f54 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -36,11 +36,8 @@
     safe: true,
     tags: []
 };
-export async function testLink(
-    link: string
-): Promise<{ safe: boolean; tags: string[] }> {
-    const scanned: { safe?: boolean; tags?: string[] } | undefined =
-        await us.link.scan(link);
+export async function testLink(link: string): Promise<{ safe: boolean; tags: string[] }> {
+    const scanned: { safe?: boolean; tags?: string[] } | undefined = await us.link.scan(link);
     if (scanned === undefined) return defaultLinkTestResult;
     return {
         safe: scanned.safe ?? defaultLinkTestResult.safe,
@@ -53,19 +50,15 @@
     DATING: "Dating sites.",
     TRACKERS: "Websites that store or track personal information.",
     ADVERTISEMENTS: "Websites only for ads.",
-    FACEBOOK:
-        "Facebook pages. (Facebook has a number of dangerous trackers. Read more on /privacy)",
+    FACEBOOK: "Facebook pages. (Facebook has a number of dangerous trackers. Read more on /privacy)",
     AMP: "AMP pages. (AMP is a technology that allows websites to be served by Google. Read more on /privacy)",
     "FACEBOOK TRACKERS": "Websites that include trackers from Facebook.",
-    "IP GRABBERS":
-        "Websites that store your IP address, which shows your approximate location.",
+    "IP GRABBERS": "Websites that store your IP address, which shows your approximate location.",
     PORN: "Websites that include pornography.",
     GAMBLING: "Gambling sites, often scams.",
-    MALWARE:
-        "Websites which download files designed to break or slow down your device.",
+    MALWARE: "Websites which download files designed to break or slow down your device.",
     PIRACY: "Sites which include illegally downloaded material.",
-    RANSOMWARE:
-        "Websites which download a program that can steal your data and make you pay to get it back.",
+    RANSOMWARE: "Websites which download a program that can steal your data and make you pay to get it back.",
     REDIRECTS: "Sites like bit.ly which could redirect to a malicious site.",
     SCAMS: "Sites which are designed to trick you into doing something.",
     TORRENT: "Websites that download torrent files.",
@@ -83,12 +76,7 @@
     const promises: Promise<void>[] = links.map(async (element) => {
         let returned;
         try {
-            if (
-                element.match(
-                    /https?:\/\/[a-zA-Z]+\.?discord(app)?\.(com|net)\/?/
-                )
-            )
-                return; // Also matches discord.net, not enough of a bug
+            if (element.match(/https?:\/\/[a-zA-Z]+\.?discord(app)?\.(com|net)\/?/)) return; // Also matches discord.net, not enough of a bug
             returned = await testLink(element);
         } catch {
             detections.push({ tags: [], safe: true });
@@ -99,9 +87,7 @@
     await Promise.all(promises);
     const detectionsTypes = detections
         .map((element) => {
-            const type = Object.keys(linkTypes).find((type) =>
-                element.tags.includes(type)
-            );
+            const type = Object.keys(linkTypes).find((type) => element.tags.includes(type));
             if (type) return type;
             // if (!element.safe) return "UNSAFE"
             return undefined;
@@ -119,10 +105,7 @@
     }
 }
 
-export async function SizeCheck(element: {
-    height: number | null;
-    width: number | null;
-}): Promise<boolean> {
+export async function SizeCheck(element: { height: number | null; width: number | null }): Promise<boolean> {
     if (element.height === null || element.width === null) return true;
     if (element.height < 20 || element.width < 20) return false;
     return true;
@@ -136,11 +119,7 @@
     }
 }
 
-export function TestString(
-    string: string,
-    soft: string[],
-    strict: string[]
-): object | null {
+export function TestString(string: string, soft: string[], strict: string[]): object | null {
     for (const word of strict) {
         if (string.toLowerCase().includes(word)) {
             return { word: word, type: "strict" };
diff --git a/src/reflex/statsChannelUpdate.ts b/src/reflex/statsChannelUpdate.ts
index 2dee385..a331537 100644
--- a/src/reflex/statsChannelUpdate.ts
+++ b/src/reflex/statsChannelUpdate.ts
@@ -14,13 +14,7 @@
         if ((props as PropSchema).enabled) {
             let string = (props as PropSchema).name;
             if (!string) return;
-            string = await convertCurlyBracketString(
-                string,
-                member.id,
-                member.displayName,
-                guild.name,
-                guild.members
-            );
+            string = await convertCurlyBracketString(string, member.id, member.displayName, guild.name, guild.members);
             let fetchedChannel;
             try {
                 fetchedChannel = await guild.channels.fetch(channel);
@@ -31,11 +25,7 @@
                 const deleted = config.getKey("stats")[channel];
                 console.log(`stats.${channel}`);
                 console.log(guild.id);
-                await client.database.guilds.write(
-                    guild.id,
-                    null,
-                    `stats.${channel}`
-                );
+                await client.database.guilds.write(guild.id, null, `stats.${channel}`);
                 return singleNotify(
                     "statsChannelDeleted",
                     guild.id,
diff --git a/src/reflex/verify.ts b/src/reflex/verify.ts
index 1737387..c366c8b 100644
--- a/src/reflex/verify.ts
+++ b/src/reflex/verify.ts
@@ -1,11 +1,22 @@
 import { LoadingEmbed } from "./../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, GuildMember } from "discord.js";
+import Discord, { CommandInteraction, GuildMember, Interaction } from "discord.js";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 import fetch from "node-fetch";
 import { TestString, NSFWCheck } from "./scanners.js";
 import createPageIndicator from "../utils/createPageIndicator.js";
 import client from "../utils/client.js";
 
+export interface VerifySchema {
+    uID: string;
+    gID: string;
+    rID: string;
+    rName: string;
+    uName: string;
+    gName: string;
+    gIcon: string;
+    interaction: Interaction;
+}
+
 function step(i: number) {
     return "\n\n" + createPageIndicator(5, i);
 }
@@ -35,17 +46,12 @@
             ephemeral: true,
             fetchReply: true
         });
-    if (
-        (interaction.member as GuildMember).roles.cache.has(config.verify.role)
-    ) {
+    if ((interaction.member as GuildMember).roles.cache.has(config.verify.role)) {
         return await interaction.editReply({
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Verify")
-                    .setDescription(
-                        `You already have the <@&${config.verify.role}> role` +
-                            step(0)
-                    )
+                    .setDescription(`You already have the <@&${config.verify.role}> role` + step(0))
                     .setStatus("Danger")
                     .setEmoji("CONTROL.BLOCKCROSS")
             ]
@@ -61,18 +67,13 @@
         ]
     });
     try {
-        const status = await fetch(client.config.baseUrl).then(
-            (res) => res.status
-        );
+        const status = await fetch(client.config.baseUrl).then((res) => res.status);
         if (status !== 200) {
             return await interaction.editReply({
                 embeds: [
                     new EmojiEmbed()
                         .setTitle("Verify")
-                        .setDescription(
-                            "Our servers appear to be down, please try again later" +
-                                step(0)
-                        )
+                        .setDescription("Our servers appear to be down, please try again later" + step(0))
                         .setStatus("Danger")
                         .setEmoji("CONTROL.BLOCKCROSS")
                 ]
@@ -83,10 +84,7 @@
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Verify")
-                    .setDescription(
-                        "Our servers appear to be down, please try again later" +
-                            step(0)
-                    )
+                    .setDescription("Our servers appear to be down, please try again later" + step(0))
                     .setStatus("Danger")
                     .setEmoji("CONTROL.BLOCKCROSS")
             ],
@@ -109,9 +107,7 @@
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Verify")
-                    .setDescription(
-                        "Checking your avatar is safe for work" + step(1)
-                    )
+                    .setDescription("Checking your avatar is safe for work" + step(1))
                     .setStatus("Warning")
                     .setEmoji("NUCLEUS.LOADING")
             ]
@@ -180,8 +176,7 @@
     let code = "";
     let length = 5;
     let itt = 0;
-    const chars =
-        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+    const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
     while (true) {
         itt += 1;
         code = "";
@@ -210,10 +205,7 @@
         embeds: [
             new EmojiEmbed()
                 .setTitle("Verify")
-                .setDescription(
-                    "Looking good!\nClick the button below to get verified" +
-                        step(4)
-                )
+                .setDescription("Looking good!\nClick the button below to get verified" + step(4))
                 .setStatus("Success")
                 .setEmoji("MEMBER.JOIN")
         ],
@@ -222,9 +214,7 @@
                 new Discord.MessageButton()
                     .setLabel("Verify")
                     .setStyle("LINK")
-                    .setURL(
-                        `${client.config.baseUrl}nucleus/verify?code=${code}`
-                    )
+                    .setURL(`${client.config.baseUrl}nucleus/verify?code=${code}`)
             ])
         ]
     });
diff --git a/src/reflex/welcome.ts b/src/reflex/welcome.ts
index 4971cc9..56391ec 100644
--- a/src/reflex/welcome.ts
+++ b/src/reflex/welcome.ts
@@ -19,29 +19,16 @@
             );
             if (config.welcome.channel === "dm") {
                 await member.send({
-                    embeds: [
-                        new EmojiEmbed()
-                            .setDescription(string)
-                            .setStatus("Success")
-                    ]
+                    embeds: [new EmojiEmbed().setDescription(string).setStatus("Success")]
                 });
             } else {
-                const channel = await member.guild.channels.fetch(
-                    config.welcome.channel
-                );
+                const channel = await member.guild.channels.fetch(config.welcome.channel);
                 if (channel.guild.id !== member.guild.id) return;
                 if (!channel) return;
                 try {
                     await channel.send({
-                        embeds: [
-                            new EmojiEmbed()
-                                .setDescription(string)
-                                .setStatus("Success")
-                        ],
-                        content:
-                            (config.welcome.ping
-                                ? `<@${config.welcome.ping}>`
-                                : "") + `<@${member.id}>`
+                        embeds: [new EmojiEmbed().setDescription(string).setStatus("Success")],
+                        content: (config.welcome.ping ? `<@${config.welcome.ping}>` : "") + `<@${member.id}>`
                     });
                 } catch (err) {
                     console.error(err); // TODO: SEN
diff --git a/src/utils/calculate.ts b/src/utils/calculate.ts
index 6d0c55f..6bbbe2e 100644
--- a/src/utils/calculate.ts
+++ b/src/utils/calculate.ts
@@ -21,14 +21,7 @@
     "ticketUpdate"
 ];
 
-const tickets = [
-    "support",
-    "report",
-    "question",
-    "issue",
-    "suggestion",
-    "other"
-];
+const tickets = ["support", "report", "question", "issue", "suggestion", "other"];
 
 const toHexInteger = (permissions, array?) => {
     if (!array) {
diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index 728cc52..a8c7ab4 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -1,8 +1,11 @@
 import Discord, {
     CommandInteraction,
+    Interaction,
     Message,
     MessageActionRow,
     MessageButton,
+    MessageComponentInteraction,
+    ModalSubmitInteraction,
     TextInputComponent
 } from "discord.js";
 import { modalInteractionCollector } from "./dualCollector.js";
@@ -77,7 +80,12 @@
         this.reason = reason;
         return this;
     }
-    async send(editOnly?: boolean) {
+    async send(editOnly?: boolean): Promise<{
+        success?: boolean;
+        cancelled?: boolean;
+        components?: Record<string, CustomBoolean<unknown>>;
+        newReason?: string;
+    }> {
         while (true) {
             const fullComponents = [
                 new Discord.MessageButton()
@@ -97,8 +105,7 @@
                     .setLabel(v.title)
                     .setStyle(v.active ? "SUCCESS" : "PRIMARY")
                     .setDisabled(v.disabled);
-                if (v.emoji !== undefined)
-                    button.setEmoji(getEmojiByName(v.emoji, "id"));
+                if (v.emoji !== undefined) button.setEmoji(getEmojiByName(v.emoji, "id"));
                 fullComponents.push(button);
             });
             if (this.reason !== null)
@@ -112,11 +119,7 @@
                 );
             const components = [];
             for (let i = 0; i < fullComponents.length; i += 5) {
-                components.push(
-                    new MessageActionRow().addComponents(
-                        fullComponents.slice(i, i + 5)
-                    )
-                );
+                components.push(new MessageActionRow().addComponents(fullComponents.slice(i, i + 5)));
             }
             const object = {
                 embeds: [
@@ -144,9 +147,7 @@
                 if (editOnly) {
                     m = (await this.interaction.editReply(object)) as Message;
                 } else {
-                    m = (await this.interaction.reply(
-                        object
-                    )) as unknown as Message;
+                    m = (await this.interaction.reply(object)) as unknown as Message;
                 }
             } catch {
                 return { cancelled: true };
@@ -196,9 +197,7 @@
                     embeds: [
                         new EmojiEmbed()
                             .setTitle(this.title)
-                            .setDescription(
-                                "Modal opened. If you can't see it, click back and try again."
-                            )
+                            .setDescription("Modal opened. If you can't see it, click back and try again.")
                             .setStatus(this.color)
                             .setEmoji(this.emoji)
                     ],
@@ -216,23 +215,27 @@
                 try {
                     out = await modalInteractionCollector(
                         m,
-                        (m) => m.channel.id === this.interaction.channel.id,
+                        (m: Interaction) =>
+                            (m as MessageComponentInteraction | ModalSubmitInteraction).channelId ===
+                            this.interaction.channelId,
                         (m) => m.customId === "reason"
                     );
                 } catch (e) {
-                    return {};
+                    return { cancelled: true };
                 }
-                if (out.fields) {
+                if (out === null) {
+                    return { cancelled: true };
+                }
+                if (out instanceof ModalSubmitInteraction) {
                     return {
-                        newReason: out.fields.getTextInputValue("reason") ?? ""
+                        newReason: out.fields.getTextInputValue("reason")
                     };
                 } else {
-                    return { newReason: this.reason };
+                    return { components: this.customButtons };
                 }
             } else {
                 component.deferUpdate();
-                this.customButtons[component.customId].active =
-                    !this.customButtons[component.customId].active;
+                this.customButtons[component.customId]!.active = !this.customButtons[component.customId]!.active;
                 return { components: this.customButtons };
             }
         }
diff --git a/src/utils/convertCurlyBracketString.ts b/src/utils/convertCurlyBracketString.ts
index 49a4418..53c3267 100644
--- a/src/utils/convertCurlyBracketString.ts
+++ b/src/utils/convertCurlyBracketString.ts
@@ -1,33 +1,13 @@
-async function convertCurlyBracketString(
-    str,
-    memberID,
-    memberName,
-    serverName,
-    members
-): Promise<string> {
+async function convertCurlyBracketString(str, memberID, memberName, serverName, members): Promise<string> {
     const memberCount = (await members.fetch()).size;
     const bots = (await members.fetch()).filter((m) => m.user.bot).size;
     str = str
-        .replace(
-            "{member:mention}",
-            memberID ? `<@${memberID}>` : "{member:mention}"
-        )
-        .replace(
-            "{member:name}",
-            memberName ? `${memberName}` : "{member:name}"
-        )
+        .replace("{member:mention}", memberID ? `<@${memberID}>` : "{member:mention}")
+        .replace("{member:name}", memberName ? `${memberName}` : "{member:name}")
         .replace("{serverName}", serverName ? `${serverName}` : "{serverName}")
-        .replace(
-            "{memberCount}",
-            memberCount ? `${memberCount}` : "{memberCount}"
-        )
+        .replace("{memberCount}", memberCount ? `${memberCount}` : "{memberCount}")
         .replace("{memberCount:bots}", bots ? `${bots}` : "{memberCount:bots}")
-        .replace(
-            "{memberCount:humans}",
-            memberCount && bots
-                ? `${memberCount - bots}`
-                : "{memberCount:humans}"
-        );
+        .replace("{memberCount:humans}", memberCount && bots ? `${memberCount - bots}` : "{memberCount:humans}");
 
     return str;
 }
diff --git a/src/utils/createPageIndicator.ts b/src/utils/createPageIndicator.ts
index ccf18e2..ee123d6 100644
--- a/src/utils/createPageIndicator.ts
+++ b/src/utils/createPageIndicator.ts
@@ -1,16 +1,10 @@
 import getEmojiByName from "./getEmojiByName.js";
 
-function pageIndicator(
-    amount: number,
-    selected: number,
-    showDetails?: boolean | true
-) {
+function pageIndicator(amount: number, selected: number, showDetails?: boolean | true) {
     let out = "";
 
     if (amount === 1) {
-        out += getEmojiByName(
-            "TRACKS.SINGLE." + (selected === 0 ? "ACTIVE" : "INACTIVE")
-        );
+        out += getEmojiByName("TRACKS.SINGLE." + (selected === 0 ? "ACTIVE" : "INACTIVE"));
     } else {
         for (let i = 0; i < amount; i++) {
             out += getEmojiByName(
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 140dbcc..04c9e24 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -17,16 +17,9 @@
         // eslint-disable-next-line @typescript-eslint/no-explicit-any
         get(target: Record<string, any>, prop: string, receiver: any) {
             let dataToReturn = data[prop];
-            if (dataToReturn === null)
-                return Reflect.get(target, prop, receiver);
-            if (
-                typeof dataToReturn === "object" &&
-                !Array.isArray(dataToReturn)
-            )
-                dataToReturn = new Proxy(
-                    Reflect.get(target, prop, receiver),
-                    Entry(dataToReturn)
-                );
+            if (dataToReturn === null) return Reflect.get(target, prop, receiver);
+            if (typeof dataToReturn === "object" && !Array.isArray(dataToReturn))
+                dataToReturn = new Proxy(Reflect.get(target, prop, receiver), Entry(dataToReturn));
             return dataToReturn ?? Reflect.get(target, prop, receiver);
         }
     };
@@ -43,24 +36,17 @@
     }
 
     async setup() {
-        this.defaultData = (
-            await import("../config/default.json", { assert: { type: "json" } })
-        ).default as unknown as GuildConfig;
+        this.defaultData = (await import("../config/default.json", { assert: { type: "json" } }))
+            .default as unknown as GuildConfig;
+        return this;
     }
 
     async read(guild: string) {
         const entry = await this.guilds.findOne({ id: guild });
-        return new Proxy(
-            structuredClone(this.defaultData),
-            Entry(entry)
-        ) as unknown as GuildConfig;
+        return new Proxy(structuredClone(this.defaultData), Entry(entry)) as unknown as GuildConfig;
     }
 
-    async write(
-        guild: string,
-        set: object | null,
-        unset: string[] | string = []
-    ) {
+    async write(guild: string, set: object | null, unset: string[] | string = []) {
         // eslint-disable-next-line @typescript-eslint/no-explicit-any
         const uo: Record<string, any> = {};
         if (!Array.isArray(unset)) unset = [unset];
@@ -195,11 +181,7 @@
     }
 
     async create(guild: string, user: string, note: string | null) {
-        await this.modNotes.updateOne(
-            { guild: guild, user: user },
-            { $set: { note: note } },
-            { upsert: true }
-        );
+        await this.modNotes.updateOne({ guild: guild, user: user }, { $set: { note: note } }, { upsert: true });
     }
 
     async read(guild: string, user: string) {
diff --git a/src/utils/defaultEmbeds.ts b/src/utils/defaultEmbeds.ts
index 68d8013..2200a5e 100644
--- a/src/utils/defaultEmbeds.ts
+++ b/src/utils/defaultEmbeds.ts
@@ -1,9 +1,5 @@
 import EmojiEmbed from "./generateEmojiEmbed.js";
 
 export const LoadingEmbed = [
-    new EmojiEmbed()
-        .setTitle("Loading")
-        .setDescription("One moment...")
-        .setStatus("Danger")
-        .setEmoji("NUCLEUS.LOADING")
+    new EmojiEmbed().setTitle("Loading").setDescription("One moment...").setStatus("Danger").setEmoji("NUCLEUS.LOADING")
 ];
diff --git a/src/utils/dualCollector.ts b/src/utils/dualCollector.ts
index 8c6e55c..abc6bb3 100644
--- a/src/utils/dualCollector.ts
+++ b/src/utils/dualCollector.ts
@@ -1,15 +1,9 @@
-import Discord, {
-    Interaction,
-    Message,
-    MessageComponentInteraction
-} from "discord.js";
+import Discord, { Interaction, Message, MessageComponentInteraction } from "discord.js";
 import client from "./client.js";
 
 export default async function (
     m: Message,
-    interactionFilter: (
-        i: MessageComponentInteraction
-    ) => boolean | Promise<boolean>,
+    interactionFilter: (i: MessageComponentInteraction) => boolean | Promise<boolean>,
     messageFilter: (m: Message) => boolean | Promise<boolean>
 ) {
     let out;
@@ -54,17 +48,14 @@
 export async function modalInteractionCollector(
     m: Message,
     modalFilter: (i: Interaction) => boolean | Promise<boolean>,
-    interactionFilter: (
-        i: MessageComponentInteraction
-    ) => boolean | Promise<boolean>
-) {
-    let out;
+    interactionFilter: (i: MessageComponentInteraction) => boolean | Promise<boolean>
+): Promise<null | Interaction> {
+    let out: Interaction;
     try {
         out = await new Promise((resolve, _reject) => {
             const int = m
                 .createMessageComponentCollector({
-                    filter: (i: MessageComponentInteraction) =>
-                        interactionFilter(i),
+                    filter: (i: MessageComponentInteraction) => interactionFilter(i),
                     time: 300000
                 })
                 .on("collect", (i: Interaction) => {
diff --git a/src/utils/eventScheduler.ts b/src/utils/eventScheduler.ts
index 6923ede..203e05b 100644
--- a/src/utils/eventScheduler.ts
+++ b/src/utils/eventScheduler.ts
@@ -23,28 +23,16 @@
             await job.remove();
         });
         this.agenda.define("deleteFile", async (job) => {
-            fs.rm(
-                path.resolve("dist/utils/temp", job.attrs.data.fileName),
-                client._error
-            );
+            fs.rm(path.resolve("dist/utils/temp", job.attrs.data.fileName), client._error);
             await job.remove();
         });
         this.agenda.define("naturalUnmute", async (job) => {
-            const { log, NucleusColors, entry, renderUser, renderDelta } =
-                client.logger;
+            const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
             const guild = await client.guilds.fetch(job.attrs.data.guild);
             const user = await guild.members.fetch(job.attrs.data.user);
             if (user.communicationDisabledUntil === null) return;
             try {
-                await client.database.history.create(
-                    "unmute",
-                    user.guild.id,
-                    user.user,
-                    null,
-                    null,
-                    null,
-                    null
-                );
+                await client.database.history.create("unmute", user.guild.id, user.user, null, null, null, null);
             } catch (e) {
                 client._error(e);
             }
@@ -60,10 +48,7 @@
                 list: {
                     memberId: entry(user.user.id, `\`${user.user.id}\``),
                     name: entry(user.user.id, renderUser(user.user)),
-                    unmuted: entry(
-                        new Date().getTime(),
-                        renderDelta(new Date().getTime())
-                    ),
+                    unmuted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
                     unmutedBy: entry(null, "*Time out ended*")
                 },
                 hidden: {
diff --git a/src/utils/generateKeyValueList.ts b/src/utils/generateKeyValueList.ts
index a158391..54b8d99 100644
--- a/src/utils/generateKeyValueList.ts
+++ b/src/utils/generateKeyValueList.ts
@@ -7,8 +7,7 @@
         .map((word) => {
             return forceCaps.includes(word.toUpperCase())
                 ? word.toUpperCase()
-                : (word[0] ?? "").toUpperCase() +
-                      word.slice(1).toLowerCase().replace("discord", "Discord");
+                : (word[0] ?? "").toUpperCase() + word.slice(1).toLowerCase().replace("discord", "Discord");
         })
         .join(" ");
     return s;
diff --git a/src/utils/log.ts b/src/utils/log.ts
index 6baa0a5..fdf17ef 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -34,9 +34,7 @@
         return `${role.name} [<@&${role.id}>]`;
     }
     renderEmoji(emoji: Discord.GuildEmoji) {
-        return `<${emoji.animated ? "a" : ""}:${emoji.name}:${emoji.id}> [\`:${
-            emoji.name
-        }:\`]`;
+        return `<${emoji.animated ? "a" : ""}:${emoji.name}:${emoji.id}> [\`:${emoji.name}:\`]`;
     }
 
     public readonly NucleusColors = {
@@ -59,17 +57,11 @@
         const config = await client.database.guilds.read(log.hidden.guild);
         if (!config.logging.logs.enabled) return;
         if (!(log.meta.calculateType === true)) {
-            if (
-                !toHexArray(config.logging.logs.toLog).includes(
-                    log.meta.calculateType
-                )
-            )
+            if (!toHexArray(config.logging.logs.toLog).includes(log.meta.calculateType))
                 return console.log("Not logging this type of event");
         }
         if (config.logging.logs.channel) {
-            const channel = (await client.channels.fetch(
-                config.logging.logs.channel
-            )) as Discord.TextChannel | null;
+            const channel = (await client.channels.fetch(config.logging.logs.channel)) as Discord.TextChannel | null;
             const description: Record<string, string> = {};
             Object.entries(log.list).map((entry) => {
                 const key: string = entry[0];
@@ -84,11 +76,7 @@
             if (channel) {
                 log.separate = log.separate || {};
                 const embed = new Discord.MessageEmbed()
-                    .setTitle(
-                        `${getEmojiByName(log.meta.emoji)} ${
-                            log.meta.displayName
-                        }`
-                    )
+                    .setTitle(`${getEmojiByName(log.meta.emoji)} ${log.meta.displayName}`)
                     .setDescription(
                         (log.separate.start ? log.separate.start + "\n" : "") +
                             generateKeyValueList(description) +
diff --git a/src/utils/temp/generateFileName.ts b/src/utils/temp/generateFileName.ts
index 956f1d7..8534846 100644
--- a/src/utils/temp/generateFileName.ts
+++ b/src/utils/temp/generateFileName.ts
@@ -12,10 +12,8 @@
     if (fs.existsSync(`./${fileName}`)) {
         fileName = generateFileName(ending);
     }
-    client.database.eventScheduler.schedule(
-        "deleteFile",
-        new Date().getTime() + 60 * 1000,
-        { fileName: `${fileName}.${ending}` }
-    );
+    client.database.eventScheduler.schedule("deleteFile", new Date().getTime() + 60 * 1000, {
+        fileName: `${fileName}.${ending}`
+    });
     return path.join(__dirname, fileName + "." + ending);
 }
