diff --git a/src/utils/calculate.ts b/src/utils/calculate.ts
index 8badc58..9bdef3b 100644
--- a/src/utils/calculate.ts
+++ b/src/utils/calculate.ts
@@ -19,7 +19,7 @@
     "autoModeratorDeleted",
     "nucleusSettingsUpdated",
     "ticketUpdate"
-]
+];
 
 const tickets = [
     "support",
@@ -28,7 +28,7 @@
     "issue",
     "suggestion",
     "other"
-]
+];
 
 const toHexInteger = (permissions, array?) => {
     if (!array) {
@@ -36,29 +36,29 @@
     }
     let int = 0n;
 
-    for(let perm of permissions) {
+    for(const perm of permissions) {
         int += BigInt(2 ** array.indexOf(perm));
     }
-    return int.toString(16)
-}
+    return int.toString(16);
+};
 
 const toHexArray = (permissionsHex, array?) => {
     if (!array) {
         array = logs;
     }
-    let permissions = [];
-    let int = (BigInt("0x" + permissionsHex)).toString(2).split('').reverse();
-    for (let index in int) {
+    const permissions = [];
+    const int = (BigInt("0x" + permissionsHex)).toString(2).split("").reverse();
+    for (const index in int) {
         if (int[index] === "1" && array.length > index) {
             permissions.push(array[index]);
         }
     }
     return permissions;
-}
+};
 
 export {
     toHexInteger,
     toHexArray,
     tickets,
     logs
-}
\ No newline at end of file
+};
\ No newline at end of file
diff --git a/src/utils/client.ts b/src/utils/client.ts
index 3f4a8a1..a343bcb 100644
--- a/src/utils/client.ts
+++ b/src/utils/client.ts
@@ -1,9 +1,9 @@
-import { HaikuClient } from 'jshaiku';
-import { Intents } from 'discord.js';
-import config from '../config/main.json' assert {type: 'json'};
+import { HaikuClient } from "jshaiku";
+import { Intents } from "discord.js";
+import config from "../config/main.json" assert {type: "json"};
 
 const client = new HaikuClient({
-    intents: new Intents(32767).bitfield,  // This is a way of specifying all intents w/o having to type them out
+    intents: new Intents(32767).bitfield  // This is a way of specifying all intents w/o having to type them out
 }, config);
 
 export default client;
\ No newline at end of file
diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index dfdc3fb..a615fae 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -1,6 +1,6 @@
 import Discord, { CommandInteraction, MessageActionRow, Message, MessageButton, TextInputComponent } from "discord.js";
 import { modalInteractionCollector } from "./dualCollector.js";
-import EmojiEmbed from "./generateEmojiEmbed.js"
+import EmojiEmbed from "./generateEmojiEmbed.js";
 import getEmojiByName from "./getEmojiByName.js";
 
 
@@ -8,7 +8,7 @@
     title: string;
     disabled: boolean;
     value: string | null;
-    emoji: string | null;
+    emoji: string | undefined;
     active: boolean;
     onClick: () => Promise<T>;
     response: T | null;
@@ -16,33 +16,33 @@
 
 class confirmationMessage {
     interaction: CommandInteraction;
-    title: string = "";
-    emoji: string = "";
-    description: string = "";
-    color: string = "";
+    title = "";
+    emoji = "";
+    description = "";
+    color = "";
     customButtons: {[index:string]: CustomBoolean<unknown>} = {};
-    inverted: boolean = false;
+    inverted = false;
     reason: string | null = null;
 
     constructor(interaction: CommandInteraction) {
         this.interaction = interaction;
     }
 
-    setTitle(title: string) { this.title = title; return this }
-    setEmoji(emoji: string) { this.emoji = emoji; return this }
-    setDescription(description: string) { this.description = description; return this }
-    setColor(color: string) { this.color = color; return this }
-    setInverted(inverted: boolean) { this.inverted = inverted; return this }
+    setTitle(title: string) { this.title = title; return this; }
+    setEmoji(emoji: string) { this.emoji = emoji; return this; }
+    setDescription(description: string) { this.description = description; return this; }
+    setColor(color: string) { this.color = color; return this; }
+    setInverted(inverted: boolean) { this.inverted = inverted; return this; }
     addCustomBoolean(customId: string, title: string, disabled: boolean, callback: () => Promise<unknown> | null, callbackClicked: string | null, emoji?: string, initial?: boolean) {        this.customButtons[customId] = {
-            title: title,
-            disabled: disabled,
-            value: callbackClicked,
-            emoji: emoji,
-            active: initial ?? false,
-            onClick: callback ?? (() => null),
-            response: null,
-        }
-        return this;
+        title: title,
+        disabled: disabled,
+        value: callbackClicked,
+        emoji: emoji,
+        active: initial ?? false,
+        onClick: callback ?? (() => null),
+        response: null
+    };
+    return this;
     }
     addReasonButton(reason: string) {
         this.reason = reason;
@@ -50,7 +50,7 @@
     }
     async send(editOnly?: boolean) {
         while (true) {
-            let fullComponents = [
+            const fullComponents = [
                 new Discord.MessageButton()
                     .setCustomId("yes")
                     .setLabel("Confirm")
@@ -61,27 +61,27 @@
                     .setLabel("Cancel")
                     .setStyle("SECONDARY")
                     .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-            ]
+            ];
             Object.entries(this.customButtons).forEach(([k, v]) => {
                 fullComponents.push(new Discord.MessageButton()
                     .setCustomId(k)
                     .setLabel(v.title)
                     .setStyle(v.active ? "SUCCESS" : "PRIMARY")
                     .setEmoji(getEmojiByName(v.emoji, "id"))
-                    .setDisabled(v.disabled))
-            })
+                    .setDisabled(v.disabled));
+            });
             if (this.reason !== null) fullComponents.push(new Discord.MessageButton()
                 .setCustomId("reason")
-                .setLabel(`Edit Reason`)
+                .setLabel("Edit Reason")
                 .setStyle("PRIMARY")
                 .setEmoji(getEmojiByName("ICONS.EDIT", "id"))
                 .setDisabled(false)
-            )
-            let components = []
+            );
+            const components = [];
             for (let i = 0; i < fullComponents.length; i += 5) {
                 components.push(new MessageActionRow().addComponents(fullComponents.slice(i, i + 5)));
             }
-            let object = {
+            const object = {
                 embeds: [
                     new EmojiEmbed()
                         .setEmoji(this.emoji)
@@ -95,15 +95,15 @@
                 components: components,
                 ephemeral: true,
                 fetchReply: true
-            }
+            };
             let m;
             try {
                 if ( editOnly ) {
                     m = await this.interaction.editReply(object);
                 } else {
-                    m = await this.interaction.reply(object)
+                    m = await this.interaction.reply(object);
                 }
-            } catch { return { cancelled: true } }
+            } catch { return { cancelled: true }; }
             let component;
             try {
                 component = await (m as Message).awaitMessageComponent({filter: (m) => m.user.id === this.interaction.user.id, time: 300000});
@@ -112,17 +112,17 @@
             }
             if (component.customId === "yes") {
                 component.deferUpdate();
-                for (let [k, v] of Object.entries(this.customButtons)) {
-                    if (!v.active) continue
+                for (const v of Object.values(this.customButtons)) {
+                    if (!v.active) continue;
                     try { v.response = await v.onClick(); }
-                    catch (e) { console.log(e) }
-                };
+                    catch (e) { console.log(e); }
+                }
                 return { success: true, components: this.customButtons };
             } else if (component.customId === "no") {
                 component.deferUpdate();
                 return { success: false, components: this.customButtons };
             } else if (component.customId === "reason") {
-                await component.showModal(new Discord.Modal().setCustomId("modal").setTitle(`Editing reason`).addComponents(
+                await component.showModal(new Discord.Modal().setCustomId("modal").setTitle("Editing reason").addComponents(
                     new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
                         .setCustomId("reason")
                         .setLabel("Reason")
@@ -132,7 +132,7 @@
                         .setPlaceholder("Spammed in #general")
                         .setValue(this.reason ? this.reason : "")
                     )
-                ))
+                ));
                 await this.interaction.editReply({
                     embeds: [new EmojiEmbed()
                         .setTitle(this.title)
@@ -148,10 +148,10 @@
                 });
                 let out;
                 try {
-                    out = await modalInteractionCollector(m, (m) => m.channel.id === this.interaction.channel.id, (m) => m.customId === "reason")
-                } catch (e) { return {} }
+                    out = await modalInteractionCollector(m, (m) => m.channel.id === this.interaction.channel.id, (m) => m.customId === "reason");
+                } catch (e) { return {}; }
                 if (out.fields) { return { newReason: out.fields.getTextInputValue("reason") ?? "" }; }
-                else { return { newReason: this.reason } }
+                else { return { newReason: this.reason }; }
             } else {
                 component.deferUpdate();
                 this.customButtons[component.customId].active = !this.customButtons[component.customId].active;
diff --git a/src/utils/convertCurlyBracketString.ts b/src/utils/convertCurlyBracketString.ts
index 6ffdc8f..f05076e 100644
--- a/src/utils/convertCurlyBracketString.ts
+++ b/src/utils/convertCurlyBracketString.ts
@@ -1,6 +1,6 @@
 async function convertCurlyBracketString(str, memberID, memberName, serverName, members): Promise<string> {
-    let memberCount = (await members.fetch()).size
-    let bots = (await members.fetch()).filter(m => m.user.bot).size
+    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}")
@@ -9,7 +9,7 @@
         .replace("{memberCount:bots}", bots ? `${bots}` : "{memberCount:bots}")
         .replace("{memberCount:humans}", (memberCount && bots) ? `${memberCount - bots}` : "{memberCount:humans}");
 
-    return str
+    return str;
 }
 
 export default convertCurlyBracketString;
diff --git a/src/utils/createLogException.ts b/src/utils/createLogException.ts
index 0223d2f..c62a824 100644
--- a/src/utils/createLogException.ts
+++ b/src/utils/createLogException.ts
@@ -3,6 +3,6 @@
 export default function (guild: string, channel: string, message: string) {
     client.noLog.push(`${guild}/${channel}/${message}`);
     setTimeout(() => {
-        client.noLog = client.noLog.filter((i) => {return i !== `${guild}/${channel}/${message}`});
+        client.noLog = client.noLog.filter((i) => {return i !== `${guild}/${channel}/${message}`;});
     }, 500);
 }
\ No newline at end of file
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 8a5ca6f..cffdf04 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -1,57 +1,68 @@
-import Discord from 'discord.js';
-import { Collection, MongoClient } from 'mongodb';
-import structuredClone from '@ungap/structured-clone';
-import config from '../config/main.json' assert {type: 'json'};
+import type Discord from "discord.js";
+import { Collection, MongoClient } from "mongodb";
+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
+// @ts-ignore
+import structuredClone from "@ungap/structured-clone";
+import config from "../config/main.json" assert {type: "json"};
 
 
 const mongoClient = new MongoClient(config.mongoUrl);
-await mongoClient.connect()
+await mongoClient.connect();
 const database = mongoClient.db("Nucleus");
 
-
-export const Entry = data => {
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export const Entry = (data: any) => {
     data = data ?? {};
-    data.getKey = key => data[key]
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
+    data.getKey = (key: any) => data[key];
     return {
-        get(target, prop, receiver) {
-            let dataToReturn = data[prop]
+        // 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),
-            )
+                Entry(dataToReturn)
+            );
             return dataToReturn ?? Reflect.get(target, prop, receiver);
         }
-    }
-}
+    };
+};
 
 
 export class Guilds {
     guilds: Collection<GuildConfig>;
-    defaultData: GuildConfig;
-    async setup() {
+    defaultData: GuildConfig | null;
+
+    constructor() {
         this.guilds = database.collection<GuildConfig>("guilds");
-        this.defaultData = (await import("../config/default.json", { assert: { type: "json" }})).default as unknown as GuildConfig;
+        this.defaultData = null;
         return this;
     }
 
+    async setup() {
+        this.defaultData = (await import("../config/default.json", { assert: { type: "json" }})).default as unknown as GuildConfig;
+    }
+
     async read(guild: string) {
-        let entry = await this.guilds.findOne({ id: guild });
-        return new Proxy(structuredClone(this.defaultData), Entry(entry)) as unknown as GuildConfig
+        const entry = await this.guilds.findOne({ id: guild });
+        return new Proxy(structuredClone(this.defaultData), Entry(entry)) as unknown as GuildConfig;
     }
 
     async write(guild: string, set: object | null, unset: string[] | string = []) {
-        let uo = {}
-        if (!Array.isArray(unset)) unset = [unset]
-        for (let key of unset) {
+        // eslint-disable-next-line @typescript-eslint/no-explicit-any
+        const uo: Record<string, any> = {};
+        if (!Array.isArray(unset)) unset = [unset];
+        for (const key of unset) {
             uo[key] = null;
         }
-        let out = {$set: {}, $unset: {}}
+        const out = {$set: {}, $unset: {}};
         if (set) out["$set"] = set;
         if (unset.length) out["$unset"] = uo;
         await this.guilds.updateOne({ id: guild }, out, { upsert: true });
     }
 
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
     async append(guild: string, key: string, value: any) {
         if (Array.isArray(value)) {
             await this.guilds.updateOne({ id: guild }, {
@@ -64,8 +75,9 @@
         }
     }
 
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
     async remove(guild: string, key: string, value: any, innerKey?: string | null) {
-        console.log(Array.isArray(value))
+        console.log(Array.isArray(value));
         if (innerKey) {
             await this.guilds.updateOne({ id: guild }, {
                 $pull: { [key]: { [innerKey]: { $eq: value } } }
@@ -111,7 +123,7 @@
     }
 
     async read(guild: string, user: string, year: number) {
-        let entry = (await this.histories.find({
+        const entry = (await this.histories.find({
             guild: guild,
             user: user,
             occurredAt: {
@@ -141,7 +153,7 @@
     }
 
     async read(guild: string, user: string) {
-        let entry = await this.modNotes.findOne({ guild: guild, user: user });
+        const entry = await this.modNotes.findOne({ guild: guild, user: user });
         return entry?.note ?? null;
     }
 }
@@ -155,7 +167,7 @@
     }
 
     async hasPremium(guild: string) {
-        let entry = await this.premium.findOne({ appliesTo: { $in: [guild] } });
+        const entry = await this.premium.findOne({ appliesTo: { $in: [guild] } });
         return entry !== null;
     }
 }
@@ -186,11 +198,7 @@
         },
         invite: {
             enabled: boolean,
-            allowed: {
-                users: string[],
-                channels: string[],
-                roles: string[]
-            }
+            channels: string[]
         },
         pings: {
             mass: number,
@@ -215,7 +223,7 @@
         channel: string | null,
         message: string | null,
     }
-    stats: {}
+    stats: Record<string, {name: string, enabled: boolean}>
     logging: {
         logs: {
             enabled: boolean,
@@ -227,7 +235,7 @@
         },
         attachments: {
             channel: string | null,
-            saved: {}  // {channelID+messageID: log url (string)}
+            saved: Record<string, string>
         }
     }
     verify: {
@@ -292,8 +300,8 @@
             }[]
         }[]
     }
-    tags: {}
-};
+    tags: Record<string, string>
+}
 
 export interface HistorySchema {
     type: string,
diff --git a/src/utils/defaultEmbeds.ts b/src/utils/defaultEmbeds.ts
index e799307..ce6edc1 100644
--- a/src/utils/defaultEmbeds.ts
+++ b/src/utils/defaultEmbeds.ts
@@ -1,9 +1,9 @@
-import EmojiEmbed from "./generateEmojiEmbed.js"
+import EmojiEmbed from "./generateEmojiEmbed.js";
 
 export const LoadingEmbed = [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 67cef5c..c785d0a 100644
--- a/src/utils/dualCollector.ts
+++ b/src/utils/dualCollector.ts
@@ -1,21 +1,19 @@
-import Discord from 'discord.js';
-import client from './client.js';
-import EmojiEmbed from "./generateEmojiEmbed.js";
+import Discord from "discord.js";
+import client from "./client.js";
 
 export default async function (m, interactionFilter, messageFilter) {
     let out;
     try {
-        out = await new Promise((resolve, reject) => {
-            let mes, int;
-            mes = m.createMessageComponentCollector({filter: (m) => interactionFilter(m), time: 300000})
-                .on("collect", (m) => { resolve(m); })
-            int = m.channel.createMessageCollector({filter: (m) => messageFilter(m), time: 300000})
-                .then("collect", (m) => { try {m.delete();} catch {}; resolve(m); })
-            mes.on("end", () => { int.stop(); })
-            int.on("end", () => { mes.stop(); })
-        })
+        out = await new Promise((resolve, _reject) => {
+            const mes = m.createMessageComponentCollector({filter: (m) => interactionFilter(m), time: 300000})
+                .on("collect", (m) => { resolve(m); });
+            const int = m.channel.createMessageCollector({filter: (m) => messageFilter(m), time: 300000})
+                .then("collect", (m) => { try {m.delete();} catch (e) { client._error(e); } resolve(m); });
+            mes.on("end", () => { int.stop(); });
+            int.on("end", () => { mes.stop(); });
+        });
     } catch(e) {
-        console.log(e)
+        console.log(e);
         return null;
     }
 
@@ -25,24 +23,23 @@
 export async function modalInteractionCollector(m, modalFilter, interactionFilter) {
     let out;
     try {
-        out = await new Promise((resolve, reject) => {
-            let mod, int;
-            int = m.createMessageComponentCollector({filter: (m) => interactionFilter(m), time: 300000})
-                .on("collect", (m) => { resolve(m); })
-            mod = new Discord.InteractionCollector(
+        out = await new Promise((resolve, _reject) => {
+            const int = m.createMessageComponentCollector({filter: (m) => interactionFilter(m), time: 300000})
+                .on("collect", (m) => { resolve(m); });
+            const mod = new Discord.InteractionCollector(
                 client, {
                     filter: (m) => modalFilter(m),
                     time: 300000
                 })
                 .on("collect", async (m) => {
                     int.stop();
-                    (m as Discord.ModalSubmitInteraction).deferUpdate()
-                    resolve((m as Discord.ModalSubmitInteraction)); })
-            int.on("end", () => { mod.stop(); })
-            mod.on("end", () => { int.stop(); })
-        })
+                    (m as Discord.ModalSubmitInteraction).deferUpdate();
+                    resolve((m as Discord.ModalSubmitInteraction)); });
+            int.on("end", () => { mod.stop(); });
+            mod.on("end", () => { int.stop(); });
+        });
     } catch(e) {
-        console.log(e)
+        console.log(e);
         return null;
     }
     return out;
diff --git a/src/utils/eventScheduler.ts b/src/utils/eventScheduler.ts
index 396b202..cde178f 100644
--- a/src/utils/eventScheduler.ts
+++ b/src/utils/eventScheduler.ts
@@ -1,39 +1,39 @@
 import { Agenda } from "agenda/es.js";
-import client from './client.js';
-import * as fs from 'fs';
-import * as path from 'path';
-import config from '../config/main.json' assert {type: 'json'};
+import client from "./client.js";
+import * as fs from "fs";
+import * as path from "path";
+import config from "../config/main.json" assert {type: "json"};
 
 class EventScheduler {
     private agenda: Agenda;
 
     constructor() {
-        this.agenda = new Agenda({db: {address: config.mongoUrl + "Nucleus", collection: 'eventScheduler'}})
+        this.agenda = new Agenda({db: {address: config.mongoUrl + "Nucleus", collection: "eventScheduler"}});
 
         this.agenda.define("unmuteRole", async (job: Agenda.job) => {
-            let guild = await client.guilds.fetch(job.attrs.data.guild);
-            let user = await guild.members.fetch(job.attrs.data.user);
-            let role = await guild.roles.fetch(job.attrs.data.role);
+            const guild = await client.guilds.fetch(job.attrs.data.guild);
+            const user = await guild.members.fetch(job.attrs.data.user);
+            const role = await guild.roles.fetch(job.attrs.data.role);
             await user.roles.remove(role);
             await job.remove();
-        })
+        });
         this.agenda.define("deleteFile", async (job: Agenda.job) => {
-            fs.rm(path.resolve("dist/utils/temp", job.attrs.data.fileName), (err) => {})
+            fs.rm(path.resolve("dist/utils/temp", job.attrs.data.fileName), client._error);
             await job.remove();
-        })
+        });
         this.agenda.define("naturalUnmute", async (job: Agenda.job) => {
-            const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger
-            let guild = await client.guilds.fetch(job.attrs.data.guild);
-            let user = await guild.members.fetch(job.attrs.data.user);
-            if (user.communicationDisabledUntil === null) return
+            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
-            )} catch {}
-            let data = {
+            );} catch (e) { client._error(e); }
+            const data = {
                 meta: {
-                    type: 'memberUnmute',
-                    displayName: 'Unmuted',
-                    calculateType: 'guildMemberPunish',
+                    type: "memberUnmute",
+                    displayName: "Unmuted",
+                    calculateType: "guildMemberPunish",
                     color: NucleusColors.green,
                     emoji: "PUNISH.MUTE.GREEN",
                     timestamp: new Date().getTime()
@@ -47,23 +47,25 @@
                 hidden: {
                     guild: guild.id
                 }
-            }
+            };
             log(data);
-        })
+        });
     }
 
     async start() {
-        await new Promise(resolve => this.agenda.once('ready', resolve));
-        this.agenda.start()
-        return this
+        await new Promise(resolve => this.agenda.once("ready", resolve));
+        this.agenda.start();
+        return this;
     }
 
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
     async schedule(name: string, time: string, data: any) {
-        await this.agenda.schedule(time, name, data)
+        await this.agenda.schedule(time, name, data);
     }
 
-    cancel(name: string, data: Object) {
-        this.agenda.cancel({name, data})
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
+    cancel(name: string, data: any) {
+        this.agenda.cancel({name, data});
     }
 }
 
diff --git a/src/utils/generateEmojiEmbed.ts b/src/utils/generateEmojiEmbed.ts
index 8fe594b..7587db7 100644
--- a/src/utils/generateEmojiEmbed.ts
+++ b/src/utils/generateEmojiEmbed.ts
@@ -1,16 +1,17 @@
-import Discord, { CommandInteraction, ColorResolvable, MessageEmbed } from "discord.js";
+import { MessageEmbed } from "discord.js";
 import getEmojiByName from "./getEmojiByName.js";
 
 const colors = {
     "Danger": 0xF27878,
     "Warning": 0xF2D478,
     "Success": 0x68D49E
-}
+};
 
 class EmojiEmbed extends MessageEmbed {
     _title: string;
     _emoji: string;
 
+    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
     // @ts-ignore
     // This *is* meant to be an accessor rather than a property
     get title() {
@@ -21,9 +22,9 @@
         this._title = title;
     }
 
-    setTitle(title: string) { this._title = title; return this }
-    setEmoji(emoji: string) { this._emoji = emoji; return this }
-    setStatus(color: string) { this.setColor(colors[color]); return this }
+    setTitle(title: string) { this._title = title; return this; }
+    setEmoji(emoji: string) { this._emoji = emoji; return this; }
+    setStatus(color: string) { this.setColor(colors[color]); return this; }
 }
 
 export default EmojiEmbed;
\ No newline at end of file
diff --git a/src/utils/generateKeyValueList.ts b/src/utils/generateKeyValueList.ts
index 1a76fa7..ecb9780 100644
--- a/src/utils/generateKeyValueList.ts
+++ b/src/utils/generateKeyValueList.ts
@@ -2,17 +2,17 @@
     "ID",
     "NSFW",
     "URL"
-]
+];
 
 export function capitalize(s: string) {
-    s = s.replace(/([A-Z])/g, ' $1');
+    s = s.replace(/([A-Z])/g, " $1");
     s = s.split(" ").map(word => {
         return forceCaps.includes(word.toUpperCase()) ? word.toUpperCase() : word[0]
             .toUpperCase() + word.slice(1)
             .toLowerCase()
-            .replace("discord", "Discord")
+            .replace("discord", "Discord");
     }).join(" ");
-    return s
+    return s;
 }
 
 export function toCapitals(s: string) {
@@ -22,8 +22,8 @@
 function keyValueList(data) {
     let out = "";
     Object.entries(data).map(([key, value]) => {
-        out += `**${capitalize(key)}:** ${value}\n`
-    })
+        out += `**${capitalize(key)}:** ${value}\n`;
+    });
     return out;
 }
 
diff --git a/src/utils/getEmojiByName.ts b/src/utils/getEmojiByName.ts
index 80410df..63b2042 100644
--- a/src/utils/getEmojiByName.ts
+++ b/src/utils/getEmojiByName.ts
@@ -1,8 +1,8 @@
-import emojis from '../config/emojis.json' assert {type: 'json'};
+import emojis from "../config/emojis.json" assert {type: "json"};
 
 function getEmojiByName(name: string, format?: string): string {
-    let split = name.split(".");
-    let id = emojis
+    const split = name.split(".");
+    let id = emojis;
     split.forEach(part => {
         id = id[part];
     });
@@ -11,9 +11,9 @@
         return id.toString();
     }
     if (id === undefined) {
-        return `<a:_:946346549271732234>`
+        return "<a:_:946346549271732234>";
     } else if (id.toString().startsWith("a")) {
-        return `<a:_:${id.toString().slice(1, id.toString().length)}>`
+        return `<a:_:${id.toString().slice(1, id.toString().length)}>`;
     }
     return `<:_:${id}>`;
 }
diff --git a/src/utils/log.ts b/src/utils/log.ts
index 0c6aa89..34b24c6 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -1,33 +1,32 @@
-import * as fs from 'fs';
-import * as Discord from 'discord.js';
-import getEmojiByName from './getEmojiByName.js';
-import { toHexArray } from './calculate.js';
-import { promisify } from 'util';
-import generateKeyValueList from './generateKeyValueList.js';
-import client from './client.js';
+import * as Discord from "discord.js";
+import getEmojiByName from "./getEmojiByName.js";
+import { toHexArray } from "./calculate.js";
+import { promisify } from "util";
+import generateKeyValueList from "./generateKeyValueList.js";
+import client from "./client.js";
 
 const wait = promisify(setTimeout);
 
 
 export class Logger {
     renderUser(user: Discord.User | string) {
-        if (typeof user === 'string') return `${user} [<@${user}>]`;
+        if (typeof user === "string") return `${user} [<@${user}>]`;
         return `${user.username} [<@${user.id}>]`;
     }
     renderTime(t: number) {
-        t = Math.floor(t /= 1000)
+        t = Math.floor(t /= 1000);
         return `<t:${t}:D> at <t:${t}:T>`;
     }
     renderDelta(t: number) {
-        t = Math.floor(t /= 1000)
+        t = Math.floor(t /= 1000);
         return `<t:${t}:R> (<t:${t}:D> at <t:${t}:T>)`;
     }
     renderNumberDelta(num1, num2) {
-        let delta = num2 - num1;
-        return `${num1} -> ${num2} (${delta > 0 ? '+' : ''}${delta})`;
+        const delta = num2 - num1;
+        return `${num1} -> ${num2} (${delta > 0 ? "+" : ""}${delta})`;
     }
     entry(value, displayValue) {
-        return { value: value, displayValue: displayValue }
+        return { value: value, displayValue: displayValue };
     }
     renderChannel(channel: Discord.GuildChannel | Discord.ThreadChannel) {
         return `${channel.name} [<#${channel.id}>]`;
@@ -36,43 +35,45 @@
         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 = {
         red: 0xF27878,
         yellow: 0xF2D478,
-        green: 0x68D49E,
+        green: 0x68D49E
 
-    }
+    };
 
     async getAuditLog(guild: Discord.Guild, event): Promise<Discord.GuildAuditLogsEntry[]>{
-        await wait(250)
-        let auditLog = await guild.fetchAuditLogs({type: event});
+        await wait(250);
+        const auditLog = await guild.fetchAuditLogs({type: event});
         return auditLog as unknown as Discord.GuildAuditLogsEntry[];
     }
 
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
     async log(log: any): Promise<void> {
-        let config = await client.database.guilds.read(log.hidden.guild);
+        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)) return console.log('Not logging this type of event');
+            if(!toHexArray(config.logging.logs.toLog).includes(log.meta.calculateType)) return console.log("Not logging this type of event");
         }
         if (config.logging.logs.channel) {
-            let channel = await client.channels.fetch(config.logging.logs.channel) as Discord.TextChannel;
-            let description = {};
+            const channel = await client.channels.fetch(config.logging.logs.channel) as Discord.TextChannel;
+            const description = {};
             Object.entries(log.list).map(entry => {
-                let key = entry[0];
-                let value:any = entry[1];
+                const key = entry[0];
+                // eslint-disable-next-line @typescript-eslint/no-explicit-any
+                const value: any = entry[1];
                 if(value.displayValue) {
                     description[key] = value.displayValue;
                 } else {
                     description[key] = value;
                 }
-            })
+            });
             if (channel) {
                 log.separate = log.separate || {};
-                let embed = new Discord.MessageEmbed()
+                const embed = new Discord.MessageEmbed()
                     .setTitle(`${getEmojiByName(log.meta.emoji)} ${log.meta.displayName}`)
                     .setDescription(
                         (log.separate.start ? log.separate.start + "\n" : "") +
@@ -88,4 +89,4 @@
 }
 
 
-export default {}
+export default {};
diff --git a/src/utils/memory.ts b/src/utils/memory.ts
index a06705b..070bd7f 100644
--- a/src/utils/memory.ts
+++ b/src/utils/memory.ts
@@ -1,29 +1,30 @@
 import client from "./client.js";
 
 class Memory {
-    memory: {};
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
+    memory: Record<string, any>;
     constructor() {
         this.memory = {};
 
         setInterval(() => {
-            for (let guild in this.memory) {
+            for (const guild in this.memory) {
                 if (this.memory[guild].updated + 15 * 60 * 1000 < Date.now()) {
                     delete this.memory[guild];
                 }
             }
-        }, 1000 * 60 * 30)
+        }, 1000 * 60 * 30);
     }
 
     async readGuildInfo(guild: string): Promise<object> {
         if (!this.memory[guild]) {
-            let guildData = await client.database.guilds.read(guild);
+            const guildData = await client.database.guilds.read(guild);
             this.memory[guild] = {
                 lastUpdated: Date.now(),
                 filters: guildData.filters,
                 logging: guildData.logging,
-                tickets: guildData.tickets,
+                tickets: guildData.tickets
             };
-        };
+        }
         return this.memory[guild];
     }
 }
diff --git a/src/utils/plurals.ts b/src/utils/plurals.ts
index 48b889c..619ced2 100644
--- a/src/utils/plurals.ts
+++ b/src/utils/plurals.ts
@@ -1,7 +1,7 @@
-function addPlural(amount: any, unit: string) {
+function addPlural(amount: number | string, unit: string) {
     amount = amount.toString();
-    if (amount === '1') return `${amount} ${unit}`
-    return `${amount} ${unit}s`
+    if (amount === "1") return `${amount} ${unit}`;
+    return `${amount} ${unit}s`;
 }
 
 export default addPlural;
\ No newline at end of file
diff --git a/src/utils/singleNotify.ts b/src/utils/singleNotify.ts
index f29d775..44bb2d0 100644
--- a/src/utils/singleNotify.ts
+++ b/src/utils/singleNotify.ts
@@ -1,29 +1,29 @@
-import client from './client.js';
+import client from "./client.js";
 import EmojiEmbed from "./generateEmojiEmbed.js";
 
-let severities = {
+const severities = {
     "Critical": "Danger",
     "Warning": "Warning",
     "Info": "Success"
-}
+};
 
 export default async function(type: string, guild: string, message: string | true, severity?: string) {
-    let data = await client.database.guilds.read(guild);
+    const data = await client.database.guilds.read(guild);
     if (message === true) {
         return await client.database.guilds.write(guild, {[`singleEventNotifications.${type}`]: false});
     }
     if (data.singleEventNotifications[type]) return;
     await client.database.guilds.write(guild, {[`singleEventNotifications.${type}`]: true});
     try {
-        let channel = await client.channels.fetch(data.logging.staff.channel);
+        const channel = await client.channels.fetch(data.logging.staff.channel);
         if (!channel) return;
         await channel.send({embeds: [new EmojiEmbed()
             .setTitle(`${severity} notification`)
             .setDescription(message)
             .setStatus(severities[severity])
             .setEmoji("CONTROL.BLOCKCROSS")
-        ]})
+        ]});
     } catch (err) {
-        console.error(err)
+        console.error(err);
     }
 }
diff --git a/src/utils/temp/generateFileName.ts b/src/utils/temp/generateFileName.ts
index f9662ad..8a219b7 100644
--- a/src/utils/temp/generateFileName.ts
+++ b/src/utils/temp/generateFileName.ts
@@ -1,17 +1,17 @@
-import * as fs from 'fs';
-import * as crypto from 'crypto';
-import client from '../client.js';
-import * as path from 'path'
-import {fileURLToPath} from 'url';
+import * as fs from "fs";
+import * as crypto from "crypto";
+import client from "../client.js";
+import * as path from "path";
+import {fileURLToPath} from "url";
 const __filename = fileURLToPath(import.meta.url);
 const __dirname = path.dirname(__filename);
 
 export default function generateFileName(ending: string): string {
-    let fileName = crypto.randomBytes(35).toString('hex');
-    fileName = fileName.replace(/([a-zA-Z0-9]{8})/g, '$1-');
+    let fileName = crypto.randomBytes(35).toString("hex");
+    fileName = fileName.replace(/([a-zA-Z0-9]{8})/g, "$1-");
     if (fs.existsSync(`./${fileName}`)) {
         fileName = generateFileName(ending);
     }
     client.database.eventScheduler.schedule("deleteFile", new Date().getTime() + (60 * 1000), {fileName: `${fileName}.${ending}`});
-    return path.join(__dirname, fileName + '.' + ending);
+    return path.join(__dirname, fileName + "." + ending);
 }
