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