diff --git a/src/config/format.ts b/src/config/format.ts
index 03fbd85..3b977fb 100644
--- a/src/config/format.ts
+++ b/src/config/format.ts
@@ -1,21 +1,25 @@
 import fs from "fs";
 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-ignore
+// @ts-expect-error
 import * as readLine from "node:readline/promises";
 
 const defaultDict = {
-    "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)",
-    "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",
-    "pastebinApiKey": "An API key for pastebin (optional)",
-    "pastebinUsername": "Your pastebin username (optional)",
-    "pastebinPassword": "Your pastebin password (optional)"
+    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)",
+    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",
+    pastebinApiKey: "An API key for pastebin (optional)",
+    pastebinUsername: "Your pastebin username (optional)",
+    pastebinPassword: "Your pastebin password (optional)"
 };
 
 const readline = readLine.createInterface({
@@ -30,11 +34,14 @@
     return answer.toString();
 }
 
-
-export default async function(walkthrough = false) {
+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";
@@ -53,7 +60,9 @@
         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 = {};
     }
@@ -61,36 +70,58 @@
         if (!json[key]) {
             if (walkthrough) {
                 switch (key) {
-                case "enableDevelopment": {
-                    json[key] = (await getInput("\x1b[36mEnable development mode? This registers commands in a single server making it easier to test\x1b[0m(\x1b[32mY\x1b[0m/\x1b[31mn\x1b[0m) > ") || "Y").toLowerCase() === "y"; break;
-                } case "owners": {
-                    let chosen = "!";
-                    const toWrite = [];
-                    while (chosen !== "") {
-                        chosen = await getInput("\x1b[36mEnter an owner ID \x1b[0m(\x1b[35mleave blank to finish\x1b[0m) > ");
-                        if (chosen !== "") { toWrite.push(chosen); }
+                    case "enableDevelopment": {
+                        json[key] =
+                            (
+                                (await getInput(
+                                    "\x1b[36mEnable development mode? This registers commands in a single server making it easier to test\x1b[0m(\x1b[32mY\x1b[0m/\x1b[31mn\x1b[0m) > "
+                                )) || "Y"
+                            ).toLowerCase() === "y";
+                        break;
                     }
-                    json[key] = toWrite; break;
-                } default: {
-                    json[key] = await getInput(`\x1b[36m${key} \x1b[0m(\x1b[35m${defaultDict[key]}\x1b[0m) > `);
+                    case "owners": {
+                        let chosen = "!";
+                        const toWrite = [];
+                        while (chosen !== "") {
+                            chosen = await getInput(
+                                "\x1b[36mEnter an owner ID \x1b[0m(\x1b[35mleave blank to finish\x1b[0m) > "
+                            );
+                            if (chosen !== "") {
+                                toWrite.push(chosen);
+                            }
+                        }
+                        json[key] = toWrite;
+                        break;
+                    }
+                    default: {
+                        json[key] = await getInput(
+                            `\x1b[36m${key} \x1b[0m(\x1b[35m${defaultDict[key]}\x1b[0m) > `
+                        );
+                    }
                 }
-                }
+            } else {
+                json[key] = defaultDict[key];
             }
-            else { json[key] = defaultDict[key]; }
         }
     }
-    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;
     try {
         hosts = fs.readFileSync("/etc/hosts", "utf8").toString().split("\n");
     } catch (e) {
-        return console.log("\x1b[31m⚠ No /etc/hosts found. Please ensure the file exists and is readable. (Windows is not supported, Mac and Linux users should not experience this error)");
+        return console.log(
+            "\x1b[31m⚠ No /etc/hosts found. Please ensure the file exists and is readable. (Windows is not supported, Mac and Linux users should not experience this error)"
+        );
     }
-    let localhost = hosts.find(line => line.split(" ")[1] === "localhost");
-    if (localhost) { localhost = localhost.split(" ")[0]; }
-    else { localhost = "127.0.0.1"; }
+    let localhost = hosts.find((line) => line.split(" ")[1] === "localhost");
+    if (localhost) {
+        localhost = localhost.split(" ")[0];
+    } else {
+        localhost = "127.0.0.1";
+    }
     json.mongoUrl = json.mongoUrl.replace("localhost", localhost);
     json.baseUrl = json.baseUrl.replace("localhost", localhost);
 
