diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 5015ad5..12384fc 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -2,15 +2,15 @@
 name: Bug report
 about: Something doesn't work how you expect it to
 title: "[BUG]"
-labels: ''
+labels: ""
 assignees: PineaFan
-
 ---
 
 [Describe the bug in one line, keep it concise]
 
 **To Reproduce**
 Steps to reproduce the behaviour:
+
 1. Go to '...'
 2. Click on '....'
 3. Scroll down to '....'
@@ -23,9 +23,10 @@
 If applicable, add screenshots to help explain your problem.
 
 **Desktop (please complete the following information):**
- - OS: [e.g. iOS]
- - Browser [e.g. chrome, safari]
- - Version [e.g. 22]
+
+-   OS: [e.g. iOS]
+-   Browser [e.g. chrome, safari]
+-   Version [e.g. 22]
 
 **Additional context**
 Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
index 07c05ae..b865782 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -2,9 +2,8 @@
 name: Feature request
 about: I want something added to Nucleus
 title: "[FEATURE]"
-labels: ''
+labels: ""
 assignees: PineaFan
-
 ---
 
 **Is your feature request related to a problem? Please describe.**
diff --git a/ClicksMigratingProblems/index.js b/ClicksMigratingProblems/index.js
index b79146c..a9132f8 100644
--- a/ClicksMigratingProblems/index.js
+++ b/ClicksMigratingProblems/index.js
@@ -29,104 +29,131 @@
     }
     // Convert to the new format
     const newData = {
-        "id": data.guild_info.id.toString(),
-        "version": 1,
-        "singleEventNotifications": {
-            "statsChannelDeleted": false
+        id: data.guild_info.id.toString(),
+        version: 1,
+        singleEventNotifications: {
+            statsChannelDeleted: false
         },
-        "filters": {
-            "images": {
-                "NSFW": !data.images.nsfw,
-                "size": data.images.toosmall
+        filters: {
+            images: {
+                NSFW: !data.images.nsfw,
+                size: data.images.toosmall
             },
-            "wordFilter": {
-                "enabled": true,
-                "words": {
-                    "strict": data.wordfilter.strict,
-                    "loose": data.wordfilter.soft
+            wordFilter: {
+                enabled: true,
+                words: {
+                    strict: data.wordfilter.strict,
+                    loose: data.wordfilter.soft
                 }
             },
-            "invite": {
-                "enabled": data.invite ? data.invite.enabled : false,
-                "channels": data.invite ? data.invite.whitelist.channels.map(channel => channel.toString()) : []
+            invite: {
+                enabled: data.invite ? data.invite.enabled : false,
+                channels: data.invite
+                    ? data.invite.whitelist.channels.map((channel) =>
+                          channel.toString()
+                      )
+                    : []
             },
-            "pings": {
-                "mass": 5,
-                "everyone": true,
-                "roles": true
+            pings: {
+                mass: 5,
+                everyone: true,
+                roles: true
             }
         },
-        "welcome": {
-            "enabled": data.welcome ? (data.welcome.message.text !== null) : false,
-            "verificationRequired": {
-                "message": null,
-                "role": null
+        welcome: {
+            enabled: data.welcome ? data.welcome.message.text !== null : false,
+            verificationRequired: {
+                message: null,
+                role: 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() : null) : null,
-            "message": data.welcome ? (data.welcome.message.text) : 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()
+                    : null
+                : null,
+            message: data.welcome ? data.welcome.message.text : null
         },
-        "stats": {},
-        "logging": {
-            "logs": {
-                "enabled": true,
-                "channel": data.log_info.log_channel ? data.log_info.log_channel.toString() : null,
-                "toLog": "3fffff"
+        stats: {},
+        logging: {
+            logs: {
+                enabled: true,
+                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
+            staff: {
+                channel: data.log_info.staff
+                    ? data.log_info.staff.toString()
+                    : null
             }
         },
-        "verify": {
-            "enabled": data.verify_role !== null,
-            "role": data.verify_role ? data.verify_role.toString() : null
+        verify: {
+            enabled: data.verify_role !== null,
+            role: data.verify_role ? data.verify_role.toString() : null
         },
-        "tickets": {
-            "enabled": data.modmail ? (data.modmail.cat !== 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,
-            "maxTickets": data.modmail ? (data.modmail.max) : 5
+        tickets: {
+            enabled: data.modmail ? data.modmail.cat !== 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,
+            maxTickets: data.modmail ? data.modmail.max : 5
         },
-        "moderation": {
-            "mute": {
-                "timeout": true,
-                "role": null,
-                "text": null,
-                "link": null
+        moderation: {
+            mute: {
+                timeout: true,
+                role: null,
+                text: null,
+                link: null
             },
-            "kick": {
-                "text": null,
-                "link": null
+            kick: {
+                text: null,
+                link: null
             },
-            "ban": {
-                "text": null,
-                "link": null
+            ban: {
+                text: null,
+                link: null
             },
-            "softban": {
-                "text": null,
-                "link": null
+            softban: {
+                text: null,
+                link: null
             },
-            "warn": {
-                "text": null,
-                "link": null
+            warn: {
+                text: null,
+                link: null
             },
-            "role": {
-                "role": null
+            role: {
+                role: null
             }
         },
-        "tracks": [],
-        "roleMenu": [],
-        "tags": data.tags
+        tracks: [],
+        roleMenu: [],
+        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}`);
     x++;
 }
 
-
 // console.log((await collection.findOne({ id: "your mother" })));
diff --git a/ClicksMigratingProblems/package-lock.json b/ClicksMigratingProblems/package-lock.json
index d7c59c6..5ec6ea0 100644
--- a/ClicksMigratingProblems/package-lock.json
+++ b/ClicksMigratingProblems/package-lock.json
@@ -1,389 +1,389 @@
 {
-  "name": "hi",
-  "version": "1.0.0",
-  "lockfileVersion": 2,
-  "requires": true,
-  "packages": {
-    "": {
-      "name": "hi",
-      "version": "1.0.0",
-      "license": "ISC",
-      "dependencies": {
-        "fs": "^0.0.1-security",
-        "mongodb": "^4.7.0"
-      }
-    },
-    "node_modules/@types/node": {
-      "version": "17.0.41",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.41.tgz",
-      "integrity": "sha512-xA6drNNeqb5YyV5fO3OAEsnXLfO7uF0whiOfPTz5AeDo8KeZFmODKnvwPymMNO8qE/an8pVY/O50tig2SQCrGw=="
-    },
-    "node_modules/@types/webidl-conversions": {
-      "version": "6.1.1",
-      "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz",
-      "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q=="
-    },
-    "node_modules/@types/whatwg-url": {
-      "version": "8.2.1",
-      "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.1.tgz",
-      "integrity": "sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==",
-      "dependencies": {
-        "@types/node": "*",
-        "@types/webidl-conversions": "*"
-      }
-    },
-    "node_modules/base64-js": {
-      "version": "1.5.1",
-      "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
-      "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
-      "funding": [
-        {
-          "type": "github",
-          "url": "https://github.com/sponsors/feross"
+    "name": "hi",
+    "version": "1.0.0",
+    "lockfileVersion": 2,
+    "requires": true,
+    "packages": {
+        "": {
+            "name": "hi",
+            "version": "1.0.0",
+            "license": "ISC",
+            "dependencies": {
+                "fs": "^0.0.1-security",
+                "mongodb": "^4.7.0"
+            }
         },
-        {
-          "type": "patreon",
-          "url": "https://www.patreon.com/feross"
+        "node_modules/@types/node": {
+            "version": "17.0.41",
+            "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.41.tgz",
+            "integrity": "sha512-xA6drNNeqb5YyV5fO3OAEsnXLfO7uF0whiOfPTz5AeDo8KeZFmODKnvwPymMNO8qE/an8pVY/O50tig2SQCrGw=="
         },
-        {
-          "type": "consulting",
-          "url": "https://feross.org/support"
+        "node_modules/@types/webidl-conversions": {
+            "version": "6.1.1",
+            "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz",
+            "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q=="
+        },
+        "node_modules/@types/whatwg-url": {
+            "version": "8.2.1",
+            "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.1.tgz",
+            "integrity": "sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==",
+            "dependencies": {
+                "@types/node": "*",
+                "@types/webidl-conversions": "*"
+            }
+        },
+        "node_modules/base64-js": {
+            "version": "1.5.1",
+            "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+            "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
+            "funding": [
+                {
+                    "type": "github",
+                    "url": "https://github.com/sponsors/feross"
+                },
+                {
+                    "type": "patreon",
+                    "url": "https://www.patreon.com/feross"
+                },
+                {
+                    "type": "consulting",
+                    "url": "https://feross.org/support"
+                }
+            ]
+        },
+        "node_modules/bson": {
+            "version": "4.6.4",
+            "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.4.tgz",
+            "integrity": "sha512-TdQ3FzguAu5HKPPlr0kYQCyrYUYh8tFM+CMTpxjNzVzxeiJY00Rtuj3LXLHSgiGvmaWlZ8PE+4KyM2thqE38pQ==",
+            "dependencies": {
+                "buffer": "^5.6.0"
+            },
+            "engines": {
+                "node": ">=6.9.0"
+            }
+        },
+        "node_modules/buffer": {
+            "version": "5.7.1",
+            "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
+            "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
+            "funding": [
+                {
+                    "type": "github",
+                    "url": "https://github.com/sponsors/feross"
+                },
+                {
+                    "type": "patreon",
+                    "url": "https://www.patreon.com/feross"
+                },
+                {
+                    "type": "consulting",
+                    "url": "https://feross.org/support"
+                }
+            ],
+            "dependencies": {
+                "base64-js": "^1.3.1",
+                "ieee754": "^1.1.13"
+            }
+        },
+        "node_modules/denque": {
+            "version": "2.0.1",
+            "resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz",
+            "integrity": "sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ==",
+            "engines": {
+                "node": ">=0.10"
+            }
+        },
+        "node_modules/fs": {
+            "version": "0.0.1-security",
+            "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
+            "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
+        },
+        "node_modules/ieee754": {
+            "version": "1.2.1",
+            "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+            "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
+            "funding": [
+                {
+                    "type": "github",
+                    "url": "https://github.com/sponsors/feross"
+                },
+                {
+                    "type": "patreon",
+                    "url": "https://www.patreon.com/feross"
+                },
+                {
+                    "type": "consulting",
+                    "url": "https://feross.org/support"
+                }
+            ]
+        },
+        "node_modules/ip": {
+            "version": "1.1.8",
+            "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz",
+            "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg=="
+        },
+        "node_modules/memory-pager": {
+            "version": "1.5.0",
+            "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
+            "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
+            "optional": true
+        },
+        "node_modules/mongodb": {
+            "version": "4.7.0",
+            "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.7.0.tgz",
+            "integrity": "sha512-HhVar6hsUeMAVlIbwQwWtV36iyjKd9qdhY+s4wcU8K6TOj4Q331iiMy+FoPuxEntDIijTYWivwFJkLv8q/ZgvA==",
+            "dependencies": {
+                "bson": "^4.6.3",
+                "denque": "^2.0.1",
+                "mongodb-connection-string-url": "^2.5.2",
+                "socks": "^2.6.2"
+            },
+            "engines": {
+                "node": ">=12.9.0"
+            },
+            "optionalDependencies": {
+                "saslprep": "^1.0.3"
+            }
+        },
+        "node_modules/mongodb-connection-string-url": {
+            "version": "2.5.2",
+            "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.2.tgz",
+            "integrity": "sha512-tWDyIG8cQlI5k3skB6ywaEA5F9f5OntrKKsT/Lteub2zgwSUlhqEN2inGgBTm8bpYJf8QYBdA/5naz65XDpczA==",
+            "dependencies": {
+                "@types/whatwg-url": "^8.2.1",
+                "whatwg-url": "^11.0.0"
+            }
+        },
+        "node_modules/punycode": {
+            "version": "2.1.1",
+            "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+            "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
+            "engines": {
+                "node": ">=6"
+            }
+        },
+        "node_modules/saslprep": {
+            "version": "1.0.3",
+            "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
+            "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
+            "optional": true,
+            "dependencies": {
+                "sparse-bitfield": "^3.0.3"
+            },
+            "engines": {
+                "node": ">=6"
+            }
+        },
+        "node_modules/smart-buffer": {
+            "version": "4.2.0",
+            "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
+            "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
+            "engines": {
+                "node": ">= 6.0.0",
+                "npm": ">= 3.0.0"
+            }
+        },
+        "node_modules/socks": {
+            "version": "2.6.2",
+            "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz",
+            "integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==",
+            "dependencies": {
+                "ip": "^1.1.5",
+                "smart-buffer": "^4.2.0"
+            },
+            "engines": {
+                "node": ">= 10.13.0",
+                "npm": ">= 3.0.0"
+            }
+        },
+        "node_modules/sparse-bitfield": {
+            "version": "3.0.3",
+            "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
+            "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
+            "optional": true,
+            "dependencies": {
+                "memory-pager": "^1.0.2"
+            }
+        },
+        "node_modules/tr46": {
+            "version": "3.0.0",
+            "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
+            "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
+            "dependencies": {
+                "punycode": "^2.1.1"
+            },
+            "engines": {
+                "node": ">=12"
+            }
+        },
+        "node_modules/webidl-conversions": {
+            "version": "7.0.0",
+            "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
+            "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
+            "engines": {
+                "node": ">=12"
+            }
+        },
+        "node_modules/whatwg-url": {
+            "version": "11.0.0",
+            "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
+            "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
+            "dependencies": {
+                "tr46": "^3.0.0",
+                "webidl-conversions": "^7.0.0"
+            },
+            "engines": {
+                "node": ">=12"
+            }
         }
-      ]
     },
-    "node_modules/bson": {
-      "version": "4.6.4",
-      "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.4.tgz",
-      "integrity": "sha512-TdQ3FzguAu5HKPPlr0kYQCyrYUYh8tFM+CMTpxjNzVzxeiJY00Rtuj3LXLHSgiGvmaWlZ8PE+4KyM2thqE38pQ==",
-      "dependencies": {
-        "buffer": "^5.6.0"
-      },
-      "engines": {
-        "node": ">=6.9.0"
-      }
-    },
-    "node_modules/buffer": {
-      "version": "5.7.1",
-      "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
-      "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
-      "funding": [
-        {
-          "type": "github",
-          "url": "https://github.com/sponsors/feross"
+    "dependencies": {
+        "@types/node": {
+            "version": "17.0.41",
+            "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.41.tgz",
+            "integrity": "sha512-xA6drNNeqb5YyV5fO3OAEsnXLfO7uF0whiOfPTz5AeDo8KeZFmODKnvwPymMNO8qE/an8pVY/O50tig2SQCrGw=="
         },
-        {
-          "type": "patreon",
-          "url": "https://www.patreon.com/feross"
+        "@types/webidl-conversions": {
+            "version": "6.1.1",
+            "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz",
+            "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q=="
         },
-        {
-          "type": "consulting",
-          "url": "https://feross.org/support"
+        "@types/whatwg-url": {
+            "version": "8.2.1",
+            "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.1.tgz",
+            "integrity": "sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==",
+            "requires": {
+                "@types/node": "*",
+                "@types/webidl-conversions": "*"
+            }
+        },
+        "base64-js": {
+            "version": "1.5.1",
+            "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+            "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
+        },
+        "bson": {
+            "version": "4.6.4",
+            "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.4.tgz",
+            "integrity": "sha512-TdQ3FzguAu5HKPPlr0kYQCyrYUYh8tFM+CMTpxjNzVzxeiJY00Rtuj3LXLHSgiGvmaWlZ8PE+4KyM2thqE38pQ==",
+            "requires": {
+                "buffer": "^5.6.0"
+            }
+        },
+        "buffer": {
+            "version": "5.7.1",
+            "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
+            "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
+            "requires": {
+                "base64-js": "^1.3.1",
+                "ieee754": "^1.1.13"
+            }
+        },
+        "denque": {
+            "version": "2.0.1",
+            "resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz",
+            "integrity": "sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ=="
+        },
+        "fs": {
+            "version": "0.0.1-security",
+            "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
+            "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
+        },
+        "ieee754": {
+            "version": "1.2.1",
+            "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+            "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
+        },
+        "ip": {
+            "version": "1.1.8",
+            "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz",
+            "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg=="
+        },
+        "memory-pager": {
+            "version": "1.5.0",
+            "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
+            "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
+            "optional": true
+        },
+        "mongodb": {
+            "version": "4.7.0",
+            "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.7.0.tgz",
+            "integrity": "sha512-HhVar6hsUeMAVlIbwQwWtV36iyjKd9qdhY+s4wcU8K6TOj4Q331iiMy+FoPuxEntDIijTYWivwFJkLv8q/ZgvA==",
+            "requires": {
+                "bson": "^4.6.3",
+                "denque": "^2.0.1",
+                "mongodb-connection-string-url": "^2.5.2",
+                "saslprep": "^1.0.3",
+                "socks": "^2.6.2"
+            }
+        },
+        "mongodb-connection-string-url": {
+            "version": "2.5.2",
+            "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.2.tgz",
+            "integrity": "sha512-tWDyIG8cQlI5k3skB6ywaEA5F9f5OntrKKsT/Lteub2zgwSUlhqEN2inGgBTm8bpYJf8QYBdA/5naz65XDpczA==",
+            "requires": {
+                "@types/whatwg-url": "^8.2.1",
+                "whatwg-url": "^11.0.0"
+            }
+        },
+        "punycode": {
+            "version": "2.1.1",
+            "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+            "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
+        },
+        "saslprep": {
+            "version": "1.0.3",
+            "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
+            "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
+            "optional": true,
+            "requires": {
+                "sparse-bitfield": "^3.0.3"
+            }
+        },
+        "smart-buffer": {
+            "version": "4.2.0",
+            "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
+            "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="
+        },
+        "socks": {
+            "version": "2.6.2",
+            "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz",
+            "integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==",
+            "requires": {
+                "ip": "^1.1.5",
+                "smart-buffer": "^4.2.0"
+            }
+        },
+        "sparse-bitfield": {
+            "version": "3.0.3",
+            "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
+            "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
+            "optional": true,
+            "requires": {
+                "memory-pager": "^1.0.2"
+            }
+        },
+        "tr46": {
+            "version": "3.0.0",
+            "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
+            "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
+            "requires": {
+                "punycode": "^2.1.1"
+            }
+        },
+        "webidl-conversions": {
+            "version": "7.0.0",
+            "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
+            "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="
+        },
+        "whatwg-url": {
+            "version": "11.0.0",
+            "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
+            "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
+            "requires": {
+                "tr46": "^3.0.0",
+                "webidl-conversions": "^7.0.0"
+            }
         }
-      ],
-      "dependencies": {
-        "base64-js": "^1.3.1",
-        "ieee754": "^1.1.13"
-      }
-    },
-    "node_modules/denque": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz",
-      "integrity": "sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ==",
-      "engines": {
-        "node": ">=0.10"
-      }
-    },
-    "node_modules/fs": {
-      "version": "0.0.1-security",
-      "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
-      "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
-    },
-    "node_modules/ieee754": {
-      "version": "1.2.1",
-      "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
-      "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
-      "funding": [
-        {
-          "type": "github",
-          "url": "https://github.com/sponsors/feross"
-        },
-        {
-          "type": "patreon",
-          "url": "https://www.patreon.com/feross"
-        },
-        {
-          "type": "consulting",
-          "url": "https://feross.org/support"
-        }
-      ]
-    },
-    "node_modules/ip": {
-      "version": "1.1.8",
-      "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz",
-      "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg=="
-    },
-    "node_modules/memory-pager": {
-      "version": "1.5.0",
-      "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
-      "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
-      "optional": true
-    },
-    "node_modules/mongodb": {
-      "version": "4.7.0",
-      "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.7.0.tgz",
-      "integrity": "sha512-HhVar6hsUeMAVlIbwQwWtV36iyjKd9qdhY+s4wcU8K6TOj4Q331iiMy+FoPuxEntDIijTYWivwFJkLv8q/ZgvA==",
-      "dependencies": {
-        "bson": "^4.6.3",
-        "denque": "^2.0.1",
-        "mongodb-connection-string-url": "^2.5.2",
-        "socks": "^2.6.2"
-      },
-      "engines": {
-        "node": ">=12.9.0"
-      },
-      "optionalDependencies": {
-        "saslprep": "^1.0.3"
-      }
-    },
-    "node_modules/mongodb-connection-string-url": {
-      "version": "2.5.2",
-      "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.2.tgz",
-      "integrity": "sha512-tWDyIG8cQlI5k3skB6ywaEA5F9f5OntrKKsT/Lteub2zgwSUlhqEN2inGgBTm8bpYJf8QYBdA/5naz65XDpczA==",
-      "dependencies": {
-        "@types/whatwg-url": "^8.2.1",
-        "whatwg-url": "^11.0.0"
-      }
-    },
-    "node_modules/punycode": {
-      "version": "2.1.1",
-      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
-      "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
-      "engines": {
-        "node": ">=6"
-      }
-    },
-    "node_modules/saslprep": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
-      "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
-      "optional": true,
-      "dependencies": {
-        "sparse-bitfield": "^3.0.3"
-      },
-      "engines": {
-        "node": ">=6"
-      }
-    },
-    "node_modules/smart-buffer": {
-      "version": "4.2.0",
-      "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
-      "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
-      "engines": {
-        "node": ">= 6.0.0",
-        "npm": ">= 3.0.0"
-      }
-    },
-    "node_modules/socks": {
-      "version": "2.6.2",
-      "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz",
-      "integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==",
-      "dependencies": {
-        "ip": "^1.1.5",
-        "smart-buffer": "^4.2.0"
-      },
-      "engines": {
-        "node": ">= 10.13.0",
-        "npm": ">= 3.0.0"
-      }
-    },
-    "node_modules/sparse-bitfield": {
-      "version": "3.0.3",
-      "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
-      "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
-      "optional": true,
-      "dependencies": {
-        "memory-pager": "^1.0.2"
-      }
-    },
-    "node_modules/tr46": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
-      "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
-      "dependencies": {
-        "punycode": "^2.1.1"
-      },
-      "engines": {
-        "node": ">=12"
-      }
-    },
-    "node_modules/webidl-conversions": {
-      "version": "7.0.0",
-      "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
-      "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
-      "engines": {
-        "node": ">=12"
-      }
-    },
-    "node_modules/whatwg-url": {
-      "version": "11.0.0",
-      "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
-      "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
-      "dependencies": {
-        "tr46": "^3.0.0",
-        "webidl-conversions": "^7.0.0"
-      },
-      "engines": {
-        "node": ">=12"
-      }
     }
-  },
-  "dependencies": {
-    "@types/node": {
-      "version": "17.0.41",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.41.tgz",
-      "integrity": "sha512-xA6drNNeqb5YyV5fO3OAEsnXLfO7uF0whiOfPTz5AeDo8KeZFmODKnvwPymMNO8qE/an8pVY/O50tig2SQCrGw=="
-    },
-    "@types/webidl-conversions": {
-      "version": "6.1.1",
-      "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz",
-      "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q=="
-    },
-    "@types/whatwg-url": {
-      "version": "8.2.1",
-      "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.1.tgz",
-      "integrity": "sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==",
-      "requires": {
-        "@types/node": "*",
-        "@types/webidl-conversions": "*"
-      }
-    },
-    "base64-js": {
-      "version": "1.5.1",
-      "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
-      "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
-    },
-    "bson": {
-      "version": "4.6.4",
-      "resolved": "https://registry.npmjs.org/bson/-/bson-4.6.4.tgz",
-      "integrity": "sha512-TdQ3FzguAu5HKPPlr0kYQCyrYUYh8tFM+CMTpxjNzVzxeiJY00Rtuj3LXLHSgiGvmaWlZ8PE+4KyM2thqE38pQ==",
-      "requires": {
-        "buffer": "^5.6.0"
-      }
-    },
-    "buffer": {
-      "version": "5.7.1",
-      "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
-      "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
-      "requires": {
-        "base64-js": "^1.3.1",
-        "ieee754": "^1.1.13"
-      }
-    },
-    "denque": {
-      "version": "2.0.1",
-      "resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz",
-      "integrity": "sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ=="
-    },
-    "fs": {
-      "version": "0.0.1-security",
-      "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
-      "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
-    },
-    "ieee754": {
-      "version": "1.2.1",
-      "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
-      "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
-    },
-    "ip": {
-      "version": "1.1.8",
-      "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz",
-      "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg=="
-    },
-    "memory-pager": {
-      "version": "1.5.0",
-      "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
-      "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
-      "optional": true
-    },
-    "mongodb": {
-      "version": "4.7.0",
-      "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.7.0.tgz",
-      "integrity": "sha512-HhVar6hsUeMAVlIbwQwWtV36iyjKd9qdhY+s4wcU8K6TOj4Q331iiMy+FoPuxEntDIijTYWivwFJkLv8q/ZgvA==",
-      "requires": {
-        "bson": "^4.6.3",
-        "denque": "^2.0.1",
-        "mongodb-connection-string-url": "^2.5.2",
-        "saslprep": "^1.0.3",
-        "socks": "^2.6.2"
-      }
-    },
-    "mongodb-connection-string-url": {
-      "version": "2.5.2",
-      "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.2.tgz",
-      "integrity": "sha512-tWDyIG8cQlI5k3skB6ywaEA5F9f5OntrKKsT/Lteub2zgwSUlhqEN2inGgBTm8bpYJf8QYBdA/5naz65XDpczA==",
-      "requires": {
-        "@types/whatwg-url": "^8.2.1",
-        "whatwg-url": "^11.0.0"
-      }
-    },
-    "punycode": {
-      "version": "2.1.1",
-      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
-      "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
-    },
-    "saslprep": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
-      "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
-      "optional": true,
-      "requires": {
-        "sparse-bitfield": "^3.0.3"
-      }
-    },
-    "smart-buffer": {
-      "version": "4.2.0",
-      "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
-      "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="
-    },
-    "socks": {
-      "version": "2.6.2",
-      "resolved": "https://registry.npmjs.org/socks/-/socks-2.6.2.tgz",
-      "integrity": "sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA==",
-      "requires": {
-        "ip": "^1.1.5",
-        "smart-buffer": "^4.2.0"
-      }
-    },
-    "sparse-bitfield": {
-      "version": "3.0.3",
-      "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
-      "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
-      "optional": true,
-      "requires": {
-        "memory-pager": "^1.0.2"
-      }
-    },
-    "tr46": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
-      "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
-      "requires": {
-        "punycode": "^2.1.1"
-      }
-    },
-    "webidl-conversions": {
-      "version": "7.0.0",
-      "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
-      "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="
-    },
-    "whatwg-url": {
-      "version": "11.0.0",
-      "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
-      "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
-      "requires": {
-        "tr46": "^3.0.0",
-        "webidl-conversions": "^7.0.0"
-      }
-    }
-  }
 }
diff --git a/ClicksMigratingProblems/package.json b/ClicksMigratingProblems/package.json
index a4a5ec5..d46e423 100644
--- a/ClicksMigratingProblems/package.json
+++ b/ClicksMigratingProblems/package.json
@@ -1,16 +1,16 @@
 {
-  "name": "hi",
-  "version": "1.0.0",
-  "description": "",
-  "main": "index.js",
-  "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1"
-  },
-  "author": "",
-  "license": "ISC",
-  "dependencies": {
-    "fs": "^0.0.1-security",
-    "mongodb": "^4.7.0"
-  },
-  "type": "module"
+    "name": "hi",
+    "version": "1.0.0",
+    "description": "",
+    "main": "index.js",
+    "scripts": {
+        "test": "echo \"Error: no test specified\" && exit 1"
+    },
+    "author": "",
+    "license": "ISC",
+    "dependencies": {
+        "fs": "^0.0.1-security",
+        "mongodb": "^4.7.0"
+    },
+    "type": "module"
 }
diff --git a/ClicksMigratingProblems/randomPunishments.js b/ClicksMigratingProblems/randomPunishments.js
index c9162e3..4ea01d2 100644
--- a/ClicksMigratingProblems/randomPunishments.js
+++ b/ClicksMigratingProblems/randomPunishments.js
@@ -7,20 +7,53 @@
 
 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)) ? "438733159748599813" : 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
+        moderator: [
+            "unban",
+            "ban",
+            "softban",
+            "kick",
+            "mute",
+            "purge",
+            "warn"
+        ].includes(type)
+            ? "438733159748599813"
+            : 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
     });
     console.log("Inserted document " + i);
 }
diff --git a/Installer.js b/Installer.js
index 7997bba..0a93596 100644
--- a/Installer.js
+++ b/Installer.js
@@ -6,4 +6,4 @@
 }
 
 await format(true);
-process.exit(0);
\ No newline at end of file
+process.exit(0);
diff --git a/README.md b/README.md
index 3505970..44513c7 100644
--- a/README.md
+++ b/README.md
@@ -2,11 +2,11 @@
 
 ### Sections
 
-- [About](#about)
-- [Commands](#commands)
-- [Verification](#verification)
-- [Privacy](#privacy)
-- [Self hosting and Legal](#self-hosting)
+-   [About](#about)
+-   [Commands](#commands)
+-   [Verification](#verification)
+-   [Privacy](#privacy)
+-   [Self hosting and Legal](#self-hosting)
 
 ### About
 
@@ -14,50 +14,49 @@
 
 ### Commands
 
-- `/help` Shows all commands and info.
-- `/settings` Shows all settings and info.
+-   `/help` Shows all commands and info.
+-   `/settings` Shows all settings and info.
 
-- `/mod info` Shows info about a user. This includes moderator notes and moderation history.
-- `/mod warn` Warns a member.
-- `/mod kick` Kicks a member.
-- `/mod softban` Soft bans a member.
-- `/mod ban` Bans a member.
-- `/mod unban` Unbans a member.
-- `/mod purge` Deletes messages in the channel.
-- `/mod mute` Mutes a member.
-- `/mod unmute` Unmutes a member.
-- `/mod nick` Changes the nickname of a member.
-- `/mod slowmode` Edits the slowmode in a channel.
-- `/mod viewas` Allows you to view the server as a member.
+-   `/mod info` Shows info about a user. This includes moderator notes and moderation history.
+-   `/mod warn` Warns a member.
+-   `/mod kick` Kicks a member.
+-   `/mod softban` Soft bans a member.
+-   `/mod ban` Bans a member.
+-   `/mod unban` Unbans a member.
+-   `/mod purge` Deletes messages in the channel.
+-   `/mod mute` Mutes a member.
+-   `/mod unmute` Unmutes a member.
+-   `/mod nick` Changes the nickname of a member.
+-   `/mod slowmode` Edits the slowmode in a channel.
+-   `/mod viewas` Allows you to view the server as a member.
 
-- `/nucleus guide` Shows the setup guide and tips for setup.
-- `/nucleus invite` Shows the invite link for Nucleus.
-- `/nucleus ping` Shows the latency of the bot.
-- `/nucleus premium` Shows information about Nucleus Premium.
-- `/nucleus stats` Shows the stats of the bot.
-- `/nucleus suggest` Sends a feature request to the developers.
+-   `/nucleus guide` Shows the setup guide and tips for setup.
+-   `/nucleus invite` Shows the invite link for Nucleus.
+-   `/nucleus ping` Shows the latency of the bot.
+-   `/nucleus premium` Shows information about Nucleus Premium.
+-   `/nucleus stats` Shows the stats of the bot.
+-   `/nucleus suggest` Sends a feature request to the developers.
 
-- `/role user` Gives a user a role.
+-   `/role user` Gives a user a role.
 
-- `/server about` Shows the server information.
+-   `/server about` Shows the server information.
 
-- `/ticket create` Creates a ticket.
-- `/ticket close` Closes a ticket.
+-   `/ticket create` Creates a ticket.
+-   `/ticket close` Closes a ticket.
 
-- `/user about` Shows the user information.
-- `/user avatar` Shows the user avatar.
-- `/user track` Allows you to move a user up and down a role track.
+-   `/user about` Shows the user information.
+-   `/user avatar` Shows the user avatar.
+-   `/user track` Allows you to move a user up and down a role track.
 
-- `/tags create` Creates a tag.
-- `/tags edit` Edits a tag.
-- `/tags delete` Deletes a tag.
+-   `/tags create` Creates a tag.
+-   `/tags edit` Edits a tag.
+-   `/tags delete` Deletes a tag.
 
-- `/verify` Verifies a member to give them access to the server.
-- `/help` Shows all commands on Nucleus.
-- `/privacy` Information and options for server and user privacy.
-- `/rolemenu` Lets users select roles, similar to reaction roles.
-- `/tag` Lets users use tags created with `/tags create`.
-
+-   `/verify` Verifies a member to give them access to the server.
+-   `/help` Shows all commands on Nucleus.
+-   `/privacy` Information and options for server and user privacy.
+-   `/rolemenu` Lets users select roles, similar to reaction roles.
+-   `/tag` Lets users use tags created with `/tags create`.
 
 ### Verification
 
diff --git a/SELF_HOSTING.md b/SELF_HOSTING.md
index 86f267c..ae05a90 100644
--- a/SELF_HOSTING.md
+++ b/SELF_HOSTING.md
@@ -1,26 +1,25 @@
 # Nucleus by Clicks
 
-
 ## Contents:
 
-- [In short](in-short)
-- [How to](how-to)
-- [The legal bit](the-legal-bit)
-
+-   [In short](in-short)
+-   [How to](how-to)
+-   [The legal bit](the-legal-bit)
 
 ## In Short:
 
 You **may**:
-- Modify our code
-- Run our code for commercial and personal use
-- Distribute our code
+
+-   Modify our code
+-   Run our code for commercial and personal use
+-   Distribute our code
 
 However, you **must**:
-- Make your project open source
-- List all changes you made
-- Mention the code is originally by Clicks, and include a link to our [website](https://clicks.codes) or [GitHub](https://github.com/clicksminuteper)
-- Release your project with the same license [GNU Affero General Public License V3.0](https://choosealicense.com/licenses/agpl-3.0/)
 
+-   Make your project open source
+-   List all changes you made
+-   Mention the code is originally by Clicks, and include a link to our [website](https://clicks.codes) or [GitHub](https://github.com/clicksminuteper)
+-   Release your project with the same license [GNU Affero General Public License V3.0](https://choosealicense.com/licenses/agpl-3.0/)
 
 ## How to:
 
@@ -46,7 +45,6 @@
 }
 ```
 
-
 ## The legal bit:
 
 ```
diff --git a/TODO.json b/TODO.json
index 802aee6..6f0b94e 100644
--- a/TODO.json
+++ b/TODO.json
@@ -1,28 +1,27 @@
-
 {
-	"filters": {
-		"images": {
-			"NSFW": false,
-			"size": false
-		},
-		"malware": false,
-		"wordFilter": {
-			"enabled": true,
-			"words": {
-				"strict": [],
-				"loose": []
-			}
-		},
-		"invite": {
-			"enabled": false,
-			"channels": []
-		},
-		"pings": {
-			"mass": 5,
-			"everyone": true,
-			"roles": true
-		}
-	},
-	"roleMenu": [],
-	"tracks": []
-}
\ No newline at end of file
+    "filters": {
+        "images": {
+            "NSFW": false,
+            "size": false
+        },
+        "malware": false,
+        "wordFilter": {
+            "enabled": true,
+            "words": {
+                "strict": [],
+                "loose": []
+            }
+        },
+        "invite": {
+            "enabled": false,
+            "channels": []
+        },
+        "pings": {
+            "mass": 5,
+            "everyone": true,
+            "roles": true
+        }
+    },
+    "roleMenu": [],
+    "tracks": []
+}
diff --git a/src/Unfinished/all.ts b/src/Unfinished/all.ts
index 51be5cb..453a467 100644
--- a/src/Unfinished/all.ts
+++ b/src/Unfinished/all.ts
@@ -1,5 +1,11 @@
 import { LoadingEmbed } from "./../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, GuildMember, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
+import Discord, {
+    CommandInteraction,
+    GuildMember,
+    MessageActionRow,
+    MessageButton,
+    MessageSelectMenu
+} from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import { WrappedCheck } from "jshaiku";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
@@ -17,13 +23,23 @@
     data: object;
     checkFunction: (member) => boolean;
     inverted = false;
-    constructor(name: (data) => string | string, data: object, check: (member) => boolean) {
-        if (typeof name === "function") { this.name = name(data);
-        } else { this.name = name; }
+    constructor(
+        name: (data) => string | string,
+        data: object,
+        check: (member) => boolean
+    ) {
+        if (typeof name === "function") {
+            this.name = name(data);
+        } else {
+            this.name = name;
+        }
         this.data = data;
         this.checkFunction = check;
     }
-    flip() { this.inverted = true; return this; }
+    flip() {
+        this.inverted = true;
+        return this;
+    }
     check(member) {
         if (this.inverted) return !this.checkFunction(member);
         else return this.checkFunction(member);
@@ -35,51 +51,130 @@
         render: "Member",
         has: {
             render: "has",
-            role: (role) => ( new Filter((data) => `Member has role <@&${data.role}>`, {role: role, type: Discord.Role, render: "role"}, (member) => { return member.roles.cache.has(role);}))
+            role: (role) =>
+                new Filter(
+                    (data) => `Member has role <@&${data.role}>`,
+                    { role: role, type: Discord.Role, render: "role" },
+                    (member) => {
+                        return member.roles.cache.has(role);
+                    }
+                )
         },
         joined: {
             render: "joined",
-            before: (date) => ( new Filter((_data) => `Joined server before <t:${Math.round(date.getTime() / 1000)}:D>`, {date: date, type: Date, render: "before"}, (member) => {
-                return member.joinedTimestamp < date.getTime();
-            }))
+            before: (date) =>
+                new Filter(
+                    (_data) =>
+                        `Joined server before <t:${Math.round(
+                            date.getTime() / 1000
+                        )}:D>`,
+                    { date: date, type: Date, render: "before" },
+                    (member) => {
+                        return member.joinedTimestamp < date.getTime();
+                    }
+                )
         },
         nickname: {
             render: "Nickname",
-            set: () => ( new Filter((_data) => "Member has a nickname set\"", {render: "set"}, (member) => { return member.nickname !== null;})),
-            includes: (name) => ( new Filter((_data) => `Nickname includes "${name}"`, {nickname: name, type: String, render: "includes"}, (member) => {
-                return member.displayName.includes(name);})),
-            startsWith: (name) => ( new Filter((_data) => `Nickname starts with "${name}"`, {nickname: name, type: String, render: "starts with"}, (member) => {
-                return member.displayName.startsWith(name);})),
-            endsWith: (name) => ( new Filter((_data) => `Nickname ends with "${name}"`, {nickname: name, type: String, render: "ends with"}, (member) => {
-                return member.displayName.endsWith(name);}))
+            set: () =>
+                new Filter(
+                    (_data) => 'Member has a nickname set"',
+                    { render: "set" },
+                    (member) => {
+                        return member.nickname !== null;
+                    }
+                ),
+            includes: (name) =>
+                new Filter(
+                    (_data) => `Nickname includes "${name}"`,
+                    { nickname: name, type: String, render: "includes" },
+                    (member) => {
+                        return member.displayName.includes(name);
+                    }
+                ),
+            startsWith: (name) =>
+                new Filter(
+                    (_data) => `Nickname starts with "${name}"`,
+                    { nickname: name, type: String, render: "starts with" },
+                    (member) => {
+                        return member.displayName.startsWith(name);
+                    }
+                ),
+            endsWith: (name) =>
+                new Filter(
+                    (_data) => `Nickname ends with "${name}"`,
+                    { nickname: name, type: String, render: "ends with" },
+                    (member) => {
+                        return member.displayName.endsWith(name);
+                    }
+                )
         }
     },
     account: {
         render: "Account",
         created: {
             render: "created",
-            before: (date) => ( new Filter((_data) => `Account created before <t:${Math.round(date.getTime() / 1000)}:D>`, {date: date, type: Date, render: "before"}, (member) => {
-                return member.user.createdTimestamp < date.getTime();
-            }))
+            before: (date) =>
+                new Filter(
+                    (_data) =>
+                        `Account created before <t:${Math.round(
+                            date.getTime() / 1000
+                        )}:D>`,
+                    { date: date, type: Date, render: "before" },
+                    (member) => {
+                        return member.user.createdTimestamp < date.getTime();
+                    }
+                )
         },
         is: {
             render: "is",
-            human: () => ( new Filter((_data) => "Member is a human", {human: true, render: "human"}, (member) => { return !member.bot; }))
+            human: () =>
+                new Filter(
+                    (_data) => "Member is a human",
+                    { human: true, render: "human" },
+                    (member) => {
+                        return !member.bot;
+                    }
+                )
         },
         username: {
             render: "Username",
-            includes: (name) => ( new Filter((_data) => `Nickname includes "${name}"`, {nickname: name, type: String, render: "includes"}, (member) => {
-                return member.user.name.includes(name);})),
-            startsWith: (name) => ( new Filter((_data) => `Nickname starts with "${name}"`, {nickname: name, type: String, render: "starts with"}, (member) => {
-                return member.user.name.startsWith(name);})),
-            endsWith: (name) => ( new Filter((_data) => `Nickname ends with "${name}"`, {nickname: name, type: String, render: "ends with"}, (member) => {
-                return member.user.name.endsWith(name);}))
+            includes: (name) =>
+                new Filter(
+                    (_data) => `Nickname includes "${name}"`,
+                    { nickname: name, type: String, render: "includes" },
+                    (member) => {
+                        return member.user.name.includes(name);
+                    }
+                ),
+            startsWith: (name) =>
+                new Filter(
+                    (_data) => `Nickname starts with "${name}"`,
+                    { nickname: name, type: String, render: "starts with" },
+                    (member) => {
+                        return member.user.name.startsWith(name);
+                    }
+                ),
+            endsWith: (name) =>
+                new Filter(
+                    (_data) => `Nickname ends with "${name}"`,
+                    { nickname: name, type: String, render: "ends with" },
+                    (member) => {
+                        return member.user.name.endsWith(name);
+                    }
+                )
         }
     }
 };
 
-const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
-    await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
+const callback = async (
+    interaction: CommandInteraction
+): Promise<void | unknown> => {
+    await interaction.reply({
+        embeds: LoadingEmbed,
+        ephemeral: true,
+        fetchReply: true
+    });
     const filters: Filter[] = [
         filterList.member.has.role("959901346000154674"),
         filterList.member.nickname.startsWith("Pinea"),
@@ -91,65 +186,122 @@
         const affected = [];
         const members = interaction.guild.members.cache;
         if (all) {
-            members.forEach(member => {
+            members.forEach((member) => {
                 let applies = true;
-                filters.forEach(filter => { if (!filter.check(member)) { applies = false; } });
-                if (applies) { affected.push(member); }
+                filters.forEach((filter) => {
+                    if (!filter.check(member)) {
+                        applies = false;
+                    }
+                });
+                if (applies) {
+                    affected.push(member);
+                }
             });
         } else {
-            members.forEach(member => {
+            members.forEach((member) => {
                 let applies = false;
-                filters.forEach(filter => { if (filter.check(member)) { applies = true; } });
-                if (applies) { affected.push(member); }
+                filters.forEach((filter) => {
+                    if (filter.check(member)) {
+                        applies = true;
+                    }
+                });
+                if (applies) {
+                    affected.push(member);
+                }
             });
         }
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Role all")
-            .setDescription((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** ")) +
-                        (f.inverted ? "**not** " : "") + `${f.name}`;
-                }).join("\n") + "\n\n" + `This will affect ${addPlural(affected.length, "member")}`)
-            .setEmoji("GUILD.ROLES.CREATE")
-            .setStatus("Success")
-        ], components: [
-            new MessageActionRow().addComponents([new MessageSelectMenu().setOptions(filters.map((f, index) => ({
-                label: (f.inverted ? "(Not) " : "") + f.name,
-                value: index.toString()
-            }))).setMinValues(1).setMaxValues(filters.length).setCustomId("select").setPlaceholder("Remove a filter")]),
-            new MessageActionRow().addComponents([
-                new MessageButton()
-                    .setLabel("Apply")
-                    .setStyle("PRIMARY")
-                    .setCustomId("apply")
-                    .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")))
-                    .setDisabled(filters.length >= 25)
-            ])
-        ]});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Role all")
+                    .setDescription(
+                        (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** ") +
+                                        (f.inverted ? "**not** " : "") +
+                                        `${f.name}`
+                                    );
+                                })
+                                .join("\n") +
+                            "\n\n" +
+                            `This will affect ${addPlural(
+                                affected.length,
+                                "member"
+                            )}`
+                    )
+                    .setEmoji("GUILD.ROLES.CREATE")
+                    .setStatus("Success")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageSelectMenu()
+                        .setOptions(
+                            filters.map((f, index) => ({
+                                label: (f.inverted ? "(Not) " : "") + f.name,
+                                value: index.toString()
+                            }))
+                        )
+                        .setMinValues(1)
+                        .setMaxValues(filters.length)
+                        .setCustomId("select")
+                        .setPlaceholder("Remove a filter")
+                ]),
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setLabel("Apply")
+                        .setStyle("PRIMARY")
+                        .setCustomId("apply")
+                        .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")
+                            )
+                        )
+                        .setDisabled(filters.length >= 25)
+                ])
+            ]
+        });
         break;
     }
     return;
 };
 
-const check = async (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
-    const member = (interaction.member as GuildMember);
-    const me = (interaction.guild.me as GuildMember);
-    if (!me.permissions.has("MANAGE_ROLES")) throw "I do not have the *Manage Roles* permission";
+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";
     // 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;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/Unfinished/categorisationTest.ts b/src/Unfinished/categorisationTest.ts
index 4ba582d..e4346d6 100644
--- a/src/Unfinished/categorisationTest.ts
+++ b/src/Unfinished/categorisationTest.ts
@@ -1,5 +1,11 @@
 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";
 import { WrappedCheck } from "jshaiku";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
@@ -11,10 +17,14 @@
     .setName("categorise")
     .setDescription("Categorises your servers channels");
 
-const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
-    const channels = interaction.guild.channels.cache.filter(c => c.type !== "GUILD_CATEGORY");
+const callback = async (
+    interaction: CommandInteraction
+): Promise<void | unknown> => {
+    const channels = interaction.guild.channels.cache.filter(
+        (c) => c.type !== "GUILD_CATEGORY"
+    );
     const categorised = {};
-    await interaction.reply({embeds: LoadingEmbed, ephemeral: true});
+    await interaction.reply({ embeds: LoadingEmbed, ephemeral: true });
     const predicted = {};
     const types = {
         general: ["general", "muted", "main", "topic", "discuss"],
@@ -41,58 +51,110 @@
     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] = [];
-        m = await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Categorise")
-            .setDescription(`Select all types that apply to <#${channel}>.\n\n` +
-            `${addPlural(predicted[channel].length, "Suggestion")}: ${predicted[channel].join(", ")}`)
-            .setEmoji("CHANNEL.CATEGORY.CREATE")
-            .setStatus("Success")
-        ], components: [
-            new MessageActionRow().addComponents([new MessageSelectMenu()
-                .setCustomId("selected")
-                .setMaxValues(Object.keys(types).length)
-                .setMinValues(1)
-                .setPlaceholder("Select all types that apply to this channel")
-                .setOptions(Object.keys(types).map(type => ({label: type, value: type})))
-            ]),
-            new MessageActionRow().addComponents([
-                new MessageButton().setLabel("Accept Suggestion").setCustomId("accept").setStyle("SUCCESS").setDisabled(predicted[channel].length === 0)
-                    .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")))
-            ])
-        ]});
+        m = await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Categorise")
+                    .setDescription(
+                        `Select all types that apply to <#${channel}>.\n\n` +
+                            `${addPlural(
+                                predicted[channel].length,
+                                "Suggestion"
+                            )}: ${predicted[channel].join(", ")}`
+                    )
+                    .setEmoji("CHANNEL.CATEGORY.CREATE")
+                    .setStatus("Success")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageSelectMenu()
+                        .setCustomId("selected")
+                        .setMaxValues(Object.keys(types).length)
+                        .setMinValues(1)
+                        .setPlaceholder(
+                            "Select all types that apply to this channel"
+                        )
+                        .setOptions(
+                            Object.keys(types).map((type) => ({
+                                label: type,
+                                value: type
+                            }))
+                        )
+                ]),
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setLabel("Accept Suggestion")
+                        .setCustomId("accept")
+                        .setStyle("SUCCESS")
+                        .setDisabled(predicted[channel].length === 0)
+                        .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")
+                            )
+                        )
+                ])
+            ]
+        });
         let i;
         try {
             i = await m.awaitMessageComponent({ time: 300000 });
         } catch (e) {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Categorise")
-                .setEmoji("CHANNEL.CATEGORY.DELETE")
-                .setStatus("Danger")
-                .setDescription(`Select all types that apply to <#${channel}>.\n\n` +
-                `${addPlural(predicted[channel].length, "Suggestion")}: ${predicted[channel].join(", ")}`)
-                .setFooter({text: "Message timed out"})
-            ]});
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Categorise")
+                        .setEmoji("CHANNEL.CATEGORY.DELETE")
+                        .setStatus("Danger")
+                        .setDescription(
+                            `Select all types that apply to <#${channel}>.\n\n` +
+                                `${addPlural(
+                                    predicted[channel].length,
+                                    "Suggestion"
+                                )}: ${predicted[channel].join(", ")}`
+                        )
+                        .setFooter({ text: "Message timed out" })
+                ]
+            });
         }
         i.deferUpdate();
         let selected;
-        if (i.customId === "select") { selected = i.values; }
-        if (i.customId === "accept") { selected = predicted[channel]; }
-        if (i.customId === "reject") { selected = ["other"]; }
+        if (i.customId === "select") {
+            selected = i.values;
+        }
+        if (i.customId === "accept") {
+            selected = predicted[channel];
+        }
+        if (i.customId === "reject") {
+            selected = ["other"];
+        }
         categorised[channel] = selected;
     }
     console.log(categorised);
 };
 
-const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
+const check = (
+    _interaction: CommandInteraction,
+    _defaultCheck: WrappedCheck
+) => {
     return true;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/actions/createModActionTicket.ts b/src/actions/createModActionTicket.ts
index 1d3406d..41f949c 100644
--- a/src/actions/createModActionTicket.ts
+++ b/src/actions/createModActionTicket.ts
@@ -3,14 +3,35 @@
 import getEmojiByName from "../utils/getEmojiByName.js";
 import client from "../utils/client.js";
 
-export async function create(guild: Discord.Guild, member: Discord.User, createdBy: Discord.User, reason: string, customReason?: string) {
+export async function create(
+    guild: Discord.Guild,
+    member: Discord.User,
+    createdBy: Discord.User,
+    reason: string,
+    customReason?: string
+) {
     const config = await client.database.guilds.read(guild.id);
-    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"],
-        type: "member"
-    }] as Discord.OverwriteResolvable[];
+    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"
+            ],
+            type: "member"
+        }
+    ] as Discord.OverwriteResolvable[];
     overwrites.push({
         id: guild.roles.everyone,
         deny: ["VIEW_CHANNEL"],
@@ -19,7 +40,13 @@
     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"
         });
     }
@@ -31,40 +58,59 @@
             topic: `${member.id} Active`,
             parent: config.tickets.category,
             nsfw: false,
-            permissionOverwrites: (overwrites as Discord.OverwriteResolvable[]),
+            permissionOverwrites: overwrites as Discord.OverwriteResolvable[],
             reason: "Creating ticket"
         });
     } catch (e) {
         return null;
     }
     try {
-        await c.send(
-            {
-                content: (`<@${member.id}>` + (config.tickets.supportRole !== null ? ` • <@&${config.tickets.supportRole}>` : "")),
-                allowedMentions: {
-                    users: [member.id],
-                    roles: (config.tickets.supportRole !== null ? [config.tickets.supportRole] : [])
-                }
+        await c.send({
+            content:
+                `<@${member.id}>` +
+                (config.tickets.supportRole !== null
+                    ? ` • <@&${config.tickets.supportRole}>`
+                    : ""),
+            allowedMentions: {
+                users: [member.id],
+                roles:
+                    config.tickets.supportRole !== null
+                        ? [config.tickets.supportRole]
+                        : []
             }
-        );
-        await c.send({ embeds: [new EmojiEmbed()
-            .setTitle("New Ticket")
-            .setDescription(
-                "Ticket created by a Moderator\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."
-            )
-            .setStatus("Success")
-            .setEmoji("GUILD.TICKET.OPEN")
-        ], components: [new MessageActionRow().addComponents([new MessageButton()
-            .setLabel("Close")
-            .setStyle("DANGER")
-            .setCustomId("closeticket")
-            .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-        ])]});
+        });
+        await c.send({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("New Ticket")
+                    .setDescription(
+                        "Ticket created by a Moderator\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."
+                    )
+                    .setStatus("Success")
+                    .setEmoji("GUILD.TICKET.OPEN")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setLabel("Close")
+                        .setStyle("DANGER")
+                        .setCustomId("closeticket")
+                        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                ])
+            ]
+        });
         const data = {
-            meta:{
+            meta: {
                 type: "ticketCreate",
                 displayName: "Ticket Created",
                 calculateType: "ticketUpdate",
@@ -75,7 +121,10 @@
             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: {
@@ -83,11 +132,14 @@
             }
         };
         log(data);
-    } catch (e) { console.log(e); return null; }
+    } catch (e) {
+        console.log(e);
+        return null;
+    }
     return c.id;
 }
 
 export async function areTicketsEnabled(guild: string) {
     const config = await client.database.guilds.read(guild);
     return config.tickets.enabled;
-}
\ No newline at end of file
+}
diff --git a/src/actions/roleMenu.ts b/src/actions/roleMenu.ts
index 9a8e80a..dc224e8 100644
--- a/src/actions/roleMenu.ts
+++ b/src/actions/roleMenu.ts
@@ -7,30 +7,47 @@
 
 export async function callback(interaction) {
     const config = await client.database.guilds.read(interaction.guild.id);
-    if (!config.roleMenu.enabled) return await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Roles")
-        .setDescription("Self roles are currently disabled. Please contact a staff member or try again later.")
-        .setStatus("Danger")
-        .setEmoji("CONTROL.BLOCKCROSS")
-    ], ephemeral: true});
-    if (config.roleMenu.options.length === 0) return await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Roles")
-        .setDescription("There are no roles available. Please contact a staff member or try again later.")
-        .setStatus("Danger")
-        .setEmoji("CONTROL.BLOCKCROSS")
-    ], ephemeral: true});
-    await interaction.reply({embeds: LoadingEmbed, ephemeral: true});
+    if (!config.roleMenu.enabled)
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Roles")
+                    .setDescription(
+                        "Self roles are currently disabled. Please contact a staff member or try again later."
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("CONTROL.BLOCKCROSS")
+            ],
+            ephemeral: true
+        });
+    if (config.roleMenu.options.length === 0)
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Roles")
+                    .setDescription(
+                        "There are no roles available. Please contact a staff member or try again later."
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("CONTROL.BLOCKCROSS")
+            ],
+            ephemeral: true
+        });
+    await interaction.reply({ embeds: LoadingEmbed, ephemeral: true });
     let m;
     if (config.roleMenu.allowWebUI) {
         let code = "";
         let length = 5;
         let itt = 0;
-        const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+        const chars =
+            "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
         let valid = false;
         while (!valid) {
             itt += 1;
             code = "";
-            for (let i = 0; i < length; i++) { code += chars.charAt(Math.floor(Math.random() * chars.length)); }
+            for (let i = 0; i < length; i++) {
+                code += chars.charAt(Math.floor(Math.random() * chars.length));
+            }
             if (code in client.roleMenu) continue;
             if (itt > 1000) {
                 itt = 0;
@@ -42,7 +59,7 @@
         client.roleMenu[code] = {
             guild: interaction.guild.id,
             guildName: interaction.guild.name,
-            guildIcon: interaction.guild.iconURL({format: "png"}),
+            guildIcon: interaction.guild.iconURL({ format: "png" }),
             user: interaction.member.user.id,
             username: interaction.member.user.username,
             data: config.roleMenu.options,
@@ -50,31 +67,44 @@
         };
         let up = true;
         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) up = false;
-        } catch { up = false; }
+        } catch {
+            up = false;
+        }
         m = await interaction.editReply({
-            embeds: [new EmojiEmbed()
-                .setTitle("Roles")
-                .setDescription("Select how to choose your roles")
-                .setStatus("Success")
-                .setEmoji("GUILD.GREEN")
-            ], components: [new MessageActionRow().addComponents([
-                new MessageButton()
-                    .setLabel("Online")
-                    .setStyle("LINK")
-                    .setDisabled(!up)
-                    .setURL(`${client.config.baseUrl}nucleus/rolemenu?code=${code}`),
-                new MessageButton()
-                    .setLabel("Manual")
-                    .setStyle("PRIMARY")
-                    .setCustomId("manual")
-            ])]
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Roles")
+                    .setDescription("Select how to choose your roles")
+                    .setStatus("Success")
+                    .setEmoji("GUILD.GREEN")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setLabel("Online")
+                        .setStyle("LINK")
+                        .setDisabled(!up)
+                        .setURL(
+                            `${client.config.baseUrl}nucleus/rolemenu?code=${code}`
+                        ),
+                    new MessageButton()
+                        .setLabel("Manual")
+                        .setStyle("PRIMARY")
+                        .setCustomId("manual")
+                ])
+            ]
         });
     }
     let component;
-    try { component = await m.awaitMessageComponent({time: 300000});
-    } catch (e) { return; }
+    try {
+        component = await m.awaitMessageComponent({ time: 300000 });
+    } catch (e) {
+        return;
+    }
     component.deferUpdate();
     let rolesToAdd = [];
     for (let i = 0; i < config.roleMenu.options.length; i++) {
@@ -84,36 +114,66 @@
                 new EmojiEmbed()
                     .setTitle("Roles")
                     .setEmoji("GUILD.GREEN")
-                    .setDescription(`**${object.name}**` + (object.description ? `\n${object.description}` : "") +
-                        `\n\nSelect ${object.min}` + (object.min !== object.max ? ` to ${object.max}` : "") + ` role${object.max === 1 ? "" : "s"} to add.`)
+                    .setDescription(
+                        `**${object.name}**` +
+                            (object.description
+                                ? `\n${object.description}`
+                                : "") +
+                            `\n\nSelect ${object.min}` +
+                            (object.min !== object.max
+                                ? ` to ${object.max}`
+                                : "") +
+                            ` role${object.max === 1 ? "" : "s"} to add.`
+                    )
                     .setStatus("Success")
-                    .setFooter({text: `Step ${i + 1}/${config.roleMenu.options.length}`})
+                    .setFooter({
+                        text: `Step ${i + 1}/${config.roleMenu.options.length}`
+                    })
             ],
             components: [
+                new MessageActionRow().addComponents(
+                    [
+                        new MessageButton()
+                            .setLabel("Cancel")
+                            .setStyle("DANGER")
+                            .setCustomId("cancel")
+                            .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                    ].concat(
+                        object.min === 0
+                            ? [
+                                  new MessageButton()
+                                      .setLabel("Skip")
+                                      .setStyle("SECONDARY")
+                                      .setCustomId("skip")
+                                      .setEmoji(
+                                          getEmojiByName("CONTROL.RIGHT", "id")
+                                      )
+                              ]
+                            : []
+                    )
+                )
+            ].concat([
                 new MessageActionRow().addComponents([
-                    new MessageButton()
-                        .setLabel("Cancel")
-                        .setStyle("DANGER")
-                        .setCustomId("cancel")
-                        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-                ].concat(object.min === 0 ? [
-                    new MessageButton()
-                        .setLabel("Skip")
-                        .setStyle("SECONDARY")
-                        .setCustomId("skip")
-                        .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
-                ] : []))
-            ].concat([new MessageActionRow().addComponents([new MessageSelectMenu()
-                .setPlaceholder(`${object.name}`)
-                .setCustomId("rolemenu")
-                .setMinValues(object.min)
-                .setMaxValues(object.max)
-                .setOptions(object.options.map(o => { return {label: o.name, description: o.description, value: o.role}; }))
-            ])])
+                    new MessageSelectMenu()
+                        .setPlaceholder(`${object.name}`)
+                        .setCustomId("rolemenu")
+                        .setMinValues(object.min)
+                        .setMaxValues(object.max)
+                        .setOptions(
+                            object.options.map((o) => {
+                                return {
+                                    label: o.name,
+                                    description: o.description,
+                                    value: o.role
+                                };
+                            })
+                        )
+                ])
+            ])
         });
         let component;
         try {
-            component = await m.awaitMessageComponent({time: 300000});
+            component = await m.awaitMessageComponent({ time: 300000 });
         } catch (e) {
             return;
         }
@@ -121,34 +181,54 @@
         if (component.customId === "rolemenu") {
             rolesToAdd = rolesToAdd.concat(component.values);
         } else if (component.customId === "cancel") {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Roles")
-                .setDescription("Cancelled. No changes were made.")
-                .setStatus("Danger")
-                .setEmoji("GUILD.RED")
-            ], components: []});
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Roles")
+                        .setDescription("Cancelled. No changes were made.")
+                        .setStatus("Danger")
+                        .setEmoji("GUILD.RED")
+                ],
+                components: []
+            });
         }
     }
-    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));
-    rolesToAdd = rolesToAdd.filter(r => !memberRoles.includes(r));
+    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));
+    rolesToAdd = rolesToAdd.filter((r) => !memberRoles.includes(r));
     try {
         await interaction.member.roles.remove(rolesToRemove);
         await interaction.member.roles.add(rolesToAdd);
     } catch (e) {
-        return await interaction.reply({embeds: [new EmojiEmbed()
-            .setTitle("Roles")
-            .setDescription("Something went wrong and your roles were not added. Please contact a staff member or try again later.")
-            .setStatus("Danger")
-            .setEmoji("GUILD.RED")
-        ], components: []});
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Roles")
+                    .setDescription(
+                        "Something went wrong and your roles were not added. Please contact a staff member or try again later."
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("GUILD.RED")
+            ],
+            components: []
+        });
     }
-    await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Roles")
-        .setDescription("Roles have been added. You may close this message.")
-        .setStatus("Success")
-        .setEmoji("GUILD.GREEN")
-    ], components: []});
+    await interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Roles")
+                .setDescription(
+                    "Roles have been added. You may close this message."
+                )
+                .setStatus("Success")
+                .setEmoji("GUILD.GREEN")
+        ],
+        components: []
+    });
     return;
 }
diff --git a/src/actions/tickets/create.ts b/src/actions/tickets/create.ts
index f724728..ca5147a 100644
--- a/src/actions/tickets/create.ts
+++ b/src/actions/tickets/create.ts
@@ -6,50 +6,84 @@
 
 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) {
-        return await interaction.reply({embeds: [new EmojiEmbed()
-            .setTitle("Tickets are disabled")
-            .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" : ""})
-            .setStatus("Danger")
-            .setEmoji("CONTROL.BLOCKCROSS")
-        ], ephemeral: true});
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tickets are disabled")
+                    .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"
+                            : ""
+                    })
+                    .setStatus("Danger")
+                    .setEmoji("CONTROL.BLOCKCROSS")
+            ],
+            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 => {
+    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++;
             }
         }
     });
     if (count >= config.tickets.maxTickets) {
-        return await interaction.reply({embeds: [new EmojiEmbed()
-            .setTitle("Create Ticket")
-            .setDescription(`You have reached the maximum amount of tickets (${config.tickets.maxTickets}). Please close one of your active tickets before creating a new one.`)
-            .setStatus("Danger")
-            .setEmoji("CONTROL.BLOCKCROSS")
-        ], ephemeral: true});
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Create Ticket")
+                    .setDescription(
+                        `You have reached the maximum amount of tickets (${config.tickets.maxTickets}). Please close one of your active tickets before creating a new one.`
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("CONTROL.BLOCKCROSS")
+            ],
+            ephemeral: true
+        });
     }
     let ticketTypes;
     let custom = false;
-    if (config.tickets.customTypes && config.tickets.useCustom) { ticketTypes = config.tickets.customTypes; custom = true; }
-    else if (config.tickets.types) ticketTypes = toHexArray(config.tickets.types, tickets);
+    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 ticketTypes = [];
     let chosenType;
     let splitFormattedTicketTypes = [];
     if (ticketTypes.length > 0) {
         let formattedTicketTypes = [];
-        formattedTicketTypes = ticketTypes.map(type => {
+        formattedTicketTypes = ticketTypes.map((type) => {
             if (custom) {
                 return new MessageButton()
                     .setLabel(type)
@@ -60,28 +94,43 @@
                     .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: [new EmojiEmbed()
-            .setTitle("Create Ticket")
-            .setDescription("Select a ticket type")
-            .setStatus("Success")
-            .setEmoji("GUILD.TICKET.OPEN")
-        ], ephemeral: true, fetchReply: true, components: splitFormattedTicketTypes});
+        const m = await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Create Ticket")
+                    .setDescription("Select a ticket type")
+                    .setStatus("Success")
+                    .setEmoji("GUILD.TICKET.OPEN")
+            ],
+            ephemeral: true,
+            fetchReply: true,
+            components: splitFormattedTicketTypes
+        });
         let component;
         try {
-            component = await m.awaitMessageComponent({time: 300000});
+            component = await m.awaitMessageComponent({ time: 300000 });
         } catch (e) {
             return;
         }
         chosenType = component.customId;
         splitFormattedTicketTypes = [];
         formattedTicketTypes = [];
-        formattedTicketTypes = ticketTypes.map(type => {
+        formattedTicketTypes = ticketTypes.map((type) => {
             if (custom) {
                 return new MessageButton()
                     .setLabel(type)
@@ -93,31 +142,57 @@
                     .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: [new EmojiEmbed()
-            .setTitle("Create Ticket")
-            .setDescription("Select a ticket type")
-            .setStatus("Success")
-            .setEmoji("GUILD.TICKET.OPEN")
-        ], components: splitFormattedTicketTypes});
+        component.update({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Create Ticket")
+                    .setDescription("Select a ticket type")
+                    .setStatus("Success")
+                    .setEmoji("GUILD.TICKET.OPEN")
+            ],
+            components: splitFormattedTicketTypes
+        });
     } else {
         chosenType = null;
-        await interaction.reply({embeds: [new EmojiEmbed()
-            .setTitle("Create Ticket")
-            .setEmoji("GUILD.TICKET.OPEN")
-        ], ephemeral: true, components: splitFormattedTicketTypes});
+        await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Create Ticket")
+                    .setEmoji("GUILD.TICKET.OPEN")
+            ],
+            ephemeral: true,
+            components: splitFormattedTicketTypes
+        });
     }
-    const overwrites = [{
-        id: interaction.member,
-        allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
-        type: "member"
-    }] as Discord.OverwriteResolvable[];
+    const overwrites = [
+        {
+            id: interaction.member,
+            allow: [
+                "VIEW_CHANNEL",
+                "SEND_MESSAGES",
+                "ATTACH_FILES",
+                "ADD_REACTIONS",
+                "READ_MESSAGE_HISTORY"
+            ],
+            type: "member"
+        }
+    ] as Discord.OverwriteResolvable[];
     overwrites.push({
         id: interaction.guild.roles.everyone,
         deny: ["VIEW_CHANNEL"],
@@ -126,60 +201,93 @@
     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"
-        });
-    } catch (e) {
-        return await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Create Ticket")
-            .setDescription("Failed to create ticket")
-            .setStatus("Danger")
-            .setEmoji("CONTROL.BLOCKCROSS")
-        ]});
-    }
-    try {
-        await c.send(
+        c = await interaction.guild.channels.create(
+            interaction.member.user.username,
             {
-                content: (`<@${interaction.member.user.id}>` + (config.tickets.supportRole !== null ? ` • <@&${config.tickets.supportRole}>` : "")),
-                allowedMentions: {
-                    users: [(interaction.member as Discord.GuildMember).id],
-                    roles: (config.tickets.supportRole !== null ? [config.tickets.supportRole] : [])
-                }
+                type: "GUILD_TEXT",
+                topic: `${interaction.member.user.id} Active`,
+                parent: config.tickets.category,
+                nsfw: false,
+                permissionOverwrites:
+                    overwrites as Discord.OverwriteResolvable[],
+                reason: "Creating ticket"
             }
         );
-        let content = interaction.options ? interaction.options.getString("message") || "" : "";
+    } catch (e) {
+        return await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Create Ticket")
+                    .setDescription("Failed to create ticket")
+                    .setStatus("Danger")
+                    .setEmoji("CONTROL.BLOCKCROSS")
+            ]
+        });
+    }
+    try {
+        await c.send({
+            content:
+                `<@${interaction.member.user.id}>` +
+                (config.tickets.supportRole !== null
+                    ? ` • <@&${config.tickets.supportRole}>`
+                    : ""),
+            allowedMentions: {
+                users: [(interaction.member as Discord.GuildMember).id],
+                roles:
+                    config.tickets.supportRole !== null
+                        ? [config.tickets.supportRole]
+                        : []
+            }
+        });
+        let content = interaction.options
+            ? interaction.options.getString("message") || ""
+            : "";
         if (content) content = `**Message:**\n> ${content}\n`;
-        const emoji = custom ? "" : getEmojiByName("TICKETS." + chosenType.toUpperCase());
-        await c.send({ embeds: [new EmojiEmbed()
-            .setTitle("New Ticket")
-            .setDescription(
-                `Ticket created by <@${interaction.member.user.id}>\n` +
-                `**Support type:** ${chosenType !== null ? (emoji) + " " + capitalize(chosenType) : "General"}\n` +
-                `**Ticket ID:** \`${c.id}\`\n${content}\n` +
-                "Type `/ticket close` to close this ticket."
-            )
-            .setStatus("Success")
-            .setEmoji("GUILD.TICKET.OPEN")
-        ], components: [new MessageActionRow().addComponents([new MessageButton()
-            .setLabel("Close")
-            .setStyle("DANGER")
-            .setCustomId("closeticket")
-            .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-        ])]});
+        const emoji = custom
+            ? ""
+            : getEmojiByName("TICKETS." + chosenType.toUpperCase());
+        await c.send({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("New Ticket")
+                    .setDescription(
+                        `Ticket created by <@${interaction.member.user.id}>\n` +
+                            `**Support type:** ${
+                                chosenType !== null
+                                    ? emoji + " " + capitalize(chosenType)
+                                    : "General"
+                            }\n` +
+                            `**Ticket ID:** \`${c.id}\`\n${content}\n` +
+                            "Type `/ticket close` to close this ticket."
+                    )
+                    .setStatus("Success")
+                    .setEmoji("GUILD.TICKET.OPEN")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setLabel("Close")
+                        .setStyle("DANGER")
+                        .setCustomId("closeticket")
+                        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                ])
+            ]
+        });
         const data = {
-            meta:{
+            meta: {
                 type: "ticketCreate",
                 displayName: "Ticket Created",
                 calculateType: "ticketUpdate",
@@ -188,8 +296,14 @@
                 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: {
@@ -197,11 +311,19 @@
             }
         };
         log(data);
-    } catch (e) { console.log(e);}
-    await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Create Ticket")
-        .setDescription(`Ticket created. You can view it here: <#${c.id}>`)
-        .setStatus("Success")
-        .setEmoji("GUILD.TICKET.OPEN")
-    ], components: splitFormattedTicketTypes});
-}
\ No newline at end of file
+    } catch (e) {
+        console.log(e);
+    }
+    await interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Create Ticket")
+                .setDescription(
+                    `Ticket created. You can view it here: <#${c.id}>`
+                )
+                .setStatus("Success")
+                .setEmoji("GUILD.TICKET.OPEN")
+        ],
+        components: splitFormattedTicketTypes
+    });
+}
diff --git a/src/actions/tickets/delete.ts b/src/actions/tickets/delete.ts
index e5c017f..6509c03 100644
--- a/src/actions/tickets/delete.ts
+++ b/src/actions/tickets/delete.ts
@@ -4,31 +4,53 @@
 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;
     if (interaction.channel instanceof Discord.ThreadChannel) thread = true;
     const threadChannel = interaction.channel as Discord.ThreadChannel;
-    const channel = (interaction.channel as Discord.TextChannel);
-    if (!channel.parent || config.tickets.category !== channel.parent.id || (thread ? (threadChannel.parent.parent.id !== config.tickets.category) : false)) {
-        return interaction.reply({embeds: [new EmojiEmbed()
-            .setTitle("Deleting Ticket...")
-            .setDescription("This ticket is not in your tickets category, so cannot be deleted. You cannot run close in a thread.")
-            .setStatus("Danger")
-            .setEmoji("CONTROL.BLOCKCROSS")
-        ], ephemeral: true});
+    const channel = interaction.channel as Discord.TextChannel;
+    if (
+        !channel.parent ||
+        config.tickets.category !== channel.parent.id ||
+        (thread
+            ? threadChannel.parent.parent.id !== config.tickets.category
+            : false)
+    ) {
+        return interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Deleting Ticket...")
+                    .setDescription(
+                        "This ticket is not in your tickets category, so cannot be deleted. You cannot run close in a thread."
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("CONTROL.BLOCKCROSS")
+            ],
+            ephemeral: true
+        });
     }
     const status = channel.topic.split(" ")[1];
     if (status === "Archived") {
-        await interaction.reply({embeds: [new EmojiEmbed()
-            .setTitle("Delete Ticket")
-            .setDescription("Your ticket is being deleted...")
-            .setStatus("Danger")
-            .setEmoji("GUILD.TICKET.CLOSE")
-        ]});
+        await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Delete Ticket")
+                    .setDescription("Your ticket is being deleted...")
+                    .setStatus("Danger")
+                    .setEmoji("GUILD.TICKET.CLOSE")
+            ]
+        });
         const data = {
-            meta:{
+            meta: {
                 type: "ticketDeleted",
                 displayName: "Ticket Deleted",
                 calculateType: "ticketUpdate",
@@ -37,9 +59,24 @@
                 timestamp: new Date().getTime()
             },
             list: {
-                ticketFor: entry(channel.topic.split(" ")[0], 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()))
+                ticketFor: entry(
+                    channel.topic.split(" ")[0],
+                    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())
+                )
             },
             hidden: {
                 guild: interaction.guild.id
@@ -49,12 +86,15 @@
         interaction.channel.delete();
         return;
     } else if (status === "Active") {
-        await interaction.reply({embeds: [new EmojiEmbed()
-            .setTitle("Close Ticket")
-            .setDescription("Your ticket is being closed...")
-            .setStatus("Warning")
-            .setEmoji("GUILD.TICKET.ARCHIVED")
-        ]});
+        await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Close Ticket")
+                    .setDescription("Your ticket is being closed...")
+                    .setStatus("Warning")
+                    .setEmoji("GUILD.TICKET.ARCHIVED")
+            ]
+        });
         const overwrites = [
             {
                 id: channel.topic.split(" ")[0],
@@ -69,15 +109,23 @@
         ] 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"
             });
         }
-        channel.edit({permissionOverwrites: overwrites});
+        channel.edit({ permissionOverwrites: overwrites });
         channel.setTopic(`${channel.topic.split(" ")[0]} Archived`);
         const data = {
-            meta:{
+            meta: {
                 type: "ticketClosed",
                 displayName: "Ticket Closed",
                 calculateType: "ticketUpdate",
@@ -86,9 +134,24 @@
                 timestamp: new Date().getTime()
             },
             list: {
-                ticketFor: entry(channel.topic.split(" ")[0], 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())),
+                ticketFor: entry(
+                    channel.topic.split(" ")[0],
+                    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())
+                ),
                 ticketChannel: entry(channel.id, renderChannel(channel))
             },
             hidden: {
@@ -96,26 +159,43 @@
             }
         };
         log(data);
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Close Ticket")
-            .setDescription("This ticket has been closed.\nType `/ticket close` again to delete it.\n\nNote: Check `/privacy` for details about transcripts.")
-            .setStatus("Warning")
-            .setEmoji("GUILD.TICKET.ARCHIVED")
-        ], components: [
-            new MessageActionRow().addComponents([
-                new MessageButton()
-                    .setLabel("Delete")
-                    .setStyle("DANGER")
-                    .setCustomId("closeticket")
-                    .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-            ].concat(client.database.premium.hasPremium(interaction.guild.id) ? [
-                new MessageButton()
-                    .setLabel("Create Transcript and Delete")
-                    .setStyle("PRIMARY")
-                    .setCustomId("createtranscript")
-                    .setEmoji(getEmojiByName("CONTROL.DOWNLOAD", "id"))
-            ] : []))
-        ]});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Close Ticket")
+                    .setDescription(
+                        "This ticket has been closed.\nType `/ticket close` again to delete it.\n\nNote: Check `/privacy` for details about transcripts."
+                    )
+                    .setStatus("Warning")
+                    .setEmoji("GUILD.TICKET.ARCHIVED")
+            ],
+            components: [
+                new MessageActionRow().addComponents(
+                    [
+                        new MessageButton()
+                            .setLabel("Delete")
+                            .setStyle("DANGER")
+                            .setCustomId("closeticket")
+                            .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                    ].concat(
+                        client.database.premium.hasPremium(interaction.guild.id)
+                            ? [
+                                  new MessageButton()
+                                      .setLabel("Create Transcript and Delete")
+                                      .setStyle("PRIMARY")
+                                      .setCustomId("createtranscript")
+                                      .setEmoji(
+                                          getEmojiByName(
+                                              "CONTROL.DOWNLOAD",
+                                              "id"
+                                          )
+                                      )
+                              ]
+                            : []
+                    )
+                )
+            ]
+        });
         return;
     }
 }
@@ -127,19 +207,22 @@
     if (!tickets) return;
     const ticketChannels = tickets.children;
     let deleted = 0;
-    ticketChannels.forEach(element => {
+    ticketChannels.forEach((element) => {
         if (element.type !== "GUILD_TEXT") return;
         if (element.topic.split(" ")[0] === member) {
             try {
                 element.delete();
-            } catch { /* Errors if the channel does not exist (deleted already) */ }
+            } catch {
+                /* Errors if the channel does not exist (deleted already) */
+            }
             deleted++;
         }
     });
     if (deleted) {
-        const { log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger;
+        const { log, NucleusColors, entry, renderUser, renderDelta } =
+            member.client.logger;
         const data = {
-            meta:{
+            meta: {
                 type: "ticketPurge",
                 displayName: "Tickets Purged",
                 calculateType: "ticketUpdate",
@@ -150,7 +233,10 @@
             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: {
@@ -161,4 +247,4 @@
     }
 }
 
-export { purgeByUser };
\ No newline at end of file
+export { purgeByUser };
diff --git a/src/api/index.ts b/src/api/index.ts
index b94bbe0..2c4baba 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -4,7 +4,6 @@
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 import structuredClone from "@ungap/structured-clone";
 
-
 const jsonParser = bodyParser.json();
 const app = express();
 const port = 10000;
@@ -19,26 +18,36 @@
         const secret = req.body.secret;
         if (secret === client.config.verifySecret) {
             const guild = await client.guilds.fetch(client.verify[code].gID);
-            if (!guild) { return res.status(404); }
+            if (!guild) {
+                return res.status(404);
+            }
             const member = await guild.members.fetch(client.verify[code].uID);
-            if (!member) { return res.status(404); }
-            if (member.roles.cache.has(client.verify[code].rID)) { return res.status(200); }
+            if (!member) {
+                return res.status(404);
+            }
+            if (member.roles.cache.has(client.verify[code].rID)) {
+                return res.status(200);
+            }
             await member.roles.add(client.verify[code].rID);
 
             const interaction = client.verify[code].interaction;
             if (interaction) {
-                interaction.editReply({embeds: [new EmojiEmbed()
-                    .setTitle("Verify")
-                    .setDescription("Verification complete")
-                    .setStatus("Success")
-                    .setEmoji("MEMBER.JOIN")
-                ], components: []});
+                interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Verify")
+                            .setDescription("Verification complete")
+                            .setStatus("Success")
+                            .setEmoji("MEMBER.JOIN")
+                    ],
+                    components: []
+                });
             }
             delete client.verify[code];
             const { log, NucleusColors, entry, renderUser } = client.logger;
             try {
                 const data = {
-                    meta:{
+                    meta: {
                         type: "memberVerify",
                         displayName: "Member Verified",
                         calculateType: "guildMemberVerify",
@@ -70,14 +79,21 @@
             try {
                 const interaction = client.verify[code].interaction;
                 if (interaction) {
-                    interaction.editReply({embeds: [new EmojiEmbed()
-                        .setTitle("Verify")
-                        .setDescription("Verify was opened in another tab or window, please complete the CAPTCHA there to continue")
-                        .setStatus("Success")
-                        .setEmoji("MEMBER.JOIN")
-                    ]});
+                    interaction.editReply({
+                        embeds: [
+                            new EmojiEmbed()
+                                .setTitle("Verify")
+                                .setDescription(
+                                    "Verify was opened in another tab or window, please complete the CAPTCHA there to continue"
+                                )
+                                .setStatus("Success")
+                                .setEmoji("MEMBER.JOIN")
+                        ]
+                    });
                 }
-            } catch { return res.sendStatus(410); }
+            } catch {
+                return res.sendStatus(410);
+            }
             const data = structuredClone(client.verify[code]);
             delete data.interaction;
             return res.status(200).send(data);
@@ -89,10 +105,18 @@
         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);
-            if (!guild) { return res.status(404); }
-            const member = await guild.members.fetch(client.roleMenu[code].user);
-            if (!member) { return res.status(404); }
+            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
+            );
+            if (!member) {
+                return res.status(404);
+            }
             res.sendStatus(200);
         } else {
             res.sendStatus(403);
@@ -105,14 +129,22 @@
             try {
                 const interaction = client.roleMenu[code].interaction;
                 if (interaction) {
-                    interaction.editReply({embeds: [new EmojiEmbed()
-                        .setTitle("Roles")
-                        .setDescription("The role menu was opened in another tab or window, please select your roles there to continue")
-                        .setStatus("Success")
-                        .setEmoji("GUILD.GREEN")
-                    ], components: []});
+                    interaction.editReply({
+                        embeds: [
+                            new EmojiEmbed()
+                                .setTitle("Roles")
+                                .setDescription(
+                                    "The role menu was opened in another tab or window, please select your roles there to continue"
+                                )
+                                .setStatus("Success")
+                                .setEmoji("GUILD.GREEN")
+                        ],
+                        components: []
+                    });
                 }
-            } catch { return res.sendStatus(410); }
+            } catch {
+                return res.sendStatus(410);
+            }
             const data = structuredClone(client.roleMenu[code]);
             delete data.interaction;
             console.log(data);
@@ -124,4 +156,4 @@
     app.listen(port);
 };
 
-export default runServer;
\ No newline at end of file
+export default runServer;
diff --git a/src/commands/help.ts b/src/commands/help.ts
index 900f24c..921318e 100644
--- a/src/commands/help.ts
+++ b/src/commands/help.ts
@@ -10,10 +10,13 @@
     interaction.reply("hel p"); // TODO: FINISH THIS FOR RELEASE
 };
 
-const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
+const check = (
+    _interaction: CommandInteraction,
+    _defaultCheck: WrappedCheck
+) => {
     return true;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/mod/_meta.ts b/src/commands/mod/_meta.ts
index c2a76a9..7bdd813 100644
--- a/src/commands/mod/_meta.ts
+++ b/src/commands/mod/_meta.ts
@@ -1,4 +1,4 @@
 const name = "mod";
 const description = "Perform moderator actions";
 
-export { name, description };
\ No newline at end of file
+export { name, description };
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index a55dcfa..4560c8b 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -1,4 +1,9 @@
-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";
@@ -10,8 +15,20 @@
     builder
         .setName("ban")
         .setDescription("Bans a user from the server")
-        .addUserOption(option => option.setName("user").setDescription("The user to ban").setRequired(true))
-        .addNumberOption(option => option.setName("delete").setDescription("The days of messages to delete | Default: 0").setMinValue(0).setMaxValue(7).setRequired(false));
+        .addUserOption((option) =>
+            option
+                .setName("user")
+                .setDescription("The user to ban")
+                .setRequired(true)
+        )
+        .addNumberOption((option) =>
+            option
+                .setName("delete")
+                .setDescription("The days of messages to delete | Default: 0")
+                .setMinValue(0)
+                .setMaxValue(7)
+                .setRequired(false)
+        );
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     const { renderUser } = client.logger;
@@ -23,13 +40,25 @@
         confirmation = await new confirmationMessage(interaction)
             .setEmoji("PUNISH.BAN.RED")
             .setTitle("Ban")
-            .setDescription(keyValueList({
-                "user": renderUser(interaction.options.getUser("user")),
-                "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, "day")} of messages will be deleted\n\n`
-            + `Are you sure you want to ban <@!${(interaction.options.getMember("user") as GuildMember).id}>?`)
+            .setDescription(
+                keyValueList({
+                    user: renderUser(interaction.options.getUser("user")),
+                    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,
+                        "day"
+                    )} of messages will be deleted\n\n` +
+                    `Are you sure you want to ban <@!${
+                        (interaction.options.getMember("user") as GuildMember)
+                            .id
+                    }>?`
+            )
             .setColor("Danger")
             .addReasonButton(reason ?? "")
             .send(reason !== null);
@@ -37,7 +66,8 @@
         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;
@@ -45,31 +75,52 @@
         const config = await client.database.guilds.read(interaction.guild.id);
         try {
             if (notify) {
-                dm = await (interaction.options.getMember("user") as GuildMember).send({
-                    embeds: [new EmojiEmbed()
-                        .setEmoji("PUNISH.BAN.RED")
-                        .setTitle("Banned")
-                        .setDescription(`You have been banned in ${interaction.guild.name}` +
-                                    (reason ? ` for:\n> ${reason}` : "."))
-                        .setStatus("Danger")
+                dm = await (
+                    interaction.options.getMember("user") as GuildMember
+                ).send({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("PUNISH.BAN.RED")
+                            .setTitle("Banned")
+                            .setDescription(
+                                `You have been banned in ${interaction.guild.name}` +
+                                    (reason ? ` for:\n> ${reason}` : ".")
+                            )
+                            .setStatus("Danger")
                     ],
-                    components: [new MessageActionRow().addComponents(config.moderation.ban.text ? [new MessageButton()
-                        .setStyle("LINK")
-                        .setLabel(config.moderation.ban.text)
-                        .setURL(config.moderation.ban.link)
-                    ] : [])]
+                    components: [
+                        new MessageActionRow().addComponents(
+                            config.moderation.ban.text
+                                ? [
+                                      new MessageButton()
+                                          .setStyle("LINK")
+                                          .setLabel(config.moderation.ban.text)
+                                          .setURL(config.moderation.ban.link)
+                                  ]
+                                : []
+                        )
+                    ]
                 });
                 dmd = true;
             }
-        } catch { dmd = false; }
+        } catch {
+            dmd = false;
+        }
         try {
-            const member = (interaction.options.getMember("user") as GuildMember);
+            const member = interaction.options.getMember("user") as GuildMember;
             member.ban({
                 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",
@@ -82,10 +133,22 @@
                 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: {
@@ -94,56 +157,79 @@
             };
             log(data);
         } catch {
-            await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("PUNISH.BAN.RED")
-                .setTitle("Ban")
-                .setDescription("Something went wrong and the user was not banned")
-                .setStatus("Danger")
-            ], components: []});
+            await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("PUNISH.BAN.RED")
+                        .setTitle("Ban")
+                        .setDescription(
+                            "Something went wrong and the user was not banned"
+                        )
+                        .setStatus("Danger")
+                ],
+                components: []
+            });
             if (dmd) await dm.delete();
             return;
         }
-        const failed = (dmd === false && notify);
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
-            .setTitle("Ban")
-            .setDescription("The member was banned" + (failed ? ", but could not be notified" : ""))
-            .setStatus(failed ? "Warning" : "Success")
-        ], components: []});
+        const failed = !dmd && notify;
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji(`PUNISH.BAN.${failed ? "YELLOW" : "GREEN"}`)
+                    .setTitle("Ban")
+                    .setDescription(
+                        "The member was banned" +
+                            (failed ? ", but could not be notified" : "")
+                    )
+                    .setStatus(failed ? "Warning" : "Success")
+            ],
+            components: []
+        });
     } else {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("PUNISH.BAN.GREEN")
-            .setTitle("Ban")
-            .setDescription("No changes were made")
-            .setStatus("Success")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("PUNISH.BAN.GREEN")
+                    .setTitle("Ban")
+                    .setDescription("No changes were made")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
     }
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as GuildMember);
-    const me = (interaction.guild.me as GuildMember);
-    const apply = (interaction.options.getMember("user") as GuildMember);
-    if (member === null || me === null || apply === null) throw "That member is not in the server";
+    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";
     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;
 };
 
-export { command, callback, check };
\ No newline at end of file
+export { command, callback, check };
diff --git a/src/commands/mod/info.ts b/src/commands/mod/info.ts
index 68b3ce7..86a4c4a 100644
--- a/src/commands/mod/info.ts
+++ b/src/commands/mod/info.ts
@@ -1,5 +1,11 @@
 import { HistorySchema } from "../../utils/database";
-import Discord, { CommandInteraction, GuildMember, MessageActionRow, MessageButton, TextInputComponent } from "discord.js";
+import Discord, {
+    CommandInteraction,
+    GuildMember,
+    MessageActionRow,
+    MessageButton,
+    TextInputComponent
+} from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -11,51 +17,88 @@
     builder
         .setName("info")
         .setDescription("Shows moderator information about a user")
-        .addUserOption(option => option.setName("user").setDescription("The user to get information about").setRequired(true));
+        .addUserOption((option) =>
+            option
+                .setName("user")
+                .setDescription("The user to get information about")
+                .setRequired(true)
+        );
 
 const types = {
-    "warn": {emoji: "PUNISH.WARN.YELLOW", text: "Warned"},
-    "mute": {emoji: "PUNISH.MUTE.YELLOW", text: "Muted"},
-    "unmute": {emoji: "PUNISH.MUTE.GREEN", text: "Unmuted"},
-    "join": {emoji: "MEMBER.JOIN", text: "Joined"},
-    "leave": {emoji: "MEMBER.LEAVE", text: "Left"},
-    "kick": {emoji: "MEMBER.KICK", text: "Kicked"},
-    "softban": {emoji: "PUNISH.SOFTBAN", text: "Softbanned"},
-    "ban": {emoji: "MEMBER.BAN", text: "Banned"},
-    "unban": {emoji: "MEMBER.UNBAN", text: "Unbanned"},
-    "purge": {emoji: "PUNISH.CLEARHISTORY", text: "Messages cleared"},
-    "nickname": {emoji: "PUNISH.NICKNAME.YELLOW", text: "Nickname changed"}
+    warn: { emoji: "PUNISH.WARN.YELLOW", text: "Warned" },
+    mute: { emoji: "PUNISH.MUTE.YELLOW", text: "Muted" },
+    unmute: { emoji: "PUNISH.MUTE.GREEN", text: "Unmuted" },
+    join: { emoji: "MEMBER.JOIN", text: "Joined" },
+    leave: { emoji: "MEMBER.LEAVE", text: "Left" },
+    kick: { emoji: "MEMBER.KICK", text: "Kicked" },
+    softban: { emoji: "PUNISH.SOFTBAN", text: "Softbanned" },
+    ban: { emoji: "MEMBER.BAN", text: "Banned" },
+    unban: { emoji: "MEMBER.UNBAN", text: "Unbanned" },
+    purge: { emoji: "PUNISH.CLEARHISTORY", text: "Messages cleared" },
+    nickname: { emoji: "PUNISH.NICKNAME.YELLOW", text: "Nickname changed" }
 };
 
 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>`;
-    if (history.moderator) { s += ` by <@${history.moderator}>`; }
-    if (history.reason) { s += `\n**Reason:**\n> ${history.reason}`; }
-    if (history.before) { s += `\n**Before:**\n> ${history.before}`; }
-    if (history.after) { s += `\n**After:**\n> ${history.after}`; }
+        history.amount ? history.amount + " " : ""
+    }${types[history.type].text} on <t:${Math.round(
+        history.occurredAt.getTime() / 1000
+    )}:F>`;
+    if (history.moderator) {
+        s += ` by <@${history.moderator}>`;
+    }
+    if (history.reason) {
+        s += `\n**Reason:**\n> ${history.reason}`;
+    }
+    if (history.before) {
+        s += `\n**Before:**\n> ${history.before}`;
+    }
+    if (history.after) {
+        s += `\n**After:**\n> ${history.after}`;
+    }
     return s + "\n";
 }
 
-
 class TimelineSection {
     name: string;
-    content: {data: HistorySchema, rendered: string}[] = [];
+    content: { data: HistorySchema; rendered: string }[] = [];
 
-    addContent = (content: {data: HistorySchema, rendered: string}) => { this.content.push(content); return this; };
-    contentLength = () => { return this.content.reduce((acc, cur) => acc + cur.rendered.length, 0); };
+    addContent = (content: { data: HistorySchema; rendered: string }) => {
+        this.content.push(content);
+        return this;
+    };
+    contentLength = () => {
+        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);
-        if (first === last) { return this.name = `<t:${first}:F>`; }
-        return this.name = `<t:${first}:F> - <t:${last}:F>`;
+        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>`);
+        }
+        return (this.name = `<t:${first}:F> - <t:${last}:F>`);
     };
 }
 
-const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
+const monthNames = [
+    "January",
+    "February",
+    "March",
+    "April",
+    "May",
+    "June",
+    "July",
+    "August",
+    "September",
+    "October",
+    "November",
+    "December"
+];
 
 async function showHistory(member, interaction: CommandInteraction) {
     let currentYear = new Date().getFullYear();
@@ -66,41 +109,72 @@
     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));
+                if (filteredTypes.length === 0) {
+                    tempFilteredTypes = Object.keys(types);
+                }
+                history = history.filter((h) =>
+                    tempFilteredTypes.includes(h.type)
+                );
             }
             refresh = false;
         }
         const groups: TimelineSection[] = [];
         if (history.length > 0) {
             current = new TimelineSection();
-            history.forEach(event => {
-                if (current.contentLength() + historyToString(event).length > 2000 || current.content.length === 5) {
+            history.forEach((event) => {
+                if (
+                    current.contentLength() + historyToString(event).length >
+                        2000 ||
+                    current.content.length === 5
+                ) {
                     groups.push(current);
                     current.generateName();
                     current = new TimelineSection();
                 }
-                current.addContent({data: event, rendered: historyToString(event)});
+                current.addContent({
+                    data: event,
+                    rendered: historyToString(event)
+                });
             });
             current.generateName();
             groups.push(current);
-            if (pageIndex === null) { pageIndex = groups.length - 1; }
+            if (pageIndex === null) {
+                pageIndex = groups.length - 1;
+            }
         }
         const components = (
-            openFilterPane ? [
-                new MessageActionRow().addComponents([new Discord.MessageSelectMenu().setOptions(
-                    Object.entries(types).map(([key, value]) => ({
-                        label: value.text,
-                        value: key,
-                        default: filteredTypes.includes(key),
-                        emoji: client.emojis.resolve(getEmojiByName(value.emoji, "id"))
-                    }))
-                ).setMinValues(1).setMaxValues(Object.keys(types).length).setCustomId("filter").setPlaceholder("Select at least one event")])
-            ] : []).concat([
+            openFilterPane
+                ? [
+                      new MessageActionRow().addComponents([
+                          new Discord.MessageSelectMenu()
+                              .setOptions(
+                                  Object.entries(types).map(([key, value]) => ({
+                                      label: value.text,
+                                      value: key,
+                                      default: filteredTypes.includes(key),
+                                      emoji: client.emojis.resolve(
+                                          getEmojiByName(value.emoji, "id")
+                                      )
+                                  }))
+                              )
+                              .setMinValues(1)
+                              .setMaxValues(Object.keys(types).length)
+                              .setCustomId("filter")
+                              .setPlaceholder("Select at least one event")
+                      ])
+                  ]
+                : []
+        ).concat([
             new MessageActionRow().addComponents([
                 new MessageButton()
                     .setCustomId("prevYear")
@@ -119,14 +193,18 @@
                     .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())
                     .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
                     .setStyle("SECONDARY")
                     .setDisabled(currentYear === new Date().getFullYear())
-            ]), new MessageActionRow().addComponents([
+            ]),
+            new MessageActionRow().addComponents([
                 new MessageButton()
                     .setLabel("Mod notes")
                     .setCustomId("modNotes")
@@ -139,40 +217,82 @@
                     .setEmoji(getEmojiByName("ICONS.FILTER", "id"))
             ])
         ]);
-        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"
-        ) + " " + currentYear.toString();
+        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") +
+            " " +
+            currentYear.toString();
         if (groups.length > 0) {
             const toRender = groups[Math.min(pageIndex, groups.length - 1)];
-            m = await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("MEMBER.JOIN")
-                .setTitle("Moderation history for " + member.user.username)
-                .setDescription(`**${toRender.name}**\n\n` + toRender.content.map(c => c.rendered).join("\n") + end)
-                .setStatus("Success")
-                .setFooter({text: (openFilterPane && filteredTypes.length) ? "Filters are currently enabled" : ""})
-            ], components: components});
+            m = await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("MEMBER.JOIN")
+                        .setTitle(
+                            "Moderation history for " + member.user.username
+                        )
+                        .setDescription(
+                            `**${toRender.name}**\n\n` +
+                                toRender.content
+                                    .map((c) => c.rendered)
+                                    .join("\n") +
+                                end
+                        )
+                        .setStatus("Success")
+                        .setFooter({
+                            text:
+                                openFilterPane && filteredTypes.length
+                                    ? "Filters are currently enabled"
+                                    : ""
+                        })
+                ],
+                components: components
+            });
         } else {
-            m = await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("MEMBER.JOIN")
-                .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" : ""})
-            ], components: components});
+            m = await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("MEMBER.JOIN")
+                        .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"
+                                    : ""
+                        })
+                ],
+                components: components
+            });
         }
         let i;
         try {
             i = await m.awaitMessageComponent({ time: 300000 });
         } catch (e) {
-            interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("MEMBER.JOIN")
-                .setTitle("Moderation history for " + member.user.username)
-                .setDescription(m.embeds[0].description)
-                .setStatus("Danger")
-                .setFooter({text: "Message timed out"})
-            ]});
+            interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("MEMBER.JOIN")
+                        .setTitle(
+                            "Moderation history for " + member.user.username
+                        )
+                        .setDescription(m.embeds[0].description)
+                        .setStatus("Danger")
+                        .setFooter({ text: "Message timed out" })
+                ]
+            });
             return 0;
         }
         i.deferUpdate();
@@ -181,103 +301,170 @@
             pageIndex = null;
             refresh = true;
         }
-        if (i.customId === "prevYear") { currentYear--; pageIndex = null; refresh = true; }
-        if (i.customId === "nextYear") { currentYear++; pageIndex = null; refresh = true; }
+        if (i.customId === "prevYear") {
+            currentYear--;
+            pageIndex = null;
+            refresh = true;
+        }
+        if (i.customId === "nextYear") {
+            currentYear++;
+            pageIndex = null;
+            refresh = true;
+        }
         if (i.customId === "prevPage") {
             pageIndex--;
-            if (pageIndex < 0) { pageIndex = null; currentYear--; refresh = true; }
+            if (pageIndex < 0) {
+                pageIndex = null;
+                currentYear--;
+                refresh = true;
+            }
         }
         if (i.customId === "nextPage") {
             pageIndex++;
-            if (pageIndex >= groups.length) { pageIndex = 0; currentYear++; refresh = true; }
+            if (pageIndex >= groups.length) {
+                pageIndex = 0;
+                currentYear++;
+                refresh = true;
+            }
         }
-        if (i.customId === "today") { currentYear = new Date().getFullYear(); pageIndex = null; refresh = true; }
-        if (i.customId === "modNotes") { return 1; }
-        if (i.customId === "openFilter") { openFilterPane = !openFilterPane; refresh = true; }
+        if (i.customId === "today") {
+            currentYear = new Date().getFullYear();
+            pageIndex = null;
+            refresh = true;
+        }
+        if (i.customId === "modNotes") {
+            return 1;
+        }
+        if (i.customId === "openFilter") {
+            openFilterPane = !openFilterPane;
+            refresh = true;
+        }
     }
 }
 
-
-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")
-    ], ephemeral: true, fetchReply: true});
+    const member = interaction.options.getMember("user") as Discord.GuildMember;
+    await interaction.reply({
+        embeds: [
+            new EmojiEmbed()
+                .setEmoji("NUCLEUS.LOADING")
+                .setTitle("Downloading Data")
+                .setStatus("Danger")
+        ],
+        ephemeral: true,
+        fetchReply: true
+    });
     let note;
     let firstLoad = true;
     while (true) {
         note = await client.database.notes.read(member.guild.id, member.id);
-        if (firstLoad && !note) { await showHistory(member, interaction); }
+        if (firstLoad && !note) {
+            await showHistory(member, interaction);
+        }
         firstLoad = false;
-        m = await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("MEMBER.JOIN")
-            .setTitle("Mod notes for " + member.user.username)
-            .setDescription(note ? note : "*No note set*")
-            .setStatus("Success")
-        ], components: [new MessageActionRow().addComponents([
-            new MessageButton()
-                .setLabel(`${note ? "Modify" : "Create"} note`)
-                .setStyle("PRIMARY")
-                .setCustomId("modify")
-                .setEmoji(getEmojiByName("ICONS.EDIT", "id")),
-            new MessageButton()
-                .setLabel("View moderation history")
-                .setStyle("PRIMARY")
-                .setCustomId("history")
-                .setEmoji(getEmojiByName("ICONS.HISTORY", "id"))
-        ])]});
+        m = await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("MEMBER.JOIN")
+                    .setTitle("Mod notes for " + member.user.username)
+                    .setDescription(note ? note : "*No note set*")
+                    .setStatus("Success")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setLabel(`${note ? "Modify" : "Create"} note`)
+                        .setStyle("PRIMARY")
+                        .setCustomId("modify")
+                        .setEmoji(getEmojiByName("ICONS.EDIT", "id")),
+                    new MessageButton()
+                        .setLabel("View moderation history")
+                        .setStyle("PRIMARY")
+                        .setCustomId("history")
+                        .setEmoji(getEmojiByName("ICONS.HISTORY", "id"))
+                ])
+            ]
+        });
         let i;
         try {
             i = await m.awaitMessageComponent({ time: 300000 });
-        } catch (e) { return; }
+        } catch (e) {
+            return;
+        }
         if (i.customId === "modify") {
-            await i.showModal(new Discord.Modal().setCustomId("modal").setTitle("Editing moderator note").addComponents(
-                new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
-                    .setCustomId("note")
-                    .setLabel("Note")
-                    .setMaxLength(4000)
-                    .setRequired(false)
-                    .setStyle("PARAGRAPH")
-                    .setValue(note ? note : "")
-                )
-            ));
+            await i.showModal(
+                new Discord.Modal()
+                    .setCustomId("modal")
+                    .setTitle("Editing moderator note")
+                    .addComponents(
+                        new MessageActionRow<TextInputComponent>().addComponents(
+                            new TextInputComponent()
+                                .setCustomId("note")
+                                .setLabel("Note")
+                                .setMaxLength(4000)
+                                .setRequired(false)
+                                .setStyle("PARAGRAPH")
+                                .setValue(note ? note : "")
+                        )
+                    )
+            );
             await interaction.editReply({
-                embeds: [new EmojiEmbed()
-                    .setTitle("Mod notes for " + member.user.username)
-                    .setDescription("Modal opened. If you can't see it, click back and try again.")
-                    .setStatus("Success")
-                    .setEmoji("GUILD.TICKET.OPEN")
-                ], components: [new MessageActionRow().addComponents([new MessageButton()
-                    .setLabel("Back")
-                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
-                    .setStyle("PRIMARY")
-                    .setCustomId("back")
-                ])]
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Mod notes for " + member.user.username)
+                        .setDescription(
+                            "Modal opened. If you can't see it, click back and try again."
+                        )
+                        .setStatus("Success")
+                        .setEmoji("GUILD.TICKET.OPEN")
+                ],
+                components: [
+                    new MessageActionRow().addComponents([
+                        new MessageButton()
+                            .setLabel("Back")
+                            .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                            .setStyle("PRIMARY")
+                            .setCustomId("back")
+                    ])
+                ]
             });
             let out;
             try {
-                out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (m) => m.customId === "modify");
-            } catch (e) { continue; }
+                out = await modalInteractionCollector(
+                    m,
+                    (m) => m.channel.id === interaction.channel.id,
+                    (m) => m.customId === "modify"
+                );
+            } catch (e) {
+                continue;
+            }
             if (out.fields) {
                 const toAdd = out.fields.getTextInputValue("note") || null;
-                await client.database.notes.create(member.guild.id, member.id, toAdd);
-            } else { continue; }
+                await client.database.notes.create(
+                    member.guild.id,
+                    member.id,
+                    toAdd
+                );
+            } else {
+                continue;
+            }
         } else if (i.customId === "history") {
             i.deferUpdate();
-            if (!await showHistory(member, interaction) ) return;
+            if (!(await showHistory(member, interaction))) return;
         }
     }
 };
 
 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";
+    const member = interaction.member as GuildMember;
+    if (!member.permissions.has("MODERATE_MEMBERS"))
+        throw "You do not have the *Moderate Members* permission";
     return true;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index 23785c3..59c2f81 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -1,4 +1,9 @@
-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";
@@ -10,9 +15,16 @@
     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;
@@ -22,12 +34,19 @@
         confirmation = await new confirmationMessage(interaction)
             .setEmoji("PUNISH.KICK.RED")
             .setTitle("Kick")
-            .setDescription(keyValueList({
-                "user": renderUser(interaction.options.getUser("user")),
-                "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}>?`)
+            .setDescription(
+                keyValueList({
+                    user: renderUser(interaction.options.getUser("user")),
+                    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
+                    }>?`
+            )
             .setColor("Danger")
             .addReasonButton(reason ?? "")
             .send(reason !== null);
@@ -45,28 +64,51 @@
         const config = await client.database.guilds.read(interaction.guild.id);
         try {
             if (notify) {
-                dm = await (interaction.options.getMember("user") as GuildMember).send({
-                    embeds: [new EmojiEmbed()
-                        .setEmoji("PUNISH.KICK.RED")
-                        .setTitle("Kicked")
-                        .setDescription(`You have been kicked in ${interaction.guild.name}` +
-                                    (reason ? ` for:\n> ${reason}` : "."))
-                        .setStatus("Danger")
+                dm = await (
+                    interaction.options.getMember("user") as GuildMember
+                ).send({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("PUNISH.KICK.RED")
+                            .setTitle("Kicked")
+                            .setDescription(
+                                `You have been kicked in ${interaction.guild.name}` +
+                                    (reason ? ` for:\n> ${reason}` : ".")
+                            )
+                            .setStatus("Danger")
                     ],
-                    components: [new MessageActionRow().addComponents(config.moderation.kick.text ? [new MessageButton()
-                        .setStyle("LINK")
-                        .setLabel(config.moderation.kick.text)
-                        .setURL(config.moderation.kick.link)
-                    ] : [])]
+                    components: [
+                        new MessageActionRow().addComponents(
+                            config.moderation.kick.text
+                                ? [
+                                      new MessageButton()
+                                          .setStyle("LINK")
+                                          .setLabel(config.moderation.kick.text)
+                                          .setURL(config.moderation.kick.link)
+                                  ]
+                                : []
+                        )
+                    ]
                 });
                 dmd = true;
             }
-        } catch { dmd = false; }
+        } catch {
+            dmd = false;
+        }
         try {
-            (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;
+            (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;
             const data = {
                 meta: {
                     type: "memberKick",
@@ -79,12 +121,35 @@
                 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.*"),
-                    timeInServer: entry(new Date().getTime() - member.joinedTimestamp, humanizeDuration(new Date().getTime() - member.joinedTimestamp, { round: true })),
-                    accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
+                    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
+                            }
+                        )
+                    ),
+                    accountCreated: entry(
+                        member.user.createdAt,
+                        renderDelta(member.user.createdAt)
+                    ),
                     serverMemberCount: member.guild.memberCount
                 },
                 hidden: {
@@ -93,56 +158,79 @@
             };
             log(data);
         } catch {
-            await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("PUNISH.KICK.RED")
-                .setTitle("Kick")
-                .setDescription("Something went wrong and the user was not kicked")
-                .setStatus("Danger")
-            ], components: []});
+            await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("PUNISH.KICK.RED")
+                        .setTitle("Kick")
+                        .setDescription(
+                            "Something went wrong and the user was not kicked"
+                        )
+                        .setStatus("Danger")
+                ],
+                components: []
+            });
             if (dmd) await dm.delete();
             return;
         }
-        const failed = (dmd === false && notify);
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji(`PUNISH.KICK.${failed ? "YELLOW" : "GREEN"}`)
-            .setTitle("Kick")
-            .setDescription("The member was kicked" + (failed ? ", but could not be notified" : ""))
-            .setStatus(failed ? "Warning" : "Success")
-        ], components: []});
+        const failed = !dmd && notify;
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji(`PUNISH.KICK.${failed ? "YELLOW" : "GREEN"}`)
+                    .setTitle("Kick")
+                    .setDescription(
+                        "The member was kicked" +
+                            (failed ? ", but could not be notified" : "")
+                    )
+                    .setStatus(failed ? "Warning" : "Success")
+            ],
+            components: []
+        });
     } else {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("PUNISH.KICK.GREEN")
-            .setTitle("Kick")
-            .setDescription("No changes were made")
-            .setStatus("Success")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("PUNISH.KICK.GREEN")
+                    .setTitle("Kick")
+                    .setDescription("No changes were made")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
     }
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as GuildMember);
-    const me = (interaction.guild.me as GuildMember);
-    const apply = (interaction.options.getMember("user") as GuildMember);
-    if (member === null || me === null || apply === null) throw "That member is not in the server";
+    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";
     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;
 };
 
-export { command, callback, check };
\ No newline at end of file
+export { command, callback, check };
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 1e9a812..5be6f43 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -1,5 +1,11 @@
 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";
@@ -7,20 +13,69 @@
 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))
-        .addIntegerOption(option => option.setName("days").setDescription("The number of days to mute the user for | Default: 0").setMinValue(0).setMaxValue(27).setRequired(false))
-        .addIntegerOption(option => option.setName("hours").setDescription("The number of hours to mute the user for | Default: 0").setMinValue(0).setMaxValue(23).setRequired(false))
-        .addIntegerOption(option => option.setName("minutes").setDescription("The number of minutes to mute the user for | Default: 0").setMinValue(0).setMaxValue(59).setRequired(false))
-        .addIntegerOption(option => option.setName("seconds").setDescription("The number of seconds to mute the user for | Default: 0").setMinValue(0).setMaxValue(59).setRequired(false));
+        .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"
+                )
+                .setMinValue(0)
+                .setMaxValue(27)
+                .setRequired(false)
+        )
+        .addIntegerOption((option) =>
+            option
+                .setName("hours")
+                .setDescription(
+                    "The number of hours to mute the user for | Default: 0"
+                )
+                .setMinValue(0)
+                .setMaxValue(23)
+                .setRequired(false)
+        )
+        .addIntegerOption((option) =>
+            option
+                .setName("minutes")
+                .setDescription(
+                    "The number of minutes to mute the user for | Default: 0"
+                )
+                .setMinValue(0)
+                .setMaxValue(59)
+                .setRequired(false)
+        )
+        .addIntegerOption((option) =>
+            option
+                .setName("seconds")
+                .setDescription(
+                    "The number of seconds to mute the user for | Default: 0"
+                )
+                .setMinValue(0)
+                .setMaxValue(59)
+                .setRequired(false)
+        );
 
-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;
     const user = interaction.options.getMember("user") as GuildMember;
     const time = {
         days: interaction.options.getInteger("days") || 0,
@@ -29,85 +84,136 @@
         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" : "");
-    if (config.moderation.mute.role) serverSettingsDescription += (serverSettingsDescription ? " and " : "") + `given the <@&${config.moderation.mute.role}> role`;
+    let serverSettingsDescription = config.moderation.mute.timeout
+        ? "given a timeout"
+        : "";
+    if (config.moderation.mute.role)
+        serverSettingsDescription +=
+            (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: [
-            new EmojiEmbed()
-                .setEmoji("PUNISH.MUTE.GREEN")
-                .setTitle("Mute")
-                .setDescription("How long should the user be muted")
-                .setStatus("Success")
-        ], 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 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 MessageActionRow().addComponents([
-                new Discord.MessageButton()
-                    .setCustomId("cancel")
-                    .setLabel("Cancel")
-                    .setStyle("DANGER")
-                    .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-            ])
-        ], ephemeral: true, fetchReply: true}) as Message;
+        const m = (await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("PUNISH.MUTE.GREEN")
+                    .setTitle("Mute")
+                    .setDescription("How long should the user be muted")
+                    .setStatus("Success")
+            ],
+            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 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 MessageActionRow().addComponents([
+                    new Discord.MessageButton()
+                        .setCustomId("cancel")
+                        .setLabel("Cancel")
+                        .setStyle("DANGER")
+                        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                ])
+            ],
+            ephemeral: true,
+            fetchReply: true
+        })) as Message;
         let component;
         try {
-            component = await m.awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
-        } catch { return; }
+            component = await m.awaitMessageComponent({
+                filter: (m) => m.user.id === interaction.user.id,
+                time: 300000
+            });
+        } catch {
+            return;
+        }
         component.deferUpdate();
-        if (component.customId === "cancel") return interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("PUNISH.MUTE.RED")
-            .setTitle("Mute")
-            .setDescription("Mute cancelled")
-            .setStatus("Danger")
-        ]});
+        if (component.customId === "cancel")
+            return interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("PUNISH.MUTE.RED")
+                        .setTitle("Mute")
+                        .setDescription("Mute cancelled")
+                        .setStatus("Danger")
+                ]
+            });
         switch (component.customId) {
-        case "1m": { muteTime = 60; break; }
-        case "10m": { muteTime = 60 * 10; break; }
-        case "30m": { muteTime = 60 * 30; break; }
-        case "1h": { muteTime = 60 * 60; break; }
-        case "6h": { muteTime = 60 * 60 * 6; break; }
-        case "12h": { muteTime = 60 * 60 * 12; break; }
-        case "1d": { muteTime = 60 * 60 * 24; break; }
-        case "1w": { muteTime = 60 * 60 * 24 * 7; break; }
+            case "1m": {
+                muteTime = 60;
+                break;
+            }
+            case "10m": {
+                muteTime = 60 * 10;
+                break;
+            }
+            case "30m": {
+                muteTime = 60 * 30;
+                break;
+            }
+            case "1h": {
+                muteTime = 60 * 60;
+                break;
+            }
+            case "6h": {
+                muteTime = 60 * 60 * 6;
+                break;
+            }
+            case "12h": {
+                muteTime = 60 * 60 * 12;
+                break;
+            }
+            case "1d": {
+                muteTime = 60 * 60 * 24;
+                break;
+            }
+            case "1w": {
+                muteTime = 60 * 60 * 24 * 7;
+                break;
+            }
         }
     } else {
-        await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
+        await interaction.reply({
+            embeds: LoadingEmbed,
+            ephemeral: true,
+            fetchReply: true
+        });
     }
     // TODO:[Modals] Replace this with a modal
     let reason = null;
@@ -118,20 +224,47 @@
         confirmation = await new confirmationMessage(interaction)
             .setEmoji("PUNISH.MUTE.RED")
             .setTitle("Mute")
-            .setDescription(keyValueList({
-                "user": renderUser(user.user),
-                "time": `${humanizeDuration(muteTime * 1000, {round: true})}`,
-                "reason": reason ?  ("\n> " + ((reason ?? "").replaceAll("\n", "\n> "))) : "*No reason provided*"
-            })
-            + "The user will be " + serverSettingsDescription + "\n"
-            + `The user **will${notify ? "" : " not"}** be notified\n\n`
-            + `Are you sure you want to mute <@!${user.id}>?`)
+            .setDescription(
+                keyValueList({
+                    user: renderUser(user.user),
+                    time: `${humanizeDuration(muteTime * 1000, {
+                        round: true
+                    })}`,
+                    reason: reason
+                        ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ")
+                        : "*No reason provided*"
+                }) +
+                    "The user will be " +
+                    serverSettingsDescription +
+                    "\n" +
+                    `The user **will${notify ? "" : " not"}** be notified\n\n` +
+                    `Are you sure you want to mute <@!${user.id}>?`
+            )
             .setColor("Danger")
             .addCustomBoolean(
-                "appeal", "Create appeal ticket", !(await areTicketsEnabled(interaction.guild.id)),
-                async () => await create(interaction.guild, interaction.options.getUser("user"), interaction.user, reason),
-                "An appeal ticket will be created when Confirm is clicked", "CONTROL.TICKET", createAppealTicket)
-            .addCustomBoolean("notify", "Notify user", false, null, null, "ICONS.NOTIFY." + (notify ? "ON" : "OFF" ), notify)
+                "appeal",
+                "Create appeal ticket",
+                !(await areTicketsEnabled(interaction.guild.id)),
+                async () =>
+                    await create(
+                        interaction.guild,
+                        interaction.options.getUser("user"),
+                        interaction.user,
+                        reason
+                    ),
+                "An appeal ticket will be created when Confirm is clicked",
+                "CONTROL.TICKET",
+                createAppealTicket
+            )
+            .addCustomBoolean(
+                "notify",
+                "Notify user",
+                false,
+                null,
+                null,
+                "ICONS.NOTIFY." + (notify ? "ON" : "OFF"),
+                notify
+            )
             .addReasonButton(reason ?? "")
             .send(true);
         reason = reason ?? "";
@@ -150,69 +283,135 @@
         try {
             if (notify) {
                 dm = await user.send({
-                    embeds: [new EmojiEmbed()
-                        .setEmoji("PUNISH.MUTE.RED")
-                        .setTitle("Muted")
-                        .setDescription(`You have been muted in ${interaction.guild.name}` +
-                                    (reason ? ` 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}:R>)`) +
-                                    (confirmation.components.appeal.response ? `You can appeal this here: <#${confirmation.components.appeal.response}>` : ""))
-                        .setStatus("Danger")
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("PUNISH.MUTE.RED")
+                            .setTitle("Muted")
+                            .setDescription(
+                                `You have been muted in ${interaction.guild.name}` +
+                                    (reason
+                                        ? ` 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
+                                          }:R>)`) +
+                                    (confirmation.components.appeal.response
+                                        ? `You can appeal this here: <#${confirmation.components.appeal.response}>`
+                                        : "")
+                            )
+                            .setStatus("Danger")
                     ],
-                    components: [new MessageActionRow().addComponents(config.moderation.mute.text ? [new MessageButton()
-                        .setStyle("LINK")
-                        .setLabel(config.moderation.mute.text)
-                        .setURL(config.moderation.mute.link)
-                    ] : [])]
+                    components: [
+                        new MessageActionRow().addComponents(
+                            config.moderation.mute.text
+                                ? [
+                                      new MessageButton()
+                                          .setStyle("LINK")
+                                          .setLabel(config.moderation.mute.text)
+                                          .setURL(config.moderation.mute.link)
+                                  ]
+                                : []
+                        )
+                    ]
                 });
                 dmd = true;
             }
-        } catch { dmd = false; }
+        } catch {
+            dmd = false;
+        }
         const member = user;
         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("naturalUnmute", new Date().getTime() + muteTime * 1000, {
-                        guild: interaction.guild.id,
-                        user: user.id,
-                        expires: new Date().getTime() + muteTime * 1000
-                    });
+                    await client.database.eventScheduler.schedule(
+                        "naturalUnmute",
+                        new Date().getTime() + muteTime * 1000,
+                        {
+                            guild: interaction.guild.id,
+                            user: user.id,
+                            expires: new Date().getTime() + muteTime * 1000
+                        }
+                    );
                 }
             }
-        } catch { errors++; }
+        } catch {
+            errors++;
+        }
         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); errors++; }
+        } catch (e) {
+            console.log(e);
+            errors++;
+        }
         if (errors === 2) {
-            await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("PUNISH.MUTE.RED")
-                .setTitle("Mute")
-                .setDescription("Something went wrong and the user was not muted")
-                .setStatus("Danger")
-            ], components: []}); // TODO: make this clearer
+            await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("PUNISH.MUTE.RED")
+                        .setTitle("Mute")
+                        .setDescription(
+                            "Something went wrong and the user was not muted"
+                        )
+                        .setStatus("Danger")
+                ],
+                components: []
+            }); // TODO: make this clearer
             if (dmd) await dm.delete();
             return;
         }
-        await client.database.history.create("mute", interaction.guild.id, member.user, interaction.user, reason);
-        const failed = (dmd === false && notify);
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji(`PUNISH.MUTE.${failed ? "YELLOW" : "GREEN"}`)
-            .setTitle("Mute")
-            .setDescription("The member was muted" + (failed ? ", but could not be notified" : "") + (confirmation.components.appeal.response ? ` and an appeal ticket was opened in <#${confirmation.components.appeal.response}>` : ""))
-            .setStatus(failed ? "Warning" : "Success")
-        ], components: []});
+        await client.database.history.create(
+            "mute",
+            interaction.guild.id,
+            member.user,
+            interaction.user,
+            reason
+        );
+        const failed = !dmd && notify;
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji(`PUNISH.MUTE.${failed ? "YELLOW" : "GREEN"}`)
+                    .setTitle("Mute")
+                    .setDescription(
+                        "The member was muted" +
+                            (failed ? ", but could not be notified" : "") +
+                            (confirmation.components.appeal.response
+                                ? ` and an appeal ticket was opened in <#${confirmation.components.appeal.response}>`
+                                : "")
+                    )
+                    .setStatus(failed ? "Warning" : "Success")
+            ],
+            components: []
+        });
         const data = {
-            meta:{
+            meta: {
                 type: "memberMute",
                 displayName: "Member Muted",
                 calculateType: "guildMemberPunish",
@@ -223,9 +422,18 @@
             list: {
                 memberId: entry(member.user.id, `\`${member.user.id}\``),
                 name: entry(member.user.id, renderUser(member.user)),
-                mutedUntil: entry(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)),
+                mutedUntil: entry(
+                    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)
+                ),
                 reason: entry(reason, reason ? reason : "*No reason provided*")
             },
             hidden: {
@@ -234,39 +442,49 @@
         };
         log(data);
     } else {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("PUNISH.MUTE.GREEN")
-            .setTitle("Mute")
-            .setDescription("No changes were made")
-            .setStatus("Success")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("PUNISH.MUTE.GREEN")
+                    .setTitle("Mute")
+                    .setDescription("No changes were made")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
     }
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as GuildMember);
-    const me = (interaction.guild.me as GuildMember);
-    const apply = (interaction.options.getMember("user") as GuildMember);
-    if (member === null || me === null || apply === null) throw "That member is not in the server";
+    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";
     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;
 };
 
-export { command, callback, check };
\ No newline at end of file
+export { command, callback, check };
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index 06fab47..c3d6b33 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -9,10 +9,22 @@
     builder
         .setName("nick")
         .setDescription("Changes a users nickname")
-        .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));
+        .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)
+        );
 
-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;
@@ -21,14 +33,35 @@
         confirmation = await new confirmationMessage(interaction)
             .setEmoji("PUNISH.NICKNAME.RED")
             .setTitle("Nickname")
-            .setDescription(keyValueList({
-                "user": renderUser(interaction.options.getUser("user")),
-                "new 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}>'s nickname?`)
+            .setDescription(
+                keyValueList({
+                    user: renderUser(interaction.options.getUser("user")),
+                    "new 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
+                    }>'s nickname?`
+            )
             .setColor("Danger")
-            .addCustomBoolean("notify", "Notify user", false, null, null, "ICONS.NOTIFY." + (notify ? "ON" : "OFF" ), notify)
+            .addCustomBoolean(
+                "notify",
+                "Notify user",
+                false,
+                null,
+                null,
+                "ICONS.NOTIFY." + (notify ? "ON" : "OFF"),
+                notify
+            )
             .send(interaction.options.getString("name") !== null);
         if (confirmation.cancelled) return;
         if (confirmation.success) break;
@@ -41,28 +74,53 @@
         let dm;
         try {
             if (notify) {
-                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"} in ${interaction.guild.name}.` +
-                                    (interaction.options.getString("name") ? ` it is now: ${interaction.options.getString("name")}` : "") + "\n\n" +
-                                    (confirmation.components.appeal.response ? `You can appeal this here: <#${confirmation.components.appeal.response}>` : ""))
-                        .setStatus("Danger")
+                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"
+                                } in ${interaction.guild.name}.` +
+                                    (interaction.options.getString("name")
+                                        ? ` it is now: ${interaction.options.getString(
+                                              "name"
+                                          )}`
+                                        : "") +
+                                    "\n\n" +
+                                    (confirmation.components.appeal.response
+                                        ? `You can appeal this here: <#${confirmation.components.appeal.response}>`
+                                        : "")
+                            )
+                            .setStatus("Danger")
                     ]
                 });
                 dmd = true;
             }
-        } catch { dmd = false; }
+        } catch {
+            dmd = false;
+        }
         try {
-            const member = (interaction.options.getMember("user") as GuildMember);
+            const member = interaction.options.getMember("user") as GuildMember;
             const before = member.nickname;
             const nickname = interaction.options.getString("name");
             member.setNickname(nickname ?? null, "Nucleus Nickname command");
             await client.database.history.create(
-                "nickname", interaction.guild.id, member.user, interaction.user,
-                null, before, nickname);
-            const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
+                "nickname",
+                interaction.guild.id,
+                member.user,
+                interaction.user,
+                null,
+                before,
+                nickname
+            );
+            const { log, NucleusColors, entry, renderUser, renderDelta } =
+                client.logger;
             const data = {
                 meta: {
                     type: "memberUpdate",
@@ -76,8 +134,14 @@
                     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
@@ -85,56 +149,82 @@
             };
             log(data);
         } catch {
-            await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("PUNISH.NICKNAME.RED")
-                .setTitle("Nickname")
-                .setDescription("Something went wrong and the users nickname could not be changed.")
-                .setStatus("Danger")
-            ], components: []});
+            await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("PUNISH.NICKNAME.RED")
+                        .setTitle("Nickname")
+                        .setDescription(
+                            "Something went wrong and the users nickname could not be changed."
+                        )
+                        .setStatus("Danger")
+                ],
+                components: []
+            });
             if (dmd) await dm.delete();
             return;
         }
-        const failed = (dmd === false && notify);
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji(`PUNISH.NICKNAME.${failed ? "YELLOW" : "GREEN"}`)
-            .setTitle("Nickname")
-            .setDescription("The members nickname was changed" + (failed ? ", but was not notified" : "") + (confirmation.components.appeal.response ? ` and an appeal ticket was opened in <#${confirmation.components.appeal.response}>` : ""))
-            .setStatus(failed ? "Warning" : "Success")
-        ], components: []});
+        const failed = !dmd && notify;
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji(`PUNISH.NICKNAME.${failed ? "YELLOW" : "GREEN"}`)
+                    .setTitle("Nickname")
+                    .setDescription(
+                        "The members nickname was changed" +
+                            (failed ? ", but was not notified" : "") +
+                            (confirmation.components.appeal.response
+                                ? ` and an appeal ticket was opened in <#${confirmation.components.appeal.response}>`
+                                : "")
+                    )
+                    .setStatus(failed ? "Warning" : "Success")
+            ],
+            components: []
+        });
     } else {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("PUNISH.NICKNAME.GREEN")
-            .setTitle("Nickname")
-            .setDescription("No changes were made")
-            .setStatus("Success")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("PUNISH.NICKNAME.GREEN")
+                    .setTitle("Nickname")
+                    .setDescription("No changes were made")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
     }
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as GuildMember);
-    const me = (interaction.guild.me as GuildMember);
-    const apply = (interaction.options.getMember("user") as GuildMember);
-    if (member === null || me === null || apply === null) throw "That member is not in the server";
+    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";
     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;
 };
 
-export { command, callback, check };
\ No newline at end of file
+export { command, callback, check };
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index c554ee7..b78c423 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -1,4 +1,9 @@
-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";
@@ -10,19 +15,41 @@
     builder
         .setName("purge")
         .setDescription("Bulk deletes messages in a channel")
-        .addIntegerOption(option => option
-            .setName("amount")
-            .setDescription("The amount of messages to delete")
-            .setRequired(false)
-            .setMinValue(1)
-            .setMaxValue(100))
-        .addUserOption(option => 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));
+        .addIntegerOption((option) =>
+            option
+                .setName("amount")
+                .setDescription("The amount of messages to delete")
+                .setRequired(false)
+                .setMinValue(1)
+                .setMaxValue(100)
+        )
+        .addUserOption((option) =>
+            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)
+        );
 
-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()))) {
+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())
+    ) {
         return await interaction.reply({
             embeds: [
                 new EmojiEmbed()
@@ -36,7 +63,7 @@
         });
     }
     // TODO:[Modals] Replace this with a modal
-    if ( !interaction.options.getInteger("amount") ) {
+    if (!interaction.options.getInteger("amount")) {
         await interaction.reply({
             embeds: [
                 new EmojiEmbed()
@@ -51,12 +78,14 @@
         });
         let deleted = [] as Discord.Message[];
         while (true) {
-            const m = await interaction.editReply({
+            const m = (await interaction.editReply({
                 embeds: [
                     new EmojiEmbed()
                         .setEmoji("CHANNEL.PURGE.RED")
                         .setTitle("Purge")
-                        .setDescription("Select how many messages to delete. You can continue clicking until all messages are cleared.")
+                        .setDescription(
+                            "Select how many messages to delete. You can continue clicking until all messages are cleared."
+                        )
                         .setStatus("Danger")
                 ],
                 components: [
@@ -96,40 +125,64 @@
                             .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
                     ])
                 ]
-            }) as Discord.Message;
+            })) as Discord.Message;
             let component;
             try {
-                component = m.awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
-            } catch (e) { break; }
+                component = m.awaitMessageComponent({
+                    filter: (m) => m.user.id === interaction.user.id,
+                    time: 300000
+                });
+            } catch (e) {
+                break;
+            }
             component.deferUpdate();
             if (component.customId === "done") break;
             let amount;
-            try { amount = parseInt(component.customId); } catch { break; }
+            try {
+                amount = parseInt(component.customId);
+            } catch {
+                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));
+                deleted = deleted.concat(messages.map((m) => m));
             }
         }
-        if (deleted.length === 0) return await interaction.editReply({
-            embeds: [
-                new EmojiEmbed()
-                    .setEmoji("CHANNEL.PURGE.RED")
-                    .setTitle("Purge")
-                    .setDescription("No messages were deleted")
-                    .setStatus("Danger")
-            ],
-            components: []
-        });
+        if (deleted.length === 0)
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("CHANNEL.PURGE.RED")
+                        .setTitle("Purge")
+                        .setDescription("No messages were deleted")
+                        .setStatus("Danger")
+                ],
+                components: []
+            });
         if (user) {
-            await client.database.history.create("purge", interaction.guild.id, user, interaction.options.getString("reason"), null, null, deleted.length);
+            await client.database.history.create(
+                "purge",
+                interaction.guild.id,
+                user,
+                interaction.options.getString("reason"),
+                null,
+                null,
+                deleted.length
+            );
         }
-        const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
+        const { log, NucleusColors, entry, renderUser, renderChannel } =
+            client.logger;
         const data = {
             meta: {
                 type: "channelPurge",
@@ -140,9 +193,18 @@
                 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: {
@@ -151,10 +213,16 @@
         };
         log(data);
         let out = "";
-        deleted.reverse().forEach(message => {
-            out += `${message.author.username}#${message.author.discriminator} (${message.author.id}) [${new Date(message.createdTimestamp).toISOString()}]\n`;
+        deleted.reverse().forEach((message) => {
+            out += `${message.author.username}#${
+                message.author.discriminator
+            } (${message.author.id}) [${new Date(
+                message.createdTimestamp
+            ).toISOString()}]\n`;
             const lines = message.content.split("\n");
-            lines.forEach(line => {out += `> ${line}\n`;});
+            lines.forEach((line) => {
+                out += `> ${line}\n`;
+            });
             out += "\n\n";
         });
         const attachmentObject = {
@@ -162,47 +230,73 @@
             name: `purge-${channel.id}-${Date.now()}.txt`,
             description: "Purge log"
         };
-        const m = await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("CHANNEL.PURGE.GREEN")
-            .setTitle("Purge")
-            .setDescription("Messages cleared")
-            .setStatus("Success")
-        ], components: [new Discord.MessageActionRow().addComponents([
-            new Discord.MessageButton()
-                .setCustomId("download")
-                .setLabel("Download transcript")
-                .setStyle("SUCCESS")
-                .setEmoji(getEmojiByName("CONTROL.DOWNLOAD", "id"))
-        ])]}) as Discord.Message;
+        const m = (await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("CHANNEL.PURGE.GREEN")
+                    .setTitle("Purge")
+                    .setDescription("Messages cleared")
+                    .setStatus("Success")
+            ],
+            components: [
+                new Discord.MessageActionRow().addComponents([
+                    new Discord.MessageButton()
+                        .setCustomId("download")
+                        .setLabel("Download transcript")
+                        .setStyle("SUCCESS")
+                        .setEmoji(getEmojiByName("CONTROL.DOWNLOAD", "id"))
+                ])
+            ]
+        })) as Discord.Message;
         let component;
         try {
-            component = await m.awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
-        } catch { return; }
+            component = await m.awaitMessageComponent({
+                filter: (m) => m.user.id === interaction.user.id,
+                time: 300000
+            });
+        } catch {
+            return;
+        }
         if (component && component.customId === "download") {
-            interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("CHANNEL.PURGE.GREEN")
-                .setTitle("Purge")
-                .setDescription("Uploaded")
-                .setStatus("Success")
-            ], components: [], files: [attachmentObject]});
+            interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("CHANNEL.PURGE.GREEN")
+                        .setTitle("Purge")
+                        .setDescription("Uploaded")
+                        .setStatus("Success")
+                ],
+                components: [],
+                files: [attachmentObject]
+            });
         } else {
-            interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("CHANNEL.PURGE.GREEN")
-                .setTitle("Purge")
-                .setDescription("Messages cleared")
-                .setStatus("Success")
-            ], components: []});
+            interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("CHANNEL.PURGE.GREEN")
+                        .setTitle("Purge")
+                        .setDescription("Messages cleared")
+                        .setStatus("Success")
+                ],
+                components: []
+            });
         }
         return;
     } else {
         const confirmation = await new confirmationMessage(interaction)
             .setEmoji("CHANNEL.PURGE.RED")
             .setTitle("Purge")
-            .setDescription(keyValueList({
-                "channel": `<#${channel.id}>`,
-                "amount": interaction.options.getInteger("amount").toString(),
-                "reason": `\n> ${interaction.options.getString("reason") ? interaction.options.getString("reason") : "*No reason provided*"}`
-            }))
+            .setDescription(
+                keyValueList({
+                    channel: `<#${channel.id}>`,
+                    amount: interaction.options.getInteger("amount").toString(),
+                    reason: `\n> ${
+                        interaction.options.getString("reason")
+                            ? interaction.options.getString("reason")
+                            : "*No reason provided*"
+                    }`
+                })
+            )
             .setColor("Danger")
             .send();
         if (confirmation.cancelled) return;
@@ -210,25 +304,57 @@
             let messages;
             try {
                 if (!user) {
-                    const toDelete = await (interaction.channel as TextChannel).messages.fetch({limit: interaction.options.getInteger("amount")});
-                    messages = await (channel as TextChannel).bulkDelete(toDelete, true);
+                    const toDelete = await (
+                        interaction.channel as TextChannel
+                    ).messages.fetch({
+                        limit: interaction.options.getInteger("amount")
+                    });
+                    messages = await (channel as TextChannel).bulkDelete(
+                        toDelete,
+                        true
+                    );
                 } else {
-                    const toDelete = (await (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);
+                    const toDelete = (
+                        await (
+                            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
+                    );
                 }
-            } catch(e) {
-                await interaction.editReply({embeds: [new EmojiEmbed()
-                    .setEmoji("CHANNEL.PURGE.RED")
-                    .setTitle("Purge")
-                    .setDescription("Something went wrong and no messages were deleted")
-                    .setStatus("Danger")
-                ], components: []});
+            } catch (e) {
+                await interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("CHANNEL.PURGE.RED")
+                            .setTitle("Purge")
+                            .setDescription(
+                                "Something went wrong and no messages were deleted"
+                            )
+                            .setStatus("Danger")
+                    ],
+                    components: []
+                });
             }
             if (user) {
-                await client.database.history.create("purge", interaction.guild.id, user, interaction.options.getString("reason"), null, null, messages.size);
+                await client.database.history.create(
+                    "purge",
+                    interaction.guild.id,
+                    user,
+                    interaction.options.getString("reason"),
+                    null,
+                    null,
+                    messages.size
+                );
             }
-            const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
+            const { log, NucleusColors, entry, renderUser, renderChannel } =
+                client.logger;
             const data = {
                 meta: {
                     type: "channelPurge",
@@ -239,9 +365,18 @@
                     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: {
@@ -250,10 +385,16 @@
             };
             log(data);
             let out = "";
-            messages.reverse().forEach(message => {
-                out += `${message.author.username}#${message.author.discriminator} (${message.author.id}) [${new Date(message.createdTimestamp).toISOString()}]\n`;
+            messages.reverse().forEach((message) => {
+                out += `${message.author.username}#${
+                    message.author.discriminator
+                } (${message.author.id}) [${new Date(
+                    message.createdTimestamp
+                ).toISOString()}]\n`;
                 const lines = message.content.split("\n");
-                lines.forEach(line => {out += `> ${line}\n`;});
+                lines.forEach((line) => {
+                    out += `> ${line}\n`;
+                });
                 out += "\n\n";
             });
             const attachmentObject = {
@@ -261,59 +402,85 @@
                 name: `purge-${channel.id}-${Date.now()}.txt`,
                 description: "Purge log"
             };
-            const m = await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("CHANNEL.PURGE.GREEN")
-                .setTitle("Purge")
-                .setDescription("Messages cleared")
-                .setStatus("Success")
-            ], components: [new Discord.MessageActionRow().addComponents([
-                new Discord.MessageButton()
-                    .setCustomId("download")
-                    .setLabel("Download transcript")
-                    .setStyle("SUCCESS")
-                    .setEmoji(getEmojiByName("CONTROL.DOWNLOAD", "id"))
-            ])]}) as Discord.Message;
+            const m = (await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("CHANNEL.PURGE.GREEN")
+                        .setTitle("Purge")
+                        .setDescription("Messages cleared")
+                        .setStatus("Success")
+                ],
+                components: [
+                    new Discord.MessageActionRow().addComponents([
+                        new Discord.MessageButton()
+                            .setCustomId("download")
+                            .setLabel("Download transcript")
+                            .setStyle("SUCCESS")
+                            .setEmoji(getEmojiByName("CONTROL.DOWNLOAD", "id"))
+                    ])
+                ]
+            })) as Discord.Message;
             let component;
             try {
-                component = await m.awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
-            } catch { return; }
+                component = await m.awaitMessageComponent({
+                    filter: (m) => m.user.id === interaction.user.id,
+                    time: 300000
+                });
+            } catch {
+                return;
+            }
             if (component && component.customId === "download") {
-                interaction.editReply({embeds: [new EmojiEmbed()
-                    .setEmoji("CHANNEL.PURGE.GREEN")
-                    .setTitle("Purge")
-                    .setDescription("Transcript uploaded above")
-                    .setStatus("Success")
-                ], components: [], files: [attachmentObject]});
+                interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("CHANNEL.PURGE.GREEN")
+                            .setTitle("Purge")
+                            .setDescription("Transcript uploaded above")
+                            .setStatus("Success")
+                    ],
+                    components: [],
+                    files: [attachmentObject]
+                });
             } else {
-                interaction.editReply({embeds: [new EmojiEmbed()
-                    .setEmoji("CHANNEL.PURGE.GREEN")
-                    .setTitle("Purge")
-                    .setDescription("Messages cleared")
-                    .setStatus("Success")
-                ], components: []});
+                interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("CHANNEL.PURGE.GREEN")
+                            .setTitle("Purge")
+                            .setDescription("Messages cleared")
+                            .setStatus("Success")
+                    ],
+                    components: []
+                });
             }
         } else {
-            await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("CHANNEL.PURGE.GREEN")
-                .setTitle("Purge")
-                .setDescription("No changes were made")
-                .setStatus("Success")
-            ], components: []});
+            await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("CHANNEL.PURGE.GREEN")
+                        .setTitle("Purge")
+                        .setDescription("No changes were made")
+                        .setStatus("Success")
+                ],
+                components: []
+            });
         }
     }
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as GuildMember);
-    const me = (interaction.guild.me as GuildMember);
+    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;
 };
 
-export { command, callback, check };
\ No newline at end of file
+export { command, callback, check };
diff --git a/src/commands/mod/slowmode.ts b/src/commands/mod/slowmode.ts
index 7e8b8a2..1a06db1 100644
--- a/src/commands/mod/slowmode.ts
+++ b/src/commands/mod/slowmode.ts
@@ -5,29 +5,51 @@
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 
-
 const command = (builder: SlashCommandSubcommandBuilder) =>
     builder
         .setName("slowmode")
         .setDescription("Manages slowmode in a channel")
-        .addStringOption(option => option.setName("time").setDescription("The delay between messages").setRequired(false).addChoices([
-            ["Off", "0"],
-            ["5 seconds", "5"], ["10 seconds", "10"], ["15 seconds", "15"], ["30 seconds", "30"],
-            ["1 minute", "60"], ["2 minutes", "120"], ["5 minutes", "300"], ["10 minutes", "600"],
-            ["15 minutes", "900"], ["30 minutes", "1800"],
-            ["1 hour", "3600"], ["2 hours", "7200"], ["6 hours", "21600"]
-        ]));
+        .addStringOption((option) =>
+            option
+                .setName("time")
+                .setDescription("The delay between messages")
+                .setRequired(false)
+                .addChoices([
+                    ["Off", "0"],
+                    ["5 seconds", "5"],
+                    ["10 seconds", "10"],
+                    ["15 seconds", "15"],
+                    ["30 seconds", "30"],
+                    ["1 minute", "60"],
+                    ["2 minutes", "120"],
+                    ["5 minutes", "300"],
+                    ["10 minutes", "600"],
+                    ["15 minutes", "900"],
+                    ["30 minutes", "1800"],
+                    ["1 hour", "3600"],
+                    ["2 hours", "7200"],
+                    ["6 hours", "21600"]
+                ])
+        );
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     let time = parseInt(interaction.options.getString("time") ?? "0");
-    if (time === 0 && (interaction.channel as TextChannel).rateLimitPerUser === 0) { time = 10; }
+    if (
+        time === 0 &&
+        (interaction.channel as TextChannel).rateLimitPerUser === 0
+    ) {
+        time = 10;
+    }
     const confirmation = await new confirmationMessage(interaction)
         .setEmoji("CHANNEL.SLOWMODE.OFF")
         .setTitle("Slowmode")
-        .setDescription(keyValueList({
-            "time": time ? humanizeDuration(time * 1000, { round: true }) : "No delay"
-        })
-        + "Are you sure you want to set the slowmode in this channel?")
+        .setDescription(
+            keyValueList({
+                time: time
+                    ? humanizeDuration(time * 1000, { round: true })
+                    : "No delay"
+            }) + "Are you sure you want to set the slowmode in this channel?"
+        )
         .setColor("Danger")
         .send();
     if (confirmation.cancelled) return;
@@ -35,37 +57,53 @@
         try {
             (interaction.channel as TextChannel).setRateLimitPerUser(time);
         } catch (e) {
-            await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("CHANNEL.SLOWMODE.OFF")
-                .setTitle("Slowmode")
-                .setDescription("Something went wrong while setting the slowmode")
-                .setStatus("Danger")
-            ], components: []});
+            await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("CHANNEL.SLOWMODE.OFF")
+                        .setTitle("Slowmode")
+                        .setDescription(
+                            "Something went wrong while setting the slowmode"
+                        )
+                        .setStatus("Danger")
+                ],
+                components: []
+            });
         }
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("CHANNEL.SLOWMODE.ON")
-            .setTitle("Slowmode")
-            .setDescription("The channel slowmode was set successfully")
-            .setStatus("Success")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("CHANNEL.SLOWMODE.ON")
+                    .setTitle("Slowmode")
+                    .setDescription("The channel slowmode was set successfully")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
     } else {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("CHANNEL.SLOWMODE.ON")
-            .setTitle("Slowmode")
-            .setDescription("No changes were made")
-            .setStatus("Success")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("CHANNEL.SLOWMODE.ON")
+                    .setTitle("Slowmode")
+                    .setDescription("No changes were made")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
     }
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as GuildMember);
+    const member = interaction.member as GuildMember;
     // Check if Nucleus can set the slowmode
-    if (! interaction.guild.me.permissions.has("MANAGE_CHANNELS")) throw "I do not have the *Manage Channels* permission";
+    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;
 };
 
-export { command, callback, check };
\ No newline at end of file
+export { command, callback, check };
diff --git a/src/commands/mod/softban.ts b/src/commands/mod/softban.ts
index d0dc9bb..f3c475e 100644
--- a/src/commands/mod/softban.ts
+++ b/src/commands/mod/softban.ts
@@ -1,4 +1,9 @@
-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";
@@ -10,10 +15,24 @@
     builder
         .setName("softban")
         .setDescription("Kicks a user and deletes their messages")
-        .addUserOption(option => option.setName("user").setDescription("The user to softban").setRequired(true))
-        .addIntegerOption(option => option.setName("delete").setDescription("The days of messages to delete | Default: 0").setMinValue(0).setMaxValue(7).setRequired(false));
+        .addUserOption((option) =>
+            option
+                .setName("user")
+                .setDescription("The user to softban")
+                .setRequired(true)
+        )
+        .addIntegerOption((option) =>
+            option
+                .setName("delete")
+                .setDescription("The days of messages to delete | Default: 0")
+                .setMinValue(0)
+                .setMaxValue(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;
@@ -23,15 +42,35 @@
         const confirmation = await new confirmationMessage(interaction)
             .setEmoji("PUNISH.BAN.RED")
             .setTitle("Softban")
-            .setDescription(keyValueList({
-                "user": renderUser(interaction.options.getUser("user")),
-                "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, "day")} of messages will be deleted\n\n`
-            + `Are you sure you want to softban <@!${(interaction.options.getMember("user") as GuildMember).id}>?`)
+            .setDescription(
+                keyValueList({
+                    user: renderUser(interaction.options.getUser("user")),
+                    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,
+                        "day"
+                    )} of messages will be deleted\n\n` +
+                    `Are you sure you want to softban <@!${
+                        (interaction.options.getMember("user") as GuildMember)
+                            .id
+                    }>?`
+            )
             .setColor("Danger")
-            .addCustomBoolean("notify", "Notify user", false, null, null, "ICONS.NOTIFY." + (notify ? "ON" : "OFF" ), notify)
+            .addCustomBoolean(
+                "notify",
+                "Notify user",
+                false,
+                null,
+                null,
+                "ICONS.NOTIFY." + (notify ? "ON" : "OFF"),
+                notify
+            )
             .addReasonButton(reason ?? "")
             .send(reason !== null);
         reason = reason ?? "";
@@ -47,24 +86,38 @@
         const config = await client.database.guilds.read(interaction.guild.id);
         try {
             if (notify) {
-                await (interaction.options.getMember("user") as GuildMember).send({
-                    embeds: [new EmojiEmbed()
-                        .setEmoji("PUNISH.BAN.RED")
-                        .setTitle("Softbanned")
-                        .setDescription(`You have been softbanned from ${interaction.guild.name}` +
-                                    (reason ? ` for:\n> ${reason}` : "."))
-                        .setStatus("Danger")
+                await (
+                    interaction.options.getMember("user") as GuildMember
+                ).send({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("PUNISH.BAN.RED")
+                            .setTitle("Softbanned")
+                            .setDescription(
+                                `You have been softbanned from ${interaction.guild.name}` +
+                                    (reason ? ` for:\n> ${reason}` : ".")
+                            )
+                            .setStatus("Danger")
                     ],
-                    components: [new MessageActionRow().addComponents(config.moderation.ban.text ? [new MessageButton()
-                        .setStyle("LINK")
-                        .setLabel(config.moderation.ban.text)
-                        .setURL(config.moderation.ban.link)
-                    ] : [])]
+                    components: [
+                        new MessageActionRow().addComponents(
+                            config.moderation.ban.text
+                                ? [
+                                      new MessageButton()
+                                          .setStyle("LINK")
+                                          .setLabel(config.moderation.ban.text)
+                                          .setURL(config.moderation.ban.link)
+                                  ]
+                                : []
+                        )
+                    ]
                 });
                 dmd = true;
             }
-        } catch { dmd = false;}
-        const member = (interaction.options.getMember("user") as GuildMember);
+        } catch {
+            dmd = false;
+        }
+        const member = interaction.options.getMember("user") as GuildMember;
         try {
             await member.ban({
                 days: Number(interaction.options.getInteger("delete") ?? 0),
@@ -72,55 +125,83 @@
             });
             await interaction.guild.members.unban(member, "Softban");
         } catch {
-            await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("PUNISH.BAN.RED")
-                .setTitle("Softban")
-                .setDescription("Something went wrong and the user was not softbanned")
-                .setStatus("Danger")
-            ], components: []});
+            await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("PUNISH.BAN.RED")
+                        .setTitle("Softban")
+                        .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);
-        const failed = (dmd === false && 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" : ""))
-            .setStatus(failed ? "Warning" : "Success")
-        ], components: []});
+        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" : "")
+                    )
+                    .setStatus(failed ? "Warning" : "Success")
+            ],
+            components: []
+        });
     } else {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("PUNISH.BAN.GREEN")
-            .setTitle("Softban")
-            .setDescription("No changes were made")
-            .setStatus("Success")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("PUNISH.BAN.GREEN")
+                    .setTitle("Softban")
+                    .setDescription("No changes were made")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
     }
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as GuildMember);
-    const me = (interaction.guild.me as GuildMember);
-    const apply = (interaction.options.getMember("user") as GuildMember);
-    if (member === null || me === null || apply === null) throw "That member is not in the server";
+    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";
     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;
 };
 
-export { command, callback, check };
\ No newline at end of file
+export { command, callback, check };
diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts
index 88301eb..06fe647 100644
--- a/src/commands/mod/unban.ts
+++ b/src/commands/mod/unban.ts
@@ -9,39 +9,68 @@
     builder
         .setName("unban")
         .setDescription("Unbans a user")
-        .addStringOption(option => option.setName("user").setDescription("The user to unban (Username or ID)").setRequired(true));
+        .addStringOption((option) =>
+            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());
+    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) {
-        return interaction.reply({embeds: [new EmojiEmbed()
-            .setTitle("Unban")
-            .setDescription(`Could not find any user called \`${user}\``)
-            .setEmoji("PUNISH.UNBAN.RED")
-            .setStatus("Danger")
-        ], ephemeral: true});
+        return interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Unban")
+                    .setDescription(
+                        `Could not find any user called \`${user}\``
+                    )
+                    .setEmoji("PUNISH.UNBAN.RED")
+                    .setStatus("Danger")
+            ],
+            ephemeral: true
+        });
     }
     // TODO:[Modals] Replace this with a modal
     const confirmation = await new confirmationMessage(interaction)
         .setEmoji("PUNISH.UNBAN.RED")
         .setTitle("Unban")
-        .setDescription(keyValueList({
-            "user": `${resolved.user.username} [<@${resolved.user.id}>]`
-        })
-        + `Are you sure you want to unban <@${resolved.user.id}>?`)
+        .setDescription(
+            keyValueList({
+                user: `${resolved.user.username} [<@${resolved.user.id}>]`
+            }) + `Are you sure you want to unban <@${resolved.user.id}>?`
+        )
         .setColor("Danger")
         .send();
     if (confirmation.cancelled) return;
     if (confirmation.success) {
         try {
-            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 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;
             const data = {
                 meta: {
                     type: "memberUnban",
@@ -54,9 +83,18 @@
                 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
@@ -64,40 +102,56 @@
             };
             log(data);
         } catch {
-            await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("PUNISH.UNBAN.RED")
-                .setTitle("Unban")
-                .setDescription("Something went wrong and the user was not unbanned")
-                .setStatus("Danger")
-            ], components: []});
+            await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("PUNISH.UNBAN.RED")
+                        .setTitle("Unban")
+                        .setDescription(
+                            "Something went wrong and the user was not unbanned"
+                        )
+                        .setStatus("Danger")
+                ],
+                components: []
+            });
         }
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("PUNISH.UNBAN.GREEN")
-            .setTitle("Unban")
-            .setDescription("The member was unbanned")
-            .setStatus("Success")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("PUNISH.UNBAN.GREEN")
+                    .setTitle("Unban")
+                    .setDescription("The member was unbanned")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
     } else {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("PUNISH.UNBAN.GREEN")
-            .setTitle("Unban")
-            .setDescription("No changes were made")
-            .setStatus("Success")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("PUNISH.UNBAN.GREEN")
+                    .setTitle("Unban")
+                    .setDescription("No changes were made")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
     }
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as GuildMember);
-    const me = (interaction.guild.me as GuildMember);
+    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;
 };
 
-export { command, callback, check };
\ No newline at end of file
+export { command, callback, check };
diff --git a/src/commands/mod/unmute.ts b/src/commands/mod/unmute.ts
index d4e0d75..f625461 100644
--- a/src/commands/mod/unmute.ts
+++ b/src/commands/mod/unmute.ts
@@ -9,24 +9,37 @@
     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;
     let confirmation;
     while (true) {
-        confirmation =  await new confirmationMessage(interaction)
+        confirmation = await new confirmationMessage(interaction)
             .setEmoji("PUNISH.MUTE.RED")
             .setTitle("Unmute")
-            .setDescription(keyValueList({
-                "user": renderUser(interaction.options.getUser("user")),
-                "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}>?`)
+            .setDescription(
+                keyValueList({
+                    user: renderUser(interaction.options.getUser("user")),
+                    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
+                    }>?`
+            )
             .setColor("Danger")
             .addReasonButton(reason ?? "")
             .send(reason !== null);
@@ -42,32 +55,53 @@
         let dm;
         try {
             if (notify) {
-                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."))
-                        .setStatus("Success")
+                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.")
+                            )
+                            .setStatus("Success")
                     ]
                 });
                 dmd = true;
             }
-        } catch { dmd = false; }
-        const member = (interaction.options.getMember("user") as GuildMember);
+        } catch {
+            dmd = false;
+        }
+        const member = interaction.options.getMember("user") as GuildMember;
         try {
             member.timeout(0, reason || "No reason provided");
         } catch {
-            await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("PUNISH.MUTE.RED")
-                .setTitle("Unmute")
-                .setDescription("Something went wrong and the user was not unmuted")
-                .setStatus("Danger")
-            ], components: []});
+            await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("PUNISH.MUTE.RED")
+                        .setTitle("Unmute")
+                        .setDescription(
+                            "Something went wrong and the user was not unmuted"
+                        )
+                        .setStatus("Danger")
+                ],
+                components: []
+            });
             if (dmd) await dm.delete();
             return;
         }
-        await client.database.history.create("unmute", interaction.guild.id, (interaction.options.getMember("user") as GuildMember).user, interaction.user, reason);
+        await client.database.history.create(
+            "unmute",
+            interaction.guild.id,
+            (interaction.options.getMember("user") as GuildMember).user,
+            interaction.user,
+            reason
+        );
         const data = {
             meta: {
                 type: "memberUnmute",
@@ -80,53 +114,76 @@
             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
             }
         };
         log(data);
-        const failed = (dmd === false && notify);
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji(`PUNISH.MUTE.${failed ? "YELLOW" : "GREEN"}`)
-            .setTitle("Unmute")
-            .setDescription("The member was unmuted" + (failed ? ", but could not be notified" : ""))
-            .setStatus(failed ? "Warning" : "Success")
-        ], components: []});
+        const failed = !dmd && notify;
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji(`PUNISH.MUTE.${failed ? "YELLOW" : "GREEN"}`)
+                    .setTitle("Unmute")
+                    .setDescription(
+                        "The member was unmuted" +
+                            (failed ? ", but could not be notified" : "")
+                    )
+                    .setStatus(failed ? "Warning" : "Success")
+            ],
+            components: []
+        });
     } else {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("PUNISH.MUTE.GREEN")
-            .setTitle("Unmute")
-            .setDescription("No changes were made")
-            .setStatus("Success")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("PUNISH.MUTE.GREEN")
+                    .setTitle("Unmute")
+                    .setDescription("No changes were made")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
     }
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as GuildMember);
-    const me = (interaction.guild.me as GuildMember);
-    const apply = (interaction.options.getMember("user") as GuildMember);
-    if (member === null || me === null || apply === null) throw "That member is not in the server";
+    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";
     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;
 };
 
-export { command, callback, check };
\ No newline at end of file
+export { command, callback, check };
diff --git a/src/commands/mod/viewas.ts b/src/commands/mod/viewas.ts
index ca52787..f0b2047 100644
--- a/src/commands/mod/viewas.ts
+++ b/src/commands/mod/viewas.ts
@@ -1,4 +1,11 @@
-import Discord, { CategoryChannel, CommandInteraction, GuildMember, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
+import Discord, {
+    CategoryChannel,
+    CommandInteraction,
+    GuildMember,
+    MessageActionRow,
+    MessageButton,
+    MessageSelectMenu
+} from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -8,97 +15,189 @@
     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);
+    interaction.guild.channels.cache.forEach((channel) => {
+        if (!channel.parent && channel.type !== "GUILD_CATEGORY")
+            channels.push(channel);
     });
     channels = [channels];
-    channels = channels.concat(interaction.guild.channels.cache
-        .filter(c => c.type === "GUILD_CATEGORY")
-        .map(c => (c as CategoryChannel).children.map(c => c))
+    channels = channels.concat(
+        interaction.guild.channels.cache
+            .filter((c) => c.type === "GUILD_CATEGORY")
+            .map((c) => (c as CategoryChannel).children.map((c) => c))
     );
     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)) return 1;
-        if (autoSortBelow.includes(b.type)) return -1;
-        return a.position - b.position;
-    }));
+    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)) return 1;
+            if (autoSortBelow.includes(b.type)) return -1;
+            return a.position - b.position;
+        })
+    );
     // Sort all arrays by the position of the first channels parent position
     channels = channels.sort((a, b) => {
         if (!a[0].parent) return -1;
         if (!b[0].parent) return 1;
         return a[0].parent.position - b[0].parent.position;
     });
-    const member = interaction.options.getMember("member") as Discord.GuildMember;
-    m = await interaction.reply({embeds: [new EmojiEmbed()
-        .setEmoji("MEMBER.JOIN")
-        .setTitle("Viewing as " + member.displayName)
-        .setStatus("Success")
-    ], ephemeral: true, fetchReply: true});
+    const member = interaction.options.getMember(
+        "member"
+    ) as Discord.GuildMember;
+    m = await interaction.reply({
+        embeds: [
+            new EmojiEmbed()
+                .setEmoji("MEMBER.JOIN")
+                .setTitle("Viewing as " + member.displayName)
+                .setStatus("Success")
+        ],
+        ephemeral: true,
+        fetchReply: true
+    });
     let page = 0;
     while (true) {
-        m = await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("MEMBER.JOIN")
-            .setTitle("Viewing as " + member.displayName)
-            .setStatus("Success")
-            .setDescription(
-                `**${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 ("threads" in c && c.threads.cache.size > 0) {
-                                return c.threads.cache.map(t => ` ${
-                                    getEmojiByName("ICONS.CHANNEL.THREAD_PIPE") + " " +
-                                    getEmojiByName("ICONS.CHANNEL.THREAD_CHANNEL")} ${t.name}`).join("\n") + "\n";
-                            }return "";
-                        })()) : "";
-                }).join("") + "\n" + pageIndicator(channels.length, page)
-            )
-        ], components: [
-            new MessageActionRow().addComponents([new MessageSelectMenu().setOptions(channels.map((c, index) => ({
-                label: c[0].parent ? c[0].parent.name : "Uncategorised",
-                value: index.toString(),
-                default: page === index
-            }))).setCustomId("select").setMaxValues(1).setMinValues(1).setPlaceholder("Select a category")]),
-            new MessageActionRow().addComponents([
-                new MessageButton()
-                    .setLabel(page === 0 ? "" : (channels[page - 1][0].parent ? channels[page - 1][0].parent.name : "Uncategorised"))
-                    .setDisabled(page === 0)
-                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
-                    .setStyle("PRIMARY")
-                    .setCustomId("previous"),
-                new MessageButton()
-                    .setLabel(page === channels.length - 1 ? "" : (channels[page + 1][0].parent ? channels[page + 1][0].parent.name : "Uncategorised"))
-                    .setDisabled(page === channels.length - 1)
-                    .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
-                    .setStyle("PRIMARY")
-                    .setCustomId("next")
-            ])
-        ]});
+        m = await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("MEMBER.JOIN")
+                    .setTitle("Viewing as " + member.displayName)
+                    .setStatus("Success")
+                    .setDescription(
+                        `**${
+                            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 (
+                                                      "threads" in c &&
+                                                      c.threads.cache.size > 0
+                                                  ) {
+                                                      return (
+                                                          c.threads.cache
+                                                              .map(
+                                                                  (t) =>
+                                                                      ` ${
+                                                                          getEmojiByName(
+                                                                              "ICONS.CHANNEL.THREAD_PIPE"
+                                                                          ) +
+                                                                          " " +
+                                                                          getEmojiByName(
+                                                                              "ICONS.CHANNEL.THREAD_CHANNEL"
+                                                                          )
+                                                                      } ${
+                                                                          t.name
+                                                                      }`
+                                                              )
+                                                              .join("\n") + "\n"
+                                                      );
+                                                  }
+                                                  return "";
+                                              })()
+                                        : "";
+                                })
+                                .join("") +
+                            "\n" +
+                            pageIndicator(channels.length, page)
+                    )
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageSelectMenu()
+                        .setOptions(
+                            channels.map((c, index) => ({
+                                label: c[0].parent
+                                    ? c[0].parent.name
+                                    : "Uncategorised",
+                                value: index.toString(),
+                                default: page === index
+                            }))
+                        )
+                        .setCustomId("select")
+                        .setMaxValues(1)
+                        .setMinValues(1)
+                        .setPlaceholder("Select a category")
+                ]),
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setLabel(
+                            page === 0
+                                ? ""
+                                : channels[page - 1][0].parent
+                                ? channels[page - 1][0].parent.name
+                                : "Uncategorised"
+                        )
+                        .setDisabled(page === 0)
+                        .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                        .setStyle("PRIMARY")
+                        .setCustomId("previous"),
+                    new MessageButton()
+                        .setLabel(
+                            page === channels.length - 1
+                                ? ""
+                                : channels[page + 1][0].parent
+                                ? channels[page + 1][0].parent.name
+                                : "Uncategorised"
+                        )
+                        .setDisabled(page === channels.length - 1)
+                        .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                        .setStyle("PRIMARY")
+                        .setCustomId("next")
+                ])
+            ]
+        });
         let i;
         try {
             i = await m.awaitMessageComponent({ time: 300000 });
-        } catch (e) { return; }
+        } catch (e) {
+            return;
+        }
         i.deferUpdate();
-        if (i.customId === "next") { page++; }
-        else if (i.customId === "previous") { page--; }
-        else if (i.customId === "select") { page = parseInt(i.values[0]); }
+        if (i.customId === "next") {
+            page++;
+        } else if (i.customId === "previous") {
+            page--;
+        } else if (i.customId === "select") {
+            page = parseInt(i.values[0]);
+        }
     }
 };
 
-
 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";
+    const member = interaction.member as GuildMember;
+    if (!member.permissions.has("MANAGE_ROLES"))
+        throw "You do not have the *Manage Roles* permission";
     return true;
 };
 
-export { command, callback, check };
\ No newline at end of file
+export { command, callback, check };
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 34ad3c3..91c876e 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -1,18 +1,33 @@
-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;
@@ -23,18 +38,44 @@
         confirmation = await new confirmationMessage(interaction)
             .setEmoji("PUNISH.WARN.RED")
             .setTitle("Warn")
-            .setDescription(keyValueList({
-                "user": renderUser(interaction.options.getUser("user")),
-                "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}>?`)
+            .setDescription(
+                keyValueList({
+                    user: renderUser(interaction.options.getUser("user")),
+                    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
+                    }>?`
+            )
             .setColor("Danger")
             .addCustomBoolean(
-                "appeal", "Create appeal ticket", !(await areTicketsEnabled(interaction.guild.id)),
-                async () => await create(interaction.guild, interaction.options.getUser("user"), interaction.user, reason),
-                "An appeal ticket will be created when Confirm is clicked", "CONTROL.TICKET", createAppealTicket)
-            .addCustomBoolean("notify", "Notify user", false, null, null, "ICONS.NOTIFY." + (notify ? "ON" : "OFF" ), notify)
+                "appeal",
+                "Create appeal ticket",
+                !(await areTicketsEnabled(interaction.guild.id)),
+                async () =>
+                    await create(
+                        interaction.guild,
+                        interaction.options.getUser("user"),
+                        interaction.user,
+                        reason
+                    ),
+                "An appeal ticket will be created when Confirm is clicked",
+                "CONTROL.TICKET",
+                createAppealTicket
+            )
+            .addCustomBoolean(
+                "notify",
+                "Notify user",
+                false,
+                null,
+                null,
+                "ICONS.NOTIFY." + (notify ? "ON" : "OFF"),
+                notify
+            )
             .addReasonButton(reason ?? "")
             .send(reason !== null);
         reason = reason ?? "";
@@ -50,31 +91,51 @@
         let dmd = false;
         try {
             if (notify) {
-                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")
-                        .setTitle("Warned")
-                        .setDescription(`You have been warned in ${interaction.guild.name}` +
-                                    (reason ? ` for:\n> ${reason}` : ".") + "\n\n" +
-                                    (confirmation.components.appeal.response ? `You can appeal this here ticket: <#${confirmation.components.appeal.response}>` : ""))
-                        .setStatus("Danger")
-                        .setFooter({
-                            text: config.moderation.warn.text ? "The button below is set by the server admins. Do not enter any passwords or other account details on the linked site." : "",
-                            iconURL: "https://cdn.discordapp.com/emojis/952295894370369587.webp?size=128&quality=lossless"
-                        })
+                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")
+                            .setTitle("Warned")
+                            .setDescription(
+                                `You have been warned in ${interaction.guild.name}` +
+                                    (reason ? ` for:\n> ${reason}` : ".") +
+                                    "\n\n" +
+                                    (confirmation.components.appeal.response
+                                        ? `You can appeal this here ticket: <#${confirmation.components.appeal.response}>`
+                                        : "")
+                            )
+                            .setStatus("Danger")
+                            .setFooter({
+                                text: config.moderation.warn.text
+                                    ? "The button below is set by the server admins. Do not enter any passwords or other account details on the linked site."
+                                    : "",
+                                iconURL:
+                                    "https://cdn.discordapp.com/emojis/952295894370369587.webp?size=128&quality=lossless"
+                            })
                     ],
-                    components: config.moderation.warn.text ? [new MessageActionRow().addComponents([new MessageButton()
-                        .setStyle("LINK")
-                        .setLabel(config.moderation.warn.text)
-                        .setURL(config.moderation.warn.link)
-                    ])] : []
+                    components: config.moderation.warn.text
+                        ? [
+                              new MessageActionRow().addComponents([
+                                  new MessageButton()
+                                      .setStyle("LINK")
+                                      .setLabel(config.moderation.warn.text)
+                                      .setURL(config.moderation.warn.link)
+                              ])
+                          ]
+                        : []
                 });
                 dmd = true;
             }
-        } catch { dmd = false; }
+        } catch {
+            dmd = false;
+        }
         const data = {
-            meta:{
+            meta: {
                 type: "memberWarn",
                 displayName: "Member warned",
                 calculateType: "guildMemberPunish",
@@ -83,8 +144,18 @@
                 timestamp: new Date().getTime()
             },
             list: {
-                user: entry((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)),
+                user: entry(
+                    (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)
+                ),
                 reason: reason ? `\n> ${reason}` : "No reason provided"
             },
             hidden: {
@@ -92,28 +163,47 @@
             }
         };
         await client.database.history.create(
-            "warn", interaction.guild.id,
+            "warn",
+            interaction.guild.id,
             (interaction.options.getMember("user") as GuildMember).user,
-            interaction.user, reason
+            interaction.user,
+            reason
         );
         log(data);
-        const failed = (dmd === false && notify);
+        const failed = !dmd && notify;
         if (!failed) {
-            await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("PUNISH.WARN.GREEN")
-                .setTitle("Warn")
-                .setDescription("The user was warned" + (confirmation.components.appeal.response ? ` and an appeal ticket was opened in <#${confirmation.components.appeal.response}>` : ""))
-                .setStatus("Success")
-            ], components: []});
+            await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("PUNISH.WARN.GREEN")
+                        .setTitle("Warn")
+                        .setDescription(
+                            "The user was warned" +
+                                (confirmation.components.appeal.response
+                                    ? ` and an appeal ticket was opened in <#${confirmation.components.appeal.response}>`
+                                    : "")
+                        )
+                        .setStatus("Success")
+                ],
+                components: []
+            });
         } else {
-            const canSeeChannel = (interaction.options.getMember("user") as GuildMember).permissionsIn(interaction.channel as Discord.TextChannel).has("VIEW_CHANNEL");
-            const m = await interaction.editReply({
-                embeds: [new EmojiEmbed()
-                    .setEmoji("PUNISH.WARN.RED")
-                    .setTitle("Warn")
-                    .setDescription("The user's DMs are not open\n\nWhat would you like to do?")
-                    .setStatus("Danger")
-                ], components: [
+            const canSeeChannel = (
+                interaction.options.getMember("user") as GuildMember
+            )
+                .permissionsIn(interaction.channel as Discord.TextChannel)
+                .has("VIEW_CHANNEL");
+            const m = (await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("PUNISH.WARN.RED")
+                        .setTitle("Warn")
+                        .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")
@@ -130,76 +220,131 @@
                             .setStyle(canSeeChannel ? "SECONDARY" : "PRIMARY")
                     ])
                 ]
-            }) as Discord.Message;
+            })) as Discord.Message;
             let component;
             try {
-                component = await m.awaitMessageComponent({filter: (m) => m.user.id === interaction.user.id, time: 300000});
+                component = await m.awaitMessageComponent({
+                    filter: (m) => m.user.id === interaction.user.id,
+                    time: 300000
+                });
             } catch (e) {
-                return await interaction.editReply({embeds: [new EmojiEmbed()
+                return await interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("PUNISH.WARN.GREEN")
+                            .setTitle("Warn")
+                            .setDescription("No changes were made")
+                            .setStatus("Success")
+                    ],
+                    components: []
+                });
+            }
+            if (component.customId === "here") {
+                await interaction.channel.send({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("PUNISH.WARN.RED")
+                            .setTitle("Warn")
+                            .setDescription(
+                                "You have been warned" +
+                                    (reason ? ` for:\n> ${reason}` : ".")
+                            )
+                            .setStatus("Danger")
+                    ],
+                    content: `<@!${
+                        (interaction.options.getMember("user") as GuildMember)
+                            .id
+                    }>`,
+                    allowedMentions: {
+                        users: [
+                            (
+                                interaction.options.getMember(
+                                    "user"
+                                ) as GuildMember
+                            ).id
+                        ]
+                    }
+                });
+                return await interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("PUNISH.WARN.GREEN")
+                            .setTitle("Warn")
+                            .setDescription(
+                                "The user was warned" +
+                                    (confirmation.response
+                                        ? ` and an appeal ticket was opened in <#${confirmation.response}>`
+                                        : "")
+                            )
+                            .setStatus("Success")
+                    ],
+                    components: []
+                });
+            } else if (component.customId === "log") {
+                await interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("PUNISH.WARN.GREEN")
+                            .setTitle("Warn")
+                            .setDescription("The warn was logged")
+                            .setStatus("Success")
+                    ],
+                    components: []
+                });
+            } else if (component.customId === "ticket") {
+                const ticketChannel = await create(
+                    interaction.guild,
+                    interaction.options.getUser("user"),
+                    interaction.user,
+                    reason,
+                    "Warn Notification"
+                );
+                if (ticketChannel === null) {
+                    return await interaction.editReply({
+                        embeds: [
+                            new EmojiEmbed()
+                                .setEmoji("PUNISH.WARN.RED")
+                                .setTitle("Warn")
+                                .setDescription("A ticket could not be created")
+                                .setStatus("Danger")
+                        ],
+                        components: []
+                    });
+                }
+                await interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("PUNISH.WARN.GREEN")
+                            .setTitle("Warn")
+                            .setDescription(
+                                `A ticket was created in <#${ticketChannel}>`
+                            )
+                            .setStatus("Success")
+                    ],
+                    components: []
+                });
+            }
+        }
+    } else {
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
                     .setEmoji("PUNISH.WARN.GREEN")
                     .setTitle("Warn")
                     .setDescription("No changes were made")
                     .setStatus("Success")
-                ], components: []});
-            }
-            if ( component.customId === "here" ) {
-                await interaction.channel.send({
-                    embeds: [new EmojiEmbed()
-                        .setEmoji("PUNISH.WARN.RED")
-                        .setTitle("Warn")
-                        .setDescription("You have been warned" +
-                                    (reason ? ` for:\n> ${reason}` : "."))
-                        .setStatus("Danger")
-                    ],
-                    content: `<@!${(interaction.options.getMember("user") as GuildMember).id}>`,
-                    allowedMentions: {users: [(interaction.options.getMember("user") as GuildMember).id]}
-                });
-                return await interaction.editReply({embeds: [new EmojiEmbed()
-                    .setEmoji("PUNISH.WARN.GREEN")
-                    .setTitle("Warn")
-                    .setDescription("The user was warned" + (confirmation.response ? ` and an appeal ticket was opened in <#${confirmation.response}>` : ""))
-                    .setStatus("Success")
-                ], components: []});
-            } else if (component.customId === "log") {
-                await interaction.editReply({embeds: [new EmojiEmbed()
-                    .setEmoji("PUNISH.WARN.GREEN")
-                    .setTitle("Warn")
-                    .setDescription("The warn was logged")
-                    .setStatus("Success")
-                ], components: []});
-            } else if (component.customId === "ticket") {
-                const ticketChannel = await create(interaction.guild, interaction.options.getUser("user"), interaction.user, reason, "Warn Notification");
-                if (ticketChannel === null) {
-                    return await interaction.editReply({embeds: [new EmojiEmbed()
-                        .setEmoji("PUNISH.WARN.RED")
-                        .setTitle("Warn")
-                        .setDescription("A ticket could not be created")
-                        .setStatus("Danger")
-                    ], components: []});
-                }
-                await interaction.editReply({embeds: [new EmojiEmbed()
-                    .setEmoji("PUNISH.WARN.GREEN")
-                    .setTitle("Warn")
-                    .setDescription(`A ticket was created in <#${ticketChannel}>`)
-                    .setStatus("Success")
-                ], components: []});
-            }
-        }
-    } else {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("PUNISH.WARN.GREEN")
-            .setTitle("Warn")
-            .setDescription("No changes were made")
-            .setStatus("Success")
-        ], components: []});
+            ],
+            components: []
+        });
     }
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as GuildMember);
-    const me = (interaction.guild.me as GuildMember);
-    const apply = (interaction.options.getMember("user") as GuildMember);
-    if (member === null || me === null || apply === null) throw "That member is not in the server";
+    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";
     const memberPos = member.roles ? member.roles.highest.position : 0;
     const applyPos = apply.roles ? apply.roles.highest.position : 0;
     // Do not allow warning bots
@@ -207,11 +352,13 @@
     // 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;
 };
 
-export { command, callback, check };
\ No newline at end of file
+export { command, callback, check };
diff --git a/src/commands/nucleus/_meta.ts b/src/commands/nucleus/_meta.ts
index df978ba..a79a596 100644
--- a/src/commands/nucleus/_meta.ts
+++ b/src/commands/nucleus/_meta.ts
@@ -1,4 +1,4 @@
 const name = "nucleus";
 const description = "Commands relating to Nucleus itself";
 
-export { name, description };
\ No newline at end of file
+export { name, description };
diff --git a/src/commands/nucleus/guide.ts b/src/commands/nucleus/guide.ts
index 3141f9f..b9df446 100644
--- a/src/commands/nucleus/guide.ts
+++ b/src/commands/nucleus/guide.ts
@@ -6,7 +6,6 @@
         .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 ebc3c34..8ae8c1a 100644
--- a/src/commands/nucleus/invite.ts
+++ b/src/commands/nucleus/invite.ts
@@ -1,24 +1,38 @@
-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";
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
-    builder
-        .setName("invite")
-        .setDescription("Invites Nucleus to your server");
+    builder.setName("invite").setDescription("Invites Nucleus to your server");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
-    interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Invite")
-        .setDescription("You can invite Nucleus to your server by clicking the button below")
-        .setEmoji("NUCLEUS.LOGO")
-        .setStatus("Danger")
-    ], components: [new MessageActionRow().addComponents([new MessageButton()
-        .setLabel("Invite")
-        .setStyle("LINK")
-        .setURL(`https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=295157886134&scope=bot%20applications.commands`)
-    ])], ephemeral: true});
+    interaction.reply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Invite")
+                .setDescription(
+                    "You can invite Nucleus to your server by clicking the button below"
+                )
+                .setEmoji("NUCLEUS.LOGO")
+                .setStatus("Danger")
+        ],
+        components: [
+            new MessageActionRow().addComponents([
+                new MessageButton()
+                    .setLabel("Invite")
+                    .setStyle("LINK")
+                    .setURL(
+                        `https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=295157886134&scope=bot%20applications.commands`
+                    )
+            ])
+        ],
+        ephemeral: true
+    });
 };
 
 const check = () => {
@@ -27,4 +41,4 @@
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/nucleus/ping.ts b/src/commands/nucleus/ping.ts
index 91e8363..105cda5 100644
--- a/src/commands/nucleus/ping.ts
+++ b/src/commands/nucleus/ping.ts
@@ -5,26 +5,29 @@
 import client from "../../utils/client.js";
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
-    builder
-        .setName("ping")
-        .setDescription("Gets the bot's ping time");
+    builder.setName("ping").setDescription("Gets the bot's ping time");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     // WEBSOCKET | Nucleus -> Discord
     // EDITING   | Nucleus -> discord -> nucleus | edit time / 2
     const initial = new Date().getTime();
-    await interaction.reply({embeds: LoadingEmbed, ephemeral: true});
+    await interaction.reply({ embeds: LoadingEmbed, ephemeral: true });
     const ping = new Date().getTime() - initial;
-    interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Ping")
-        .setDescription(
-            `**Ping:** \`${ping}ms\`\n` +
-            `**To Discord:** \`${client.ws.ping}ms\`\n` +
-            `**From Expected:** \`±${Math.abs((ping / 2) - client.ws.ping)}ms\``
-        )
-        .setEmoji("CHANNEL.SLOWMODE.OFF")
-        .setStatus("Danger")
-    ]});
+    interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Ping")
+                .setDescription(
+                    `**Ping:** \`${ping}ms\`\n` +
+                        `**To Discord:** \`${client.ws.ping}ms\`\n` +
+                        `**From Expected:** \`±${Math.abs(
+                            ping / 2 - client.ws.ping
+                        )}ms\``
+                )
+                .setEmoji("CHANNEL.SLOWMODE.OFF")
+                .setStatus("Danger")
+        ]
+    });
 };
 
 const check = () => {
@@ -33,4 +36,4 @@
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/nucleus/premium.ts b/src/commands/nucleus/premium.ts
index 9ad2c16..83ba327 100644
--- a/src/commands/nucleus/premium.ts
+++ b/src/commands/nucleus/premium.ts
@@ -8,17 +8,21 @@
         .setDescription("Information about Nucleus Premium");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
-    interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Premium")
-        .setDescription(
-            "*Nucleus Premium is currently not available.*\n\n" +
-            "Premium allows your server to get access to extra features, for a fixed price per month.\nThis includes:\n" +
-            "- Attachment logs - Stores attachments so they can be viewed after a message is deleted.\n" +
-            "- Ticket Transcripts - Gives a link to view the history of a ticket after it has been closed.\n"
-        )
-        .setEmoji("NUCLEUS.LOGO")
-        .setStatus("Danger")
-    ], ephemeral: true});
+    interaction.reply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Premium")
+                .setDescription(
+                    "*Nucleus Premium is currently not available.*\n\n" +
+                        "Premium allows your server to get access to extra features, for a fixed price per month.\nThis includes:\n" +
+                        "- Attachment logs - Stores attachments so they can be viewed after a message is deleted.\n" +
+                        "- Ticket Transcripts - Gives a link to view the history of a ticket after it has been closed.\n"
+                )
+                .setEmoji("NUCLEUS.LOGO")
+                .setStatus("Danger")
+        ],
+        ephemeral: true
+    });
 };
 
 const check = () => {
@@ -27,4 +31,4 @@
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts
index 2558997..68eeaa9 100644
--- a/src/commands/nucleus/stats.ts
+++ b/src/commands/nucleus/stats.ts
@@ -4,22 +4,21 @@
 import client from "../../utils/client.js";
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
-    builder
-        .setName("stats")
-        .setDescription("Gets the bot's stats");
+    builder.setName("stats").setDescription("Gets the bot's stats");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     interaction.reply({
-        embeds: [new EmojiEmbed()
-            .setTitle("Stats")
-            .setDescription(
-                `**Servers:** ${client.guilds.cache.size}\n` +
-                `**Ping:** \`${client.ws.ping*2}ms\``
-            )
-            .setStatus("Success")
-            .setEmoji("GUILD.GRAPHS")
-
-        ], ephemeral: true
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Stats")
+                .setDescription(
+                    `**Servers:** ${client.guilds.cache.size}\n` +
+                        `**Ping:** \`${client.ws.ping * 2}ms\``
+                )
+                .setStatus("Success")
+                .setEmoji("GUILD.GRAPHS")
+        ],
+        ephemeral: true
     });
 };
 
@@ -29,4 +28,4 @@
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/nucleus/suggest.ts b/src/commands/nucleus/suggest.ts
index a6657d8..0f40501 100644
--- a/src/commands/nucleus/suggest.ts
+++ b/src/commands/nucleus/suggest.ts
@@ -9,7 +9,12 @@
     builder
         .setName("suggest")
         .setDescription("Sends a suggestion to the developers")
-        .addStringOption(option => option.setName("suggestion").setDescription("The suggestion to send").setRequired(true));
+        .addStringOption((option) =>
+            option
+                .setName("suggestion")
+                .setDescription("The suggestion to send")
+                .setRequired(true)
+        );
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     const { renderUser } = client.logger;
@@ -17,42 +22,63 @@
     const confirmation = await new confirmationMessage(interaction)
         .setEmoji("ICONS.OPP.ADD")
         .setTitle("Suggest")
-        .setDescription(`**Suggestion:**\n> ${suggestion}\n`
-        + "Your username and ID will also be sent with your suggestion.\n\nAre you sure you want to send this suggestion?")
+        .setDescription(
+            `**Suggestion:**\n> ${suggestion}\n` +
+                "Your username and ID will also be sent with your suggestion.\n\nAre you sure you want to send this suggestion?"
+        )
         .setColor("Danger")
         .setInverted(true)
         .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}`)
+                    .setDescription(
+                        `**From:** ${renderUser(
+                            interaction.member.user
+                        )}\n**Suggestion:**\n> ${suggestion}`
+                    )
                     .setStatus("Danger")
                     .setEmoji("NUCLEUS.LOGO")
             ]
         });
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("ICONS.ADD")
-            .setTitle("Suggest")
-            .setDescription("Your suggestion was sent successfully")
-            .setStatus("Success")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("ICONS.ADD")
+                    .setTitle("Suggest")
+                    .setDescription("Your suggestion was sent successfully")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
     } else {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("ICONS.OPP.ADD")
-            .setTitle("Suggest")
-            .setDescription("No changes were made")
-            .setStatus("Danger")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("ICONS.OPP.ADD")
+                    .setTitle("Suggest")
+                    .setDescription("No changes were made")
+                    .setStatus("Danger")
+            ],
+            components: []
+        });
     }
 };
 
-const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
+const check = (
+    _interaction: CommandInteraction,
+    _defaultCheck: WrappedCheck
+) => {
     return true;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts
index 8fb6b40..3c36ea1 100644
--- a/src/commands/privacy.ts
+++ b/src/commands/privacy.ts
@@ -1,5 +1,9 @@
 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";
@@ -10,7 +14,9 @@
 
 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;
@@ -18,61 +24,111 @@
     description = "";
     pageId = 0;
     components?: MessageActionRow[] = [];
-    setEmbed(embed: Discord.MessageEmbed) { this.embed = embed; return this; }
-    setTitle(title: string) { this.title = title; return this; }
-    setDescription(description: string) { this.description = description; return this; }
-    setPageId(pageId: number) { this.pageId = pageId; return this; }
-    setComponents(components: MessageActionRow[]) { this.components = components; return this; }
+    setEmbed(embed: Discord.MessageEmbed) {
+        this.embed = embed;
+        return this;
+    }
+    setTitle(title: string) {
+        this.title = title;
+        return this;
+    }
+    setDescription(description: string) {
+        this.description = description;
+        return this;
+    }
+    setPageId(pageId: number) {
+        this.pageId = pageId;
+        return this;
+    }
+    setComponents(components: MessageActionRow[]) {
+        this.components = components;
+        return this;
+    }
 }
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     const pages = [
         new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Nucleus Privacy")
-                .setDescription(
-                    "Nucleus is a bot that naturally needs to store data about servers.\n" +
-                    "We are entirely [open source](https://github.com/ClicksMinutePer/Nucleus), so you can check exactly what we store, and how it works.\n\n" +
-                    "If you are a server administrator, you can view the options page in the dropdown under this message.\n\n" +
-                    "Any questions about Nucleus, how it works and data stored can be asked in [our server](https://discord.gg/bPaNnxe)."
-                )
-                .setEmoji("NUCLEUS.LOGO")
-                .setStatus("Danger")
-            ).setTitle("Welcome").setDescription("General privacy information").setPageId(0),
-        new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Scanners")
-                .setDescription(
-                    "Nucleus uses [unscan](https://unscan.co) to scan links, images and files for malware and other threats.\n" +
-                    "This service's [privacy policy](https://unscan.co/policies) is public, and they \"do not store or sell your data.\""
-                )
-                .setEmoji("NUCLEUS.LOGO")
-                .setStatus("Danger")
-            ).setTitle("Scanners").setDescription("About Unscan").setPageId(1),
-        new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Link scanning and Transcripts")
-                .setDescription(
-                    "**Facebook** - Facebook trackers include data such as your date of birth, and guess your age if not entered, your preferences, who you interact with and more.\n" +
-                    "**AMP** - AMP is a technology that allows websites to be served by Google. This means Google can store and track data, and are pushing this to as many pages as possible.\n\n" +
-                    "Transcripts allow you to store all messages sent in a channel. This could be an issue in some cases, as they are hosted on [Pastebin](https://pastebin.com), so a leaked link could show all messages sent in the channel.\n"
-                )
-                .setEmoji("NUCLEUS.LOGO")
-                .setStatus("Danger")
-            ).setTitle("Link scanning and Transcripts").setDescription("Regarding Facebook and AMP filter types, and ticket transcripts").setPageId(2)
-    ].concat((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"
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Nucleus Privacy")
+                    .setDescription(
+                        "Nucleus is a bot that naturally needs to store data about servers.\n" +
+                            "We are entirely [open source](https://github.com/ClicksMinutePer/Nucleus), so you can check exactly what we store, and how it works.\n\n" +
+                            "If you are a server administrator, you can view the options page in the dropdown under this message.\n\n" +
+                            "Any questions about Nucleus, how it works and data stored can be asked in [our server](https://discord.gg/bPaNnxe)."
+                    )
+                    .setEmoji("NUCLEUS.LOGO")
+                    .setStatus("Danger")
             )
-            .setEmoji("NUCLEUS.LOGO")
-            .setStatus("Danger")
-        ).setTitle("Options").setDescription("Options").setPageId(3).setComponents([new MessageActionRow().addComponents([
-            new MessageButton().setLabel("Clear all data").setCustomId("clear-all-data").setStyle("DANGER")
-        ])])
-    ] : []);
-    const m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
+            .setTitle("Welcome")
+            .setDescription("General privacy information")
+            .setPageId(0),
+        new Embed()
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Scanners")
+                    .setDescription(
+                        "Nucleus uses [unscan](https://unscan.co) to scan links, images and files for malware and other threats.\n" +
+                            'This service\'s [privacy policy](https://unscan.co/policies) is public, and they "do not store or sell your data."'
+                    )
+                    .setEmoji("NUCLEUS.LOGO")
+                    .setStatus("Danger")
+            )
+            .setTitle("Scanners")
+            .setDescription("About Unscan")
+            .setPageId(1),
+        new Embed()
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Link scanning and Transcripts")
+                    .setDescription(
+                        "**Facebook** - Facebook trackers include data such as your date of birth, and guess your age if not entered, your preferences, who you interact with and more.\n" +
+                            "**AMP** - AMP is a technology that allows websites to be served by Google. This means Google can store and track data, and are pushing this to as many pages as possible.\n\n" +
+                            "Transcripts allow you to store all messages sent in a channel. This could be an issue in some cases, as they are hosted on [Pastebin](https://pastebin.com), so a leaked link could show all messages sent in the channel.\n"
+                    )
+                    .setEmoji("NUCLEUS.LOGO")
+                    .setStatus("Danger")
+            )
+            .setTitle("Link scanning and Transcripts")
+            .setDescription(
+                "Regarding Facebook and AMP filter types, and ticket transcripts"
+            )
+            .setPageId(2)
+    ].concat(
+        (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"
+                              )
+                              .setEmoji("NUCLEUS.LOGO")
+                              .setStatus("Danger")
+                      )
+                      .setTitle("Options")
+                      .setDescription("Options")
+                      .setPageId(3)
+                      .setComponents([
+                          new MessageActionRow().addComponents([
+                              new MessageButton()
+                                  .setLabel("Clear all data")
+                                  .setCustomId("clear-all-data")
+                                  .setStyle("DANGER")
+                          ])
+                      ])
+              ]
+            : []
+    );
+    const m = await interaction.reply({
+        embeds: LoadingEmbed,
+        fetchReply: true,
+        ephemeral: true
+    });
     let page = 0;
 
     let selectPaneOpen = false;
@@ -83,37 +139,59 @@
 
         if (selectPaneOpen) {
             const options = [];
-            pages.forEach(embed => {
-                options.push(new SelectMenuOption({
-                    label: embed.title,
-                    value: embed.pageId.toString(),
-                    description: embed.description || ""
-                }));
+            pages.forEach((embed) => {
+                options.push(
+                    new SelectMenuOption({
+                        label: embed.title,
+                        value: embed.pageId.toString(),
+                        description: embed.description || ""
+                    })
+                );
             });
-            selectPane = [new MessageActionRow().addComponents([
-                new Discord.MessageSelectMenu()
-                    .addOptions(options)
-                    .setCustomId("page")
-                    .setMaxValues(1)
-                    .setPlaceholder("Choose a page...")
-            ])];
+            selectPane = [
+                new MessageActionRow().addComponents([
+                    new Discord.MessageSelectMenu()
+                        .addOptions(options)
+                        .setCustomId("page")
+                        .setMaxValues(1)
+                        .setPlaceholder("Choose a page...")
+                ])
+            ];
         }
-        const components = selectPane.concat([new MessageActionRow().addComponents([
-            new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(page === 0),
-            new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY").setDisabled(false),
-            new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(page === pages.length - 1)
-        ])]);
+        const components = selectPane.concat([
+            new MessageActionRow().addComponents([
+                new MessageButton()
+                    .setCustomId("left")
+                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                    .setStyle("SECONDARY")
+                    .setDisabled(page === 0),
+                new MessageButton()
+                    .setCustomId("select")
+                    .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
+                    .setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY")
+                    .setDisabled(false),
+                new MessageButton()
+                    .setCustomId("right")
+                    .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                    .setStyle("SECONDARY")
+                    .setDisabled(page === pages.length - 1)
+            ])
+        ]);
         const em = new Discord.MessageEmbed(pages[page].embed);
-        em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
-        em.setFooter({text: nextFooter ?? ""});
+        em.setDescription(
+            em.description + "\n\n" + createPageIndicator(pages.length, page)
+        );
+        em.setFooter({ text: nextFooter ?? "" });
         await interaction.editReply({
             embeds: [em],
             components: components.concat(pages[page].components)
         });
         let i;
         try {
-            i = await m.awaitMessageComponent({time: 300000});
-        } catch(e) { break; }
+            i = await m.awaitMessageComponent({ time: 300000 });
+        } catch (e) {
+            break;
+        }
         nextFooter = null;
         i.deferUpdate();
         if (i.component.customId === "left") {
@@ -133,11 +211,13 @@
                 .setTitle("Clear All Data")
                 .setDescription(
                     "Are you sure you want to delete all data on this server? This includes your settings and all punishment histories.\n\n" +
-                    "**This cannot be undone.**"
+                        "**This cannot be undone.**"
                 )
                 .setColor("Danger")
                 .send(true);
-            if (confirmation.cancelled) { break; }
+            if (confirmation.cancelled) {
+                break;
+            }
             if (confirmation.success) {
                 client.database.guilds.delete(interaction.guild.id);
                 client.database.history.delete(interaction.guild.id);
@@ -149,25 +229,34 @@
             }
         } else {
             const em = new Discord.MessageEmbed(pages[page].embed);
-            em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
-            em.setFooter({text: "Message closed"});
-            interaction.editReply({embeds: [em], components: []});
+            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.setFooter({text: "Message timed out"});
+    em.setDescription(
+        em.description + "\n\n" + createPageIndicator(pages.length, page)
+    );
+    em.setFooter({ text: "Message timed out" });
     await interaction.editReply({
         embeds: [em],
         components: []
     });
 };
 
-const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
+const check = (
+    _interaction: CommandInteraction,
+    _defaultCheck: WrappedCheck
+) => {
     return true;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/role/_meta.ts b/src/commands/role/_meta.ts
index 408576f..c5936c9 100644
--- a/src/commands/role/_meta.ts
+++ b/src/commands/role/_meta.ts
@@ -1,4 +1,4 @@
 const name = "role";
 const description = "Change roles for users";
 
-export { name, description };
\ No newline at end of file
+export { name, description };
diff --git a/src/commands/role/user.ts b/src/commands/role/user.ts
index b54ee1e..2557b4b 100644
--- a/src/commands/role/user.ts
+++ b/src/commands/role/user.ts
@@ -10,25 +10,49 @@
     builder
         .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))
-        .addRoleOption(option => option.setName("role").setDescription("The role to give or remove").setRequired(true))
-        .addStringOption(option => option.setName("action").setDescription("The action to perform").setRequired(true).addChoices([
-            ["Add", "give"],
-            ["Remove", "remove"]
-        ]));
+        .addUserOption((option) =>
+            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)
+        )
+        .addStringOption((option) =>
+            option
+                .setName("action")
+                .setDescription("The action to perform")
+                .setRequired(true)
+                .addChoices([
+                    ["Add", "give"],
+                    ["Remove", "remove"]
+                ])
+        );
 
-
-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
     const confirmation = await new confirmationMessage(interaction)
         .setEmoji("GUILD.ROLES.DELETE")
         .setTitle("Role")
-        .setDescription(keyValueList({
-            "user": renderUser(interaction.options.getUser("user")),
-            "role": renderRole(interaction.options.getRole("role"))
-        }) + `\nAre you sure you want to ${action === "give" ? "give the role to" : "remove the role from"} ${interaction.options.getUser("user")}?`)
+        .setDescription(
+            keyValueList({
+                user: renderUser(interaction.options.getUser("user")),
+                role: renderRole(interaction.options.getRole("role"))
+            }) +
+                `\nAre you sure you want to ${
+                    action === "give"
+                        ? "give the role to"
+                        : "remove the role from"
+                } ${interaction.options.getUser("user")}?`
+        )
         .setColor("Danger")
         .send();
     if (confirmation.cancelled) return;
@@ -42,44 +66,68 @@
                 member.roles.remove(role);
             }
         } catch (e) {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Role")
-                .setDescription("Something went wrong and the role could not be added")
-                .setStatus("Danger")
-                .setEmoji("CONTROL.BLOCKCROSS")
-            ], components: []});
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Role")
+                        .setDescription(
+                            "Something went wrong and the role could not be added"
+                        )
+                        .setStatus("Danger")
+                        .setEmoji("CONTROL.BLOCKCROSS")
+                ],
+                components: []
+            });
         }
-        return await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Role")
-            .setDescription(`The role has been ${action === "give" ? "given" : "removed"} successfully`)
-            .setStatus("Success")
-            .setEmoji("GUILD.ROLES.CREATE")
-        ], components: []});
+        return await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Role")
+                    .setDescription(
+                        `The role has been ${
+                            action === "give" ? "given" : "removed"
+                        } successfully`
+                    )
+                    .setStatus("Success")
+                    .setEmoji("GUILD.ROLES.CREATE")
+            ],
+            components: []
+        });
     } else {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("GUILD.ROLES.CREATE")
-            .setTitle("Role")
-            .setDescription("No changes were made.")
-            .setStatus("Danger")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("GUILD.ROLES.CREATE")
+                    .setTitle("Role")
+                    .setDescription("No changes were made.")
+                    .setStatus("Danger")
+            ],
+            components: []
+        });
     }
 };
 
-const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
-    const member = (interaction.member as GuildMember);
-    const me = (interaction.guild.me as GuildMember);
-    const apply = (interaction.options.getMember("user") as GuildMember);
-    if (member === null || me === null || apply === null) throw "That member is not in the server";
+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";
     // 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;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/rolemenu.ts b/src/commands/rolemenu.ts
index dd3cb34..8566966 100644
--- a/src/commands/rolemenu.ts
+++ b/src/commands/rolemenu.ts
@@ -11,7 +11,10 @@
     await roleMenu(interaction);
 };
 
-const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
+const check = (
+    _interaction: CommandInteraction,
+    _defaultCheck: WrappedCheck
+) => {
     return true;
 };
 
diff --git a/src/commands/server/_meta.ts b/src/commands/server/_meta.ts
index 379aac6..5c0ba48 100644
--- a/src/commands/server/_meta.ts
+++ b/src/commands/server/_meta.ts
@@ -1,4 +1,4 @@
 const name = "server";
 const description = "Commands for the server";
 
-export { name, description };
\ No newline at end of file
+export { name, description };
diff --git a/src/commands/server/about.ts b/src/commands/server/about.ts
index c0a2ede..0a1cc6f 100644
--- a/src/commands/server/about.ts
+++ b/src/commands/server/about.ts
@@ -3,48 +3,84 @@
 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) => builder
-    .setName("about")
-    .setDescription("Shows info about the server");
+const command = (builder: SlashCommandSubcommandBuilder) =>
+    builder.setName("about").setDescription("Shows info about the server");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
-    const guild = interaction.guild as Guild;
+    const guild = interaction.guild!;
     const { renderUser, renderDelta } = client.logger;
-    interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Server Info")
-        .setStatus("Success")
-        .setEmoji("GUILD.GREEN")
-        .setDescription(
-            generateKeyValueList({
-                "name": guild.name,
-                "id": `\`${guild.id}\``,
-                "owner": `${renderUser((await guild.fetchOwner()).user)}`,
-                "created": `${renderDelta(guild.createdTimestamp)}`,
-                "emojis": `${guild.emojis.cache.size}` + (guild.emojis.cache.size > 1 ? `\n> ${
-                    guild.emojis.cache.first(10).map((emoji) => `<${emoji.animated ? "a" : ""}:${emoji.name}:${emoji.id}>`).join(" ")
-                }` +
-                    (guild.emojis.cache.size > 10 ? ` and ${guild.emojis.cache.size - 10} more` : "") : ""),
-                "icon": `[Discord](${guild.iconURL()})`,
-                "2 factor authentication": `${guild.mfaLevel === "NONE" ? `${getEmojiByName("CONTROL.CROSS")} No` : `${getEmojiByName("CONTROL.TICK")} Yes`}`,
-                "verification level": `${toCapitals(guild.verificationLevel)}`,
-                "explicit content filter": `${toCapitals(guild.explicitContentFilter.toString().replace(/_/, " " ))}`,
-                "nitro boost level": `${guild.premiumTier !== "NONE" ? guild.premiumTier.toString()[-1] : "0"}`,
-                "channels": `${guild.channels.cache.size}`,
-                "roles": `${guild.roles.cache.size}`,
-                "members": `${guild.memberCount}`
-            })
-        )
-        .setThumbnail(guild.iconURL({dynamic: true}))
-    ], ephemeral: true});
+    interaction.reply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Server Info")
+                .setStatus("Success")
+                .setEmoji("GUILD.GREEN")
+                .setDescription(
+                    generateKeyValueList({
+                        name: guild.name,
+                        id: `\`${guild.id}\``,
+                        owner: `${renderUser((await guild.fetchOwner()).user)}`,
+                        created: `${renderDelta(guild.createdTimestamp)}`,
+                        emojis:
+                            `${guild.emojis.cache.size}` +
+                            (guild.emojis.cache.size > 1
+                                ? `\n> ${guild.emojis.cache
+                                      .first(10)
+                                      .map(
+                                          (emoji) =>
+                                              `<${emoji.animated ? "a" : ""}:${
+                                                  emoji.name
+                                              }:${emoji.id}>`
+                                      )
+                                      .join(" ")}` +
+                                  (guild.emojis.cache.size > 10
+                                      ? ` and ${
+                                            guild.emojis.cache.size - 10
+                                        } more`
+                                      : "")
+                                : ""),
+                        icon: `[Discord](${guild.iconURL()})`,
+                        "2 factor authentication": `${
+                            guild.mfaLevel === "NONE"
+                                ? `${getEmojiByName("CONTROL.CROSS")} No`
+                                : `${getEmojiByName("CONTROL.TICK")} Yes`
+                        }`,
+                        "verification level": `${toCapitals(
+                            guild.verificationLevel
+                        )}`,
+                        "explicit content filter": `${toCapitals(
+                            guild.explicitContentFilter
+                                .toString()
+                                .replace(/_/, " ")
+                        )}`,
+                        "nitro boost level": `${
+                            guild.premiumTier !== "NONE"
+                                ? guild.premiumTier.toString()[-1]
+                                : "0"
+                        }`,
+                        channels: `${guild.channels.cache.size}`,
+                        roles: `${guild.roles.cache.size}`,
+                        members: `${guild.memberCount}`
+                    })
+                )
+                .setThumbnail(guild.iconURL({ dynamic: true }))
+        ],
+        ephemeral: true
+    });
 };
 
-const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
+const check = (
+    _interaction: CommandInteraction,
+    _defaultCheck: WrappedCheck
+) => {
     return true;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/settings/_meta.ts b/src/commands/settings/_meta.ts
index 63d726e..1241322 100644
--- a/src/commands/settings/_meta.ts
+++ b/src/commands/settings/_meta.ts
@@ -1,4 +1,4 @@
 const name = "settings";
 const description = "Change bot settings";
 
-export { name, description };
\ No newline at end of file
+export { name, description };
diff --git a/src/commands/settings/commands.ts b/src/commands/settings/commands.ts
index 845e001..13cfa89 100644
--- a/src/commands/settings/commands.ts
+++ b/src/commands/settings/commands.ts
@@ -1,5 +1,10 @@
 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";
@@ -12,133 +17,257 @@
 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> => {
-    await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
+const callback = async (
+    interaction: CommandInteraction
+): Promise<void | unknown> => {
+    await interaction.reply({
+        embeds: LoadingEmbed,
+        ephemeral: true,
+        fetchReply: true
+    });
     let m;
     let clicked = "";
     if (interaction.options.getRole("role")) {
         const confirmation = await new confirmationMessage(interaction)
             .setEmoji("GUILD.ROLES.DELETE")
             .setTitle("Moderation Commands")
-            .setDescription(keyValueList({
-                role: `<@&${interaction.options.getRole("role").id}>`
-            }))
+            .setDescription(
+                keyValueList({
+                    role: `<@&${interaction.options.getRole("role").id}>`
+                })
+            )
             .setColor("Danger")
             .send(true);
-        if (confirmation.cancelled) return await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Moderation Commands")
-            .setDescription("No changes were made")
-            .setStatus("Success")
-            .setEmoji("GUILD.ROLES.CREATE")
-        ]});
+        if (confirmation.cancelled)
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Moderation Commands")
+                        .setDescription("No changes were made")
+                        .setStatus("Success")
+                        .setEmoji("GUILD.ROLES.CREATE")
+                ]
+            });
         if (confirmation.success) {
-            await client.database.guilds.write(interaction.guild.id, {["moderation.mute.role"]: interaction.options.getRole("role").id});
+            await client.database.guilds.write(interaction.guild.id, {
+                ["moderation.mute.role"]: interaction.options.getRole("role").id
+            });
         }
     }
     while (true) {
         const config = await client.database.guilds.read(interaction.guild.id);
         const moderation = config.getKey("moderation");
-        m = await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Moderation Commands")
-            .setEmoji("PUNISH.BAN.GREEN")
-            .setStatus("Success")
-            .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*")
-            )
-        ], components: [new MessageActionRow().addComponents([
-            new MessageButton().setLabel("Warn").setEmoji(getEmojiByName("PUNISH.WARN.YELLOW", "id")).setCustomId("warn").setStyle("SECONDARY"),
-            new MessageButton().setLabel("Mute").setEmoji(getEmojiByName("PUNISH.MUTE.YELLOW", "id")).setCustomId("mute").setStyle("SECONDARY"),
-            new MessageButton().setLabel("Nickname").setEmoji(getEmojiByName("PUNISH.NICKNAME.GREEN", "id")).setCustomId("nickname").setStyle("SECONDARY")
-        ]), new MessageActionRow().addComponents([
-            new MessageButton().setLabel("Kick").setEmoji(getEmojiByName("PUNISH.KICK.RED", "id")).setCustomId("kick").setStyle("SECONDARY"),
-            new MessageButton().setLabel("Softban").setEmoji(getEmojiByName("PUNISH.BAN.YELLOW", "id")).setCustomId("softban").setStyle("SECONDARY"),
-            new MessageButton().setLabel("Ban").setEmoji(getEmojiByName("PUNISH.BAN.RED", "id")).setCustomId("ban").setStyle("SECONDARY")
-        ]), new MessageActionRow().addComponents([
-            new MessageButton().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"))
-        ])]});
+        m = await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Moderation Commands")
+                    .setEmoji("PUNISH.BAN.GREEN")
+                    .setStatus("Success")
+                    .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*")
+                    )
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setLabel("Warn")
+                        .setEmoji(getEmojiByName("PUNISH.WARN.YELLOW", "id"))
+                        .setCustomId("warn")
+                        .setStyle("SECONDARY"),
+                    new MessageButton()
+                        .setLabel("Mute")
+                        .setEmoji(getEmojiByName("PUNISH.MUTE.YELLOW", "id"))
+                        .setCustomId("mute")
+                        .setStyle("SECONDARY"),
+                    new MessageButton()
+                        .setLabel("Nickname")
+                        .setEmoji(getEmojiByName("PUNISH.NICKNAME.GREEN", "id"))
+                        .setCustomId("nickname")
+                        .setStyle("SECONDARY")
+                ]),
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setLabel("Kick")
+                        .setEmoji(getEmojiByName("PUNISH.KICK.RED", "id"))
+                        .setCustomId("kick")
+                        .setStyle("SECONDARY"),
+                    new MessageButton()
+                        .setLabel("Softban")
+                        .setEmoji(getEmojiByName("PUNISH.BAN.YELLOW", "id"))
+                        .setCustomId("softban")
+                        .setStyle("SECONDARY"),
+                    new MessageButton()
+                        .setLabel("Ban")
+                        .setEmoji(getEmojiByName("PUNISH.BAN.RED", "id"))
+                        .setCustomId("ban")
+                        .setStyle("SECONDARY")
+                ]),
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .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"
+                            )
+                        )
+                ])
+            ]
+        });
         let i;
         try {
             i = await m.awaitMessageComponent({ time: 300000 });
-        } catch (e) { return; }
-        let chosen = moderation[i.customId] ?? {text: null, url: null};
+        } catch (e) {
+            return;
+        }
+        let chosen = moderation[i.customId] ?? { text: null, url: null };
         if (i.component.customId === "clearMuteRole") {
             i.deferUpdate();
             if (clicked === "clearMuteRole") {
-                await client.database.guilds.write(interaction.guild.id, {"moderation.mute.role": null });
-            } else { clicked = "clearMuteRole"; }
+                await client.database.guilds.write(interaction.guild.id, {
+                    "moderation.mute.role": null
+                });
+            } else {
+                clicked = "clearMuteRole";
+            }
             continue;
-        } else { clicked = ""; }
+        } else {
+            clicked = "";
+        }
         if (i.component.customId === "timeout") {
             await i.deferUpdate();
-            await client.database.guilds.write(interaction.guild.id, {"moderation.mute.timeout": !moderation.mute.timeout } );
+            await client.database.guilds.write(interaction.guild.id, {
+                "moderation.mute.timeout": !moderation.mute.timeout
+            });
             continue;
         } else if (i.customId) {
-            await i.showModal(new Discord.Modal().setCustomId("modal").setTitle(`Options for ${i.customId}`).addComponents(
-                new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
-                    .setCustomId("name")
-                    .setLabel("Button text")
-                    .setMaxLength(100)
-                    .setRequired(false)
-                    .setStyle("SHORT")
-                    .setValue(chosen.text ?? "")
-                ),
-                new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
-                    .setCustomId("url")
-                    .setLabel("URL - Type {id} to insert the user's ID")
-                    .setMaxLength(2000)
-                    .setRequired(false)
-                    .setStyle("SHORT")
-                    .setValue(chosen.link ?? "")
-                )
-            ));
+            await i.showModal(
+                new Discord.Modal()
+                    .setCustomId("modal")
+                    .setTitle(`Options for ${i.customId}`)
+                    .addComponents(
+                        new MessageActionRow<TextInputComponent>().addComponents(
+                            new TextInputComponent()
+                                .setCustomId("name")
+                                .setLabel("Button text")
+                                .setMaxLength(100)
+                                .setRequired(false)
+                                .setStyle("SHORT")
+                                .setValue(chosen.text ?? "")
+                        ),
+                        new MessageActionRow<TextInputComponent>().addComponents(
+                            new TextInputComponent()
+                                .setCustomId("url")
+                                .setLabel(
+                                    "URL - Type {id} to insert the user's ID"
+                                )
+                                .setMaxLength(2000)
+                                .setRequired(false)
+                                .setStyle("SHORT")
+                                .setValue(chosen.link ?? "")
+                        )
+                    )
+            );
             await interaction.editReply({
-                embeds: [new EmojiEmbed()
-                    .setTitle("Moderation Links")
-                    .setDescription("Modal opened. If you can't see it, click back and try again.")
-                    .setStatus("Success")
-                    .setEmoji("GUILD.TICKET.OPEN")
-                ], components: [new MessageActionRow().addComponents([new MessageButton()
-                    .setLabel("Back")
-                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
-                    .setStyle("PRIMARY")
-                    .setCustomId("back")
-                ])]
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Moderation Links")
+                        .setDescription(
+                            "Modal opened. If you can't see it, click back and try again."
+                        )
+                        .setStatus("Success")
+                        .setEmoji("GUILD.TICKET.OPEN")
+                ],
+                components: [
+                    new MessageActionRow().addComponents([
+                        new MessageButton()
+                            .setLabel("Back")
+                            .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                            .setStyle("PRIMARY")
+                            .setCustomId("back")
+                    ])
+                ]
             });
             let out;
             try {
-                out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (_) => true);
-            } catch (e) { continue; }
+                out = await modalInteractionCollector(
+                    m,
+                    (m) => m.channel.id === interaction.channel.id,
+                    (_) => true
+                );
+            } catch (e) {
+                continue;
+            }
             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]: { text: buttonText, link: buttonLink }});
+                    await client.database.guilds.write(interaction.guild.id, {
+                        ["moderation." + i.customId]: {
+                            text: buttonText,
+                            link: buttonLink
+                        }
+                    });
                 }
-            } else { continue; }
+            } else {
+                continue;
+            }
         }
     }
 };
 
-
-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";
+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";
     return true;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/settings/filters.ts b/src/commands/settings/filters.ts
index 7ee5b8d..3b0988e 100644
--- a/src/commands/settings/filters.ts
+++ b/src/commands/settings/filters.ts
@@ -2,20 +2,19 @@
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
-    builder
-        .setName("filter")
-        .setDescription("Setting for message filters");
+    builder.setName("filter").setDescription("Setting for message filters");
 
 const callback = async (_interaction: CommandInteraction): Promise<void> => {
     console.log("Filters");
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as Discord.GuildMember);
-    if (!member.permissions.has("MANAGE_MESSAGES")) throw "You must have the *Manage Messages* permission to use this command";
+    const member = interaction.member as Discord.GuildMember;
+    if (!member.permissions.has("MANAGE_MESSAGES"))
+        throw "You must have the *Manage Messages* permission to use this command";
     return true;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/settings/logs/_meta.ts b/src/commands/settings/logs/_meta.ts
index f46987f..fadff33 100644
--- a/src/commands/settings/logs/_meta.ts
+++ b/src/commands/settings/logs/_meta.ts
@@ -1,4 +1,4 @@
 const name = "logs";
 const description = "Settings for logging";
 
-export { name, description };
\ No newline at end of file
+export { name, description };
diff --git a/src/commands/settings/logs/attachment.ts b/src/commands/settings/logs/attachment.ts
index cb96567..f37bd1a 100644
--- a/src/commands/settings/logs/attachment.ts
+++ b/src/commands/settings/logs/attachment.ts
@@ -1,6 +1,10 @@
 import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
 import { ChannelType } from "discord-api-types";
-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";
@@ -12,39 +16,59 @@
     builder
         .setName("attachments")
         .setDescription("Where attachments should be logged to (Premium only)")
-        .addChannelOption(option => option.setName("channel").setDescription("The channel to log attachments in").addChannelTypes([
-            ChannelType.GuildNews, ChannelType.GuildText
-        ]).setRequired(false));
+        .addChannelOption((option) =>
+            option
+                .setName("channel")
+                .setDescription("The channel to log attachments in")
+                .addChannelTypes([ChannelType.GuildNews, ChannelType.GuildText])
+                .setRequired(false)
+        );
 
-const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
-    const m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true}) as Discord.Message;
+const callback = async (
+    interaction: CommandInteraction
+): Promise<void | unknown> => {
+    const m = (await interaction.reply({
+        embeds: LoadingEmbed,
+        ephemeral: true,
+        fetchReply: true
+    })) as Discord.Message;
     if (interaction.options.getChannel("channel")) {
         let channel;
         try {
             channel = interaction.options.getChannel("channel");
         } catch {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("CHANNEL.TEXT.DELETE")
-                .setTitle("Attachment Log Channel")
-                .setDescription("The channel you provided is not a valid channel")
-                .setStatus("Danger")
-            ]});
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("CHANNEL.TEXT.DELETE")
+                        .setTitle("Attachment Log Channel")
+                        .setDescription(
+                            "The channel you provided is not a valid channel"
+                        )
+                        .setStatus("Danger")
+                ]
+            });
         }
         channel = channel as Discord.TextChannel;
         if (channel.guild.id !== interaction.guild.id) {
-            return interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Attachment Log Channel")
-                .setDescription("You must choose a channel in this server")
-                .setStatus("Danger")
-                .setEmoji("CHANNEL.TEXT.DELETE")
-            ]});
+            return interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Attachment Log Channel")
+                        .setDescription(
+                            "You must choose a channel in this server"
+                        )
+                        .setStatus("Danger")
+                        .setEmoji("CHANNEL.TEXT.DELETE")
+                ]
+            });
         }
         const confirmation = await new confirmationMessage(interaction)
             .setEmoji("CHANNEL.TEXT.EDIT")
             .setTitle("Attachment Log Channel")
             .setDescription(
                 "This will be the channel all attachments will be sent to.\n\n" +
-                `Are you sure you want to set the attachment log channel to <#${channel.id}>?`
+                    `Are you sure you want to set the attachment log channel to <#${channel.id}>?`
             )
             .setColor("Warning")
             .setInverted(true)
@@ -52,10 +76,13 @@
         if (confirmation.cancelled) return;
         if (confirmation.success) {
             try {
-                await client.database.guilds.write(interaction.guild.id, {"logging.attachments.channel": channel.id});
-                const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
+                await client.database.guilds.write(interaction.guild.id, {
+                    "logging.attachments.channel": channel.id
+                });
+                const { log, NucleusColors, entry, renderUser, renderChannel } =
+                    client.logger;
                 const data = {
-                    meta:{
+                    meta: {
                         type: "attachmentChannelUpdate",
                         displayName: "Attachment Log Channel Updated",
                         calculateType: "nucleusSettingsUpdated",
@@ -64,8 +91,14 @@
                         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: {
@@ -74,75 +107,124 @@
                 };
                 log(data);
             } catch (e) {
-                return interaction.editReply({embeds: [new EmojiEmbed()
-                    .setTitle("Attachment Log Channel")
-                    .setDescription("Something went wrong and the attachment log channel could not be set")
-                    .setStatus("Danger")
-                    .setEmoji("CHANNEL.TEXT.DELETE")
-                ], components: []});
+                return interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Attachment Log Channel")
+                            .setDescription(
+                                "Something went wrong and the attachment log channel could not be set"
+                            )
+                            .setStatus("Danger")
+                            .setEmoji("CHANNEL.TEXT.DELETE")
+                    ],
+                    components: []
+                });
             }
         } else {
-            return interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Attachment Log Channel")
-                .setDescription("No changes were made")
-                .setStatus("Success")
-                .setEmoji("CHANNEL.TEXT.CREATE")
-            ], components: []});
+            return interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Attachment Log Channel")
+                        .setDescription("No changes were made")
+                        .setStatus("Success")
+                        .setEmoji("CHANNEL.TEXT.CREATE")
+                ],
+                components: []
+            });
         }
     }
     let clicks = 0;
     const data = await client.database.guilds.read(interaction.guild.id);
     let channel = data.logging.staff.channel;
     while (true) {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Attachment Log Channel")
-            .setDescription(
-                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) ? "" : "\n\nThis server does not have premium, so this feature is disabled")
-            )
-            .setStatus("Success")
-            .setEmoji("CHANNEL.TEXT.CREATE")
-        ], components: [new MessageActionRow().addComponents([new MessageButton()
-            .setCustomId("clear")
-            .setLabel(clicks ? "Click again to confirm" : "Reset channel")
-            .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
-            .setStyle("DANGER")
-            .setDisabled(!channel)
-        ])]});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Attachment Log Channel")
+                    .setDescription(
+                        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
+                                  )
+                                      ? ""
+                                      : "\n\nThis server does not have premium, so this feature is disabled")
+                    )
+                    .setStatus("Success")
+                    .setEmoji("CHANNEL.TEXT.CREATE")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setCustomId("clear")
+                        .setLabel(
+                            clicks ? "Click again to confirm" : "Reset channel"
+                        )
+                        .setEmoji(
+                            getEmojiByName(
+                                clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS",
+                                "id"
+                            )
+                        )
+                        .setStyle("DANGER")
+                        .setDisabled(!channel)
+                ])
+            ]
+        });
         let i;
         try {
-            i = await m.awaitMessageComponent({time: 300000});
-        } catch(e) { break; }
+            i = await m.awaitMessageComponent({ time: 300000 });
+        } catch (e) {
+            break;
+        }
         i.deferUpdate();
         if (i.component.customId === "clear") {
             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 {
             break;
         }
     }
-    await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Attachment Log Channel")
-        .setDescription(channel ? `Your attachment log channel is currently set to <#${channel}>` : "This server does not have an attachment log channel")
-        .setStatus("Success")
-        .setEmoji("CHANNEL.TEXT.CREATE")
-        .setFooter({text: "Message closed"})
-    ], components: [new MessageActionRow().addComponents([new MessageButton()
-        .setCustomId("clear")
-        .setLabel("Clear")
-        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-        .setStyle("SECONDARY")
-        .setDisabled(true)
-    ])]});
+    await interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Attachment Log Channel")
+                .setDescription(
+                    channel
+                        ? `Your attachment log channel is currently set to <#${channel}>`
+                        : "This server does not have an attachment log channel"
+                )
+                .setStatus("Success")
+                .setEmoji("CHANNEL.TEXT.CREATE")
+                .setFooter({ text: "Message closed" })
+        ],
+        components: [
+            new MessageActionRow().addComponents([
+                new MessageButton()
+                    .setCustomId("clear")
+                    .setLabel("Clear")
+                    .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                    .setStyle("SECONDARY")
+                    .setDisabled(true)
+            ])
+        ]
+    });
 };
 
-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";
+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";
     return true;
 };
 
diff --git a/src/commands/settings/logs/channel.ts b/src/commands/settings/logs/channel.ts
index 4d4a392..00d2411 100644
--- a/src/commands/settings/logs/channel.ts
+++ b/src/commands/settings/logs/channel.ts
@@ -1,6 +1,10 @@
 import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
 import { ChannelType } from "discord-api-types";
-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";
@@ -12,47 +16,71 @@
     builder
         .setName("channel")
         .setDescription("Sets or shows the log channel")
-        .addChannelOption(option => option.setName("channel").setDescription("The channel to set the log channel to").addChannelTypes([
-            ChannelType.GuildNews, ChannelType.GuildText
-        ]));
+        .addChannelOption((option) =>
+            option
+                .setName("channel")
+                .setDescription("The channel to set the log channel to")
+                .addChannelTypes([ChannelType.GuildNews, ChannelType.GuildText])
+        );
 
-const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
-    const m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true}) as Discord.Message;
+const callback = async (
+    interaction: CommandInteraction
+): Promise<void | unknown> => {
+    const m = (await interaction.reply({
+        embeds: LoadingEmbed,
+        ephemeral: true,
+        fetchReply: true
+    })) as Discord.Message;
     if (interaction.options.getChannel("channel")) {
         let channel;
         try {
             channel = interaction.options.getChannel("channel");
         } catch {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("CHANNEL.TEXT.DELETE")
-                .setTitle("Log Channel")
-                .setDescription("The channel you provided is not a valid channel")
-                .setStatus("Danger")
-            ]});
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("CHANNEL.TEXT.DELETE")
+                        .setTitle("Log Channel")
+                        .setDescription(
+                            "The channel you provided is not a valid channel"
+                        )
+                        .setStatus("Danger")
+                ]
+            });
         }
         channel = channel as Discord.TextChannel;
         if (channel.guild.id !== interaction.guild.id) {
-            return interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Log Channel")
-                .setDescription("You must choose a channel in this server")
-                .setStatus("Danger")
-                .setEmoji("CHANNEL.TEXT.DELETE")
-            ]});
+            return interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Log Channel")
+                        .setDescription(
+                            "You must choose a channel in this server"
+                        )
+                        .setStatus("Danger")
+                        .setEmoji("CHANNEL.TEXT.DELETE")
+                ]
+            });
         }
         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);
         if (confirmation.cancelled) return;
         if (confirmation.success) {
             try {
-                await client.database.guilds.write(interaction.guild.id, {"logging.logs.channel": channel.id});
-                const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
+                await client.database.guilds.write(interaction.guild.id, {
+                    "logging.logs.channel": channel.id
+                });
+                const { log, NucleusColors, entry, renderUser, renderChannel } =
+                    client.logger;
                 const data = {
-                    meta:{
+                    meta: {
                         type: "logChannelUpdate",
                         displayName: "Log Channel Changed",
                         calculateType: "nucleusSettingsUpdated",
@@ -61,8 +89,14 @@
                         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: {
@@ -72,72 +106,119 @@
                 log(data);
             } catch (e) {
                 console.log(e);
-                return interaction.editReply({embeds: [new EmojiEmbed()
-                    .setTitle("Log Channel")
-                    .setDescription("Something went wrong and the log channel could not be set")
-                    .setStatus("Danger")
-                    .setEmoji("CHANNEL.TEXT.DELETE")
-                ], components: []});
+                return interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Log Channel")
+                            .setDescription(
+                                "Something went wrong and the log channel could not be set"
+                            )
+                            .setStatus("Danger")
+                            .setEmoji("CHANNEL.TEXT.DELETE")
+                    ],
+                    components: []
+                });
             }
         } else {
-            return interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Log Channel")
-                .setDescription("No changes were made")
-                .setStatus("Success")
-                .setEmoji("CHANNEL.TEXT.CREATE")
-            ], components: []});
+            return interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Log Channel")
+                        .setDescription("No changes were made")
+                        .setStatus("Success")
+                        .setEmoji("CHANNEL.TEXT.CREATE")
+                ],
+                components: []
+            });
         }
     }
     let clicks = 0;
     const data = await client.database.guilds.read(interaction.guild.id);
     let channel = data.logging.logs.channel;
     while (true) {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Log channel")
-            .setDescription(channel ? `Your log channel is currently set to <#${channel}>` : "This server does not have a log channel")
-            .setStatus("Success")
-            .setEmoji("CHANNEL.TEXT.CREATE")
-        ], components: [new MessageActionRow().addComponents([new MessageButton()
-            .setCustomId("clear")
-            .setLabel(clicks ? "Click again to confirm" : "Reset channel")
-            .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
-            .setStyle("DANGER")
-            .setDisabled(!channel)
-        ])]});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Log channel")
+                    .setDescription(
+                        channel
+                            ? `Your log channel is currently set to <#${channel}>`
+                            : "This server does not have a log channel"
+                    )
+                    .setStatus("Success")
+                    .setEmoji("CHANNEL.TEXT.CREATE")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setCustomId("clear")
+                        .setLabel(
+                            clicks ? "Click again to confirm" : "Reset channel"
+                        )
+                        .setEmoji(
+                            getEmojiByName(
+                                clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS",
+                                "id"
+                            )
+                        )
+                        .setStyle("DANGER")
+                        .setDisabled(!channel)
+                ])
+            ]
+        });
         let i;
         try {
-            i = await m.awaitMessageComponent({time: 300000});
-        } catch(e) { break; }
+            i = await m.awaitMessageComponent({ time: 300000 });
+        } catch (e) {
+            break;
+        }
         i.deferUpdate();
         if (i.component.customId === "clear") {
             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 {
             break;
         }
     }
-    await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Log channel")
-        .setDescription(channel ? `Your log channel is currently set to <#${channel}>` : "This server does not have a log channel")
-        .setStatus("Success")
-        .setEmoji("CHANNEL.TEXT.CREATE")
-        .setFooter({text: "Message closed"})
-    ], components: [new MessageActionRow().addComponents([new MessageButton()
-        .setCustomId("clear")
-        .setLabel("Clear")
-        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-        .setStyle("SECONDARY")
-        .setDisabled(true)
-    ])]});
+    await interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Log channel")
+                .setDescription(
+                    channel
+                        ? `Your log channel is currently set to <#${channel}>`
+                        : "This server does not have a log channel"
+                )
+                .setStatus("Success")
+                .setEmoji("CHANNEL.TEXT.CREATE")
+                .setFooter({ text: "Message closed" })
+        ],
+        components: [
+            new MessageActionRow().addComponents([
+                new MessageButton()
+                    .setCustomId("clear")
+                    .setLabel("Clear")
+                    .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                    .setStyle("SECONDARY")
+                    .setDisabled(true)
+            ])
+        ]
+    });
 };
 
-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";
+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";
     return true;
 };
 
diff --git a/src/commands/settings/logs/events.ts b/src/commands/settings/logs/events.ts
index 110c70e..a1edcaf 100644
--- a/src/commands/settings/logs/events.ts
+++ b/src/commands/settings/logs/events.ts
@@ -1,33 +1,37 @@
 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";
 import client from "../../../utils/client.js";
 import { toHexArray, toHexInteger } from "../../../utils/calculate.js";
 
-
 const logs = {
-    "channelUpdate": "Channels created, deleted or modified",
-    "emojiUpdate": "Server emojis modified",
-    "stickerUpdate": "Server stickers modified",
-    "guildUpdate": "Server settings updated",
-    "guildMemberUpdate": "Member updated (i.e. nickname)",
-    "guildMemberPunish": "Members punished (i.e. muted, banned, kicked)",
-    "guildRoleUpdate": "Role settings changed",
-    "guildInviteUpdate": "Server invite created or deleted",
-    "messageUpdate": "Message edited",
-    "messageDelete": "Message deleted",
-    "messageDeleteBulk": "Messages purged",
-    "messageReactionUpdate": "Message reactions cleared",
-    "messageMassPing": "Message pings multiple members at once",
-    "messageAnnounce": "Message published in announcement channel",
-    "threadUpdate": "Thread created or deleted",
-    "webhookUpdate": "Webhooks created or deleted",
-    "guildMemberVerify": "Member runs verify",
-    "autoModeratorDeleted": "Messages auto deleted by Nucleus",
-    "nucleusSettingsUpdated": "Nucleus' settings updated by a moderator",
-    "ticketUpdate": "Tickets created or deleted"
+    channelUpdate: "Channels created, deleted or modified",
+    emojiUpdate: "Server emojis modified",
+    stickerUpdate: "Server stickers modified",
+    guildUpdate: "Server settings updated",
+    guildMemberUpdate: "Member updated (i.e. nickname)",
+    guildMemberPunish: "Members punished (i.e. muted, banned, kicked)",
+    guildRoleUpdate: "Role settings changed",
+    guildInviteUpdate: "Server invite created or deleted",
+    messageUpdate: "Message edited",
+    messageDelete: "Message deleted",
+    messageDeleteBulk: "Messages purged",
+    messageReactionUpdate: "Message reactions cleared",
+    messageMassPing: "Message pings multiple members at once",
+    messageAnnounce: "Message published in announcement channel",
+    threadUpdate: "Thread created or deleted",
+    webhookUpdate: "Webhooks created or deleted",
+    guildMemberVerify: "Member runs verify",
+    autoModeratorDeleted: "Messages auto deleted by Nucleus",
+    nucleusSettingsUpdated: "Nucleus' settings updated by a moderator",
+    ticketUpdate: "Tickets created or deleted"
 };
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -36,39 +40,52 @@
         .setDescription("Sets what events should be logged");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
-    await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
+    await interaction.reply({
+        embeds: LoadingEmbed,
+        fetchReply: true,
+        ephemeral: true
+    });
     let m;
     while (true) {
         const config = await client.database.guilds.read(interaction.guild.id);
         const converted = toHexArray(config.logging.logs.toLog);
-        m = await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Logging Events")
-            .setDescription("Below are the events being logged in the server. You can toggle them on and off in the dropdown")
-            .setStatus("Success")
-            .setEmoji("CHANNEL.TEXT.CREATE")
-        ], components: [
-            new MessageActionRow().addComponents([new MessageSelectMenu()
-                .setPlaceholder("Set events to log")
-                .setMaxValues(Object.keys(logs).length)
-                .setCustomId("logs")
-                .setMinValues(0)
-                .setOptions(Object.keys(logs).map((e, i) => ({
-                    label: logs[e],
-                    value: i.toString(),
-                    default: converted.includes(e)
-                })))
-            ]),
-            new MessageActionRow().addComponents([
-                new MessageButton()
-                    .setLabel("Select all")
-                    .setStyle("PRIMARY")
-                    .setCustomId("all"),
-                new MessageButton()
-                    .setLabel("Select none")
-                    .setStyle("DANGER")
-                    .setCustomId("none")
-            ])
-        ]});
+        m = await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Logging Events")
+                    .setDescription(
+                        "Below are the events being logged in the server. You can toggle them on and off in the dropdown"
+                    )
+                    .setStatus("Success")
+                    .setEmoji("CHANNEL.TEXT.CREATE")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageSelectMenu()
+                        .setPlaceholder("Set events to log")
+                        .setMaxValues(Object.keys(logs).length)
+                        .setCustomId("logs")
+                        .setMinValues(0)
+                        .setOptions(
+                            Object.keys(logs).map((e, i) => ({
+                                label: logs[e],
+                                value: i.toString(),
+                                default: converted.includes(e)
+                            }))
+                        )
+                ]),
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setLabel("Select all")
+                        .setStyle("PRIMARY")
+                        .setCustomId("all"),
+                    new MessageButton()
+                        .setLabel("Select none")
+                        .setStyle("DANGER")
+                        .setCustomId("none")
+                ])
+            ]
+        });
         let i;
         try {
             i = await m.awaitMessageComponent({ time: 300000 });
@@ -78,33 +95,50 @@
         i.deferUpdate();
         if (i.customId === "logs") {
             const selected = i.values;
-            const newLogs = toHexInteger(selected.map(e => Object.keys(logs)[parseInt(e)]));
-            await client.database.guilds.write(interaction.guild.id, {"logging.logs.toLog": newLogs});
+            const newLogs = toHexInteger(
+                selected.map((e) => Object.keys(logs)[parseInt(e)])
+            );
+            await client.database.guilds.write(interaction.guild.id, {
+                "logging.logs.toLog": newLogs
+            });
         } else if (i.customId === "all") {
-            const newLogs = toHexInteger(Object.keys(logs).map(e => e));
-            await client.database.guilds.write(interaction.guild.id, {"logging.logs.toLog": newLogs});
+            const newLogs = toHexInteger(Object.keys(logs).map((e) => e));
+            await client.database.guilds.write(interaction.guild.id, {
+                "logging.logs.toLog": newLogs
+            });
         } else if (i.customId === "none") {
-            await client.database.guilds.write(interaction.guild.id, {"logging.logs.toLog": 0});
+            await client.database.guilds.write(interaction.guild.id, {
+                "logging.logs.toLog": 0
+            });
         } else {
             break;
         }
     }
-    m = await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Logging Events")
-        .setDescription("Below are the events being logged in the server. You can toggle them on and off in the dropdown")
-        .setFooter({text: "Message timed out"})
-        .setStatus("Success")
-        .setEmoji("CHANNEL.TEXT.CREATE")
-    ]});
+    m = await interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Logging Events")
+                .setDescription(
+                    "Below are the events being logged in the server. You can toggle them on and off in the dropdown"
+                )
+                .setFooter({ text: "Message timed out" })
+                .setStatus("Success")
+                .setEmoji("CHANNEL.TEXT.CREATE")
+        ]
+    });
     return;
 };
 
-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";
+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";
     return true;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/settings/logs/staff.ts b/src/commands/settings/logs/staff.ts
index 2f0c819..718d13b 100644
--- a/src/commands/settings/logs/staff.ts
+++ b/src/commands/settings/logs/staff.ts
@@ -1,12 +1,16 @@
 import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
 import { ChannelType } from "discord-api-types";
-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";
 import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-ignore
+// @ts-expect-error
 import type { WrappedCheck } from "jshaiku";
 import client from "../../../utils/client.js";
 
@@ -14,40 +18,62 @@
     builder
         .setName("staff")
         .setDescription("Settings for the staff notifications channel")
-        .addChannelOption(option => option.setName("channel").setDescription("The channel to set the staff notifications channel to").addChannelTypes([
-            ChannelType.GuildNews, ChannelType.GuildText
-        ]).setRequired(false));
+        .addChannelOption((option) =>
+            option
+                .setName("channel")
+                .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, ephemeral: true, fetchReply: true}) as Discord.Message<boolean>;
+    const m = (await interaction.reply({
+        embeds: LoadingEmbed,
+        ephemeral: true,
+        fetchReply: true
+    })) as Discord.Message;
     if (interaction.options.getChannel("channel")) {
         let channel;
         try {
             channel = interaction.options.getChannel("channel");
         } catch {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("CHANNEL.TEXT.DELETE")
-                .setTitle("Staff Notifications Channel")
-                .setDescription("The channel you provided is not a valid channel")
-                .setStatus("Danger")
-            ]});
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("CHANNEL.TEXT.DELETE")
+                        .setTitle("Staff Notifications Channel")
+                        .setDescription(
+                            "The channel you provided is not a valid channel"
+                        )
+                        .setStatus("Danger")
+                ]
+            });
         }
         channel = channel as Discord.TextChannel;
         if (channel.guild.id !== interaction.guild.id) {
-            return interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Staff Notifications Channel")
-                .setDescription("You must choose a channel in this server")
-                .setStatus("Danger")
-                .setEmoji("CHANNEL.TEXT.DELETE")
-            ]});
+            return interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Staff Notifications Channel")
+                        .setDescription(
+                            "You must choose a channel in this server"
+                        )
+                        .setStatus("Danger")
+                        .setEmoji("CHANNEL.TEXT.DELETE")
+                ]
+            });
         }
         const confirmation = await new confirmationMessage(interaction)
             .setEmoji("CHANNEL.TEXT.EDIT")
             .setTitle("Staff Notifications Channel")
             .setDescription(
                 "This will be the channel all notifications, updates, user reports etc. will be sent to.\n\n" +
-                `Are you sure you want to set the staff notifications channel to <#${channel.id}>?`
+                    `Are you sure you want to set the staff notifications channel to <#${channel.id}>?`
             )
             .setColor("Warning")
             .setInverted(true)
@@ -55,10 +81,13 @@
         if (confirmation.cancelled) return;
         if (confirmation.success) {
             try {
-                await client.database.guilds.write(interaction.guild.id, {"logging.staff.channel": channel.id});
-                const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
+                await client.database.guilds.write(interaction.guild.id, {
+                    "logging.staff.channel": channel.id
+                });
+                const { log, NucleusColors, entry, renderUser, renderChannel } =
+                    client.logger;
                 const data = {
-                    meta:{
+                    meta: {
                         type: "staffChannelUpdate",
                         displayName: "Staff Notifications Channel Updated",
                         calculateType: "nucleusSettingsUpdated",
@@ -67,8 +96,14 @@
                         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: {
@@ -77,72 +112,119 @@
                 };
                 log(data);
             } catch (e) {
-                return interaction.editReply({embeds: [new EmojiEmbed()
-                    .setTitle("Staff Notifications Channel")
-                    .setDescription("Something went wrong and the staff notifications channel could not be set")
-                    .setStatus("Danger")
-                    .setEmoji("CHANNEL.TEXT.DELETE")
-                ], components: []});
+                return interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Staff Notifications Channel")
+                            .setDescription(
+                                "Something went wrong and the staff notifications channel could not be set"
+                            )
+                            .setStatus("Danger")
+                            .setEmoji("CHANNEL.TEXT.DELETE")
+                    ],
+                    components: []
+                });
             }
         } else {
-            return interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Staff Notifications Channel")
-                .setDescription("No changes were made")
-                .setStatus("Success")
-                .setEmoji("CHANNEL.TEXT.CREATE")
-            ], components: []});
+            return interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Staff Notifications Channel")
+                        .setDescription("No changes were made")
+                        .setStatus("Success")
+                        .setEmoji("CHANNEL.TEXT.CREATE")
+                ],
+                components: []
+            });
         }
     }
     let clicks = 0;
     const data = await client.database.guilds.read(interaction.guild.id);
     let channel = data.logging.staff.channel;
     while (true) {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Staff Notifications channel")
-            .setDescription(channel ? `Your staff notifications channel is currently set to <#${channel}>` : "This server does not have a staff notifications channel")
-            .setStatus("Success")
-            .setEmoji("CHANNEL.TEXT.CREATE")
-        ], components: [new MessageActionRow().addComponents([new MessageButton()
-            .setCustomId("clear")
-            .setLabel(clicks ? "Click again to confirm" : "Reset channel")
-            .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
-            .setStyle("DANGER")
-            .setDisabled(!channel)
-        ])]});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Staff Notifications channel")
+                    .setDescription(
+                        channel
+                            ? `Your staff notifications channel is currently set to <#${channel}>`
+                            : "This server does not have a staff notifications channel"
+                    )
+                    .setStatus("Success")
+                    .setEmoji("CHANNEL.TEXT.CREATE")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setCustomId("clear")
+                        .setLabel(
+                            clicks ? "Click again to confirm" : "Reset channel"
+                        )
+                        .setEmoji(
+                            getEmojiByName(
+                                clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS",
+                                "id"
+                            )
+                        )
+                        .setStyle("DANGER")
+                        .setDisabled(!channel)
+                ])
+            ]
+        });
         let i;
         try {
-            i = await m.awaitMessageComponent({time: 300000});
-        } catch(e) { break; }
+            i = await m.awaitMessageComponent({ time: 300000 });
+        } catch (e) {
+            break;
+        }
         i.deferUpdate();
         if ((i.component as MessageButton).customId === "clear") {
             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 {
             break;
         }
     }
-    await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Staff Notifications channel")
-        .setDescription(channel ? `Your staff notifications channel is currently set to <#${channel}>` : "This server does not have a staff notifications channel")
-        .setStatus("Success")
-        .setEmoji("CHANNEL.TEXT.CREATE")
-        .setFooter({text: "Message closed"})
-    ], components: [new MessageActionRow().addComponents([new MessageButton()
-        .setCustomId("clear")
-        .setLabel("Clear")
-        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-        .setStyle("SECONDARY")
-        .setDisabled(true)
-    ])]});
+    await interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Staff Notifications channel")
+                .setDescription(
+                    channel
+                        ? `Your staff notifications channel is currently set to <#${channel}>`
+                        : "This server does not have a staff notifications channel"
+                )
+                .setStatus("Success")
+                .setEmoji("CHANNEL.TEXT.CREATE")
+                .setFooter({ text: "Message closed" })
+        ],
+        components: [
+            new MessageActionRow().addComponents([
+                new MessageButton()
+                    .setCustomId("clear")
+                    .setLabel("Clear")
+                    .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                    .setStyle("SECONDARY")
+                    .setDisabled(true)
+            ])
+        ]
+    });
 };
 
-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";
+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";
     return true;
 };
 
diff --git a/src/commands/settings/rolemenu.ts b/src/commands/settings/rolemenu.ts
index 9a4ceb0..beb2f35 100644
--- a/src/commands/settings/rolemenu.ts
+++ b/src/commands/settings/rolemenu.ts
@@ -5,20 +5,28 @@
 const command = (builder: SlashCommandSubcommandBuilder) =>
     builder
         .setName("rolemenu")
-        .setDescription("rolemenu")// TODO
-        .addRoleOption(option => option.setName("role").setDescription("The role to give after verifying")); // FIXME FOR FUCK SAKE
+        .setDescription("rolemenu") // TODO
+        .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 member = (interaction.member as Discord.GuildMember);
-    if (!member.permissions.has("MANAGE_ROLES")) throw "You must have the *Manage Roles* permission to use this command";
+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";
     return true;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/settings/stats.ts b/src/commands/settings/stats.ts
index 5a1affd..507e506 100644
--- a/src/commands/settings/stats.ts
+++ b/src/commands/settings/stats.ts
@@ -1,62 +1,112 @@
 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";
 import { WrappedCheck } from "jshaiku";
 import client from "../../utils/client.js";
 import convertCurlyBracketString from "../../utils/convertCurlyBracketString.js";
-import {callback as statsChannelAddCallback} from "../../reflex/statsChannelUpdate.js";
+import { callback as statsChannelAddCallback } from "../../reflex/statsChannelUpdate.js";
 import singleNotify from "../../utils/singleNotify.js";
 
 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"))
-        .addStringOption(option => option.setName("name").setDescription("The new channel name | Enter any text or use the extra variables like {memberCount}").setAutocomplete(true));
+        .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}"
+                )
+                .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, ephemeral: true, fetchReply: true}) as Message;
+    const m = (await interaction.reply({
+        embeds: LoadingEmbed,
+        ephemeral: true,
+        fetchReply: true
+    })) as Message;
     let config = await client.database.guilds.read(interaction.guild.id);
     if (interaction.options.getString("name")) {
         let channel;
         if (Object.keys(config.getKey("stats")).length >= 25) {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("CHANNEL.TEXT.DELETE")
-                .setTitle("Stats Channel")
-                .setDescription("You can only have 25 stats channels in a server")
-                .setStatus("Danger")
-            ]});
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("CHANNEL.TEXT.DELETE")
+                        .setTitle("Stats Channel")
+                        .setDescription(
+                            "You can only have 25 stats channels in a server"
+                        )
+                        .setStatus("Danger")
+                ]
+            });
         }
         try {
             channel = interaction.options.getChannel("channel");
         } catch {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("CHANNEL.TEXT.DELETE")
-                .setTitle("Stats Channel")
-                .setDescription("The channel you provided is not a valid channel")
-                .setStatus("Danger")
-            ]});
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("CHANNEL.TEXT.DELETE")
+                        .setTitle("Stats Channel")
+                        .setDescription(
+                            "The channel you provided is not a valid channel"
+                        )
+                        .setStatus("Danger")
+                ]
+            });
         }
         channel = channel as Discord.TextChannel;
         if (channel.guild.id !== interaction.guild.id) {
-            return interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Stats Channel")
-                .setDescription("You must choose a channel in this server")
-                .setStatus("Danger")
-                .setEmoji("CHANNEL.TEXT.DELETE")
-            ]});
+            return interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Stats Channel")
+                        .setDescription(
+                            "You must choose a channel in this server"
+                        )
+                        .setStatus("Danger")
+                        .setEmoji("CHANNEL.TEXT.DELETE")
+                ]
+            });
         }
-        let newName = await convertCurlyBracketString(interaction.options.getString("name"), null, null, interaction.guild.name, interaction.guild.members);
+        let newName = await convertCurlyBracketString(
+            interaction.options.getString("name"),
+            null,
+            null,
+            interaction.guild.name,
+            interaction.guild.members
+        );
         if (interaction.options.getChannel("channel").type === "GUILD_TEXT") {
             newName = newName.toLowerCase().replace(/[\s]/g, "-");
         }
         const confirmation = await new confirmationMessage(interaction)
             .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(/^ +| $/g, "")}*`)
+            .setDescription(
+                `Are you sure you want to set <#${
+                    channel.id
+                }> to a stats channel?\n\n*Preview: ${newName.replace(
+                    /^ +| $/g,
+                    ""
+                )}*`
+            )
             .setColor("Warning")
             .setInverted(true)
             .send(true);
@@ -65,10 +115,13 @@
             try {
                 const name = interaction.options.getString("name");
                 const channel = interaction.options.getChannel("channel");
-                await client.database.guilds.write(interaction.guild.id, {[`stats.${channel.id}`]: {name: name, enabled: true}});
-                const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
+                await client.database.guilds.write(interaction.guild.id, {
+                    [`stats.${channel.id}`]: { name: name, enabled: true }
+                });
+                const { log, NucleusColors, entry, renderUser, renderChannel } =
+                    client.logger;
                 const data = {
-                    meta:{
+                    meta: {
                         type: "statsChannelUpdate",
                         displayName: "Stats Channel Updated",
                         calculateType: "nucleusSettingsUpdated",
@@ -77,10 +130,19 @@
                         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"), `\`${interaction.options.getString("name")}\``)
+                        name: entry(
+                            interaction.options.getString("name"),
+                            `\`${interaction.options.getString("name")}\``
+                        )
                     },
                     hidden: {
                         guild: interaction.guild.id
@@ -89,20 +151,30 @@
                 log(data);
             } catch (e) {
                 console.log(e);
-                return interaction.editReply({embeds: [new EmojiEmbed()
-                    .setTitle("Stats Channel")
-                    .setDescription("Something went wrong and the stats channel could not be set")
-                    .setStatus("Danger")
-                    .setEmoji("CHANNEL.TEXT.DELETE")
-                ], components: []});
+                return interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Stats Channel")
+                            .setDescription(
+                                "Something went wrong and the stats channel could not be set"
+                            )
+                            .setStatus("Danger")
+                            .setEmoji("CHANNEL.TEXT.DELETE")
+                    ],
+                    components: []
+                });
             }
         } else {
-            return interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Stats Channel")
-                .setDescription("No changes were made")
-                .setStatus("Success")
-                .setEmoji("CHANNEL.TEXT.CREATE")
-            ], components: []});
+            return interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Stats Channel")
+                        .setDescription("No changes were made")
+                        .setStatus("Success")
+                        .setEmoji("CHANNEL.TEXT.CREATE")
+                ],
+                components: []
+            });
         }
         await statsChannelAddCallback(client, interaction.member);
     }
@@ -113,41 +185,83 @@
             .setCustomId("remove")
             .setMinValues(1)
             .setMaxValues(Math.max(1, Object.keys(stats).length));
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Stats Channel")
-            .setDescription("The following channels update when someone joins or leaves the server. You can select a channel to remove it from the list.")
-            .setStatus("Success")
-            .setEmoji("CHANNEL.TEXT.CREATE")
-        ], components: [
-            new MessageActionRow().addComponents(Object.keys(stats).length ? [
-                selectMenu.setPlaceholder("Select a stats channel to remove, stopping it updating").addOptions(Object.keys(stats).map(key => ({
-                    label: interaction.guild.channels.cache.get(key).name,
-                    value: key,
-                    description: `${stats[key].name}`
-                })))
-            ] : [selectMenu.setPlaceholder("The server has no stats channels").setDisabled(true).setOptions([
-                {label: "*Placeholder*", value: "placeholder", description: "No stats channels"}
-            ])])
-        ]});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Stats Channel")
+                    .setDescription(
+                        "The following channels update when someone joins or leaves the server. You can select a channel to remove it from the list."
+                    )
+                    .setStatus("Success")
+                    .setEmoji("CHANNEL.TEXT.CREATE")
+            ],
+            components: [
+                new MessageActionRow().addComponents(
+                    Object.keys(stats).length
+                        ? [
+                              selectMenu
+                                  .setPlaceholder(
+                                      "Select a stats channel to remove, stopping it updating"
+                                  )
+                                  .addOptions(
+                                      Object.keys(stats).map((key) => ({
+                                          label: interaction.guild.channels.cache.get(
+                                              key
+                                          ).name,
+                                          value: key,
+                                          description: `${stats[key].name}`
+                                      }))
+                                  )
+                          ]
+                        : [
+                              selectMenu
+                                  .setPlaceholder(
+                                      "The server has no stats channels"
+                                  )
+                                  .setDisabled(true)
+                                  .setOptions([
+                                      {
+                                          label: "*Placeholder*",
+                                          value: "placeholder",
+                                          description: "No stats channels"
+                                      }
+                                  ])
+                          ]
+                )
+            ]
+        });
         let i;
         try {
             i = await m.awaitMessageComponent({ time: 300000 });
-        } catch (e) { break; }
+        } catch (e) {
+            break;
+        }
         i.deferUpdate();
         if (i.customId === "remove") {
             const toRemove = i.values;
-            await client.database.guilds.write(interaction.guild.id, null, toRemove.map(k => `stats.${k}`));
+            await client.database.guilds.write(
+                interaction.guild.id,
+                null,
+                toRemove.map((k) => `stats.${k}`)
+            );
         }
     }
-    await interaction.editReply({embeds: [(m.embeds[0] as Discord.MessageEmbed).setFooter({text: "Message closed"})], components: []});
+    await interaction.editReply({
+        embeds: [m.embeds[0]!.setFooter({ text: "Message closed" })],
+        components: []
+    });
 };
 
-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";
+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";
     return true;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index f9df71c..5e5cbe7 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -2,103 +2,198 @@
 import getEmojiByName from "../../utils/getEmojiByName.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import confirmationMessage from "../../utils/confirmationMessage.js";
-import Discord, { CommandInteraction, GuildChannel, Message, MessageActionRow, MessageActionRowComponent, MessageButton, MessageComponentInteraction, MessageSelectMenu, Role, SelectMenuInteraction, TextInputComponent } from "discord.js";
-import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import Discord, {
+    CommandInteraction,
+    GuildChannel,
+    Message,
+    MessageActionRow,
+    MessageActionRowComponent,
+    MessageButton,
+    MessageComponentInteraction,
+    MessageSelectMenu,
+    Role,
+    SelectMenuInteraction,
+    TextInputComponent
+} from "discord.js";
+import {
+    SelectMenuOption,
+    SlashCommandSubcommandBuilder
+} from "@discordjs/builders";
 import { ChannelType } from "discord-api-types";
 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";
+import { GuildConfig } from "../../utils/database.js";
 
-const command = (builder: SlashCommandSubcommandBuilder) => builder
-    .setName("tickets")
-    .setDescription("Shows settings for tickets | Use no arguments to manage custom types")
-    .addStringOption(option => option.setName("enabled").setDescription("If users should be able to create tickets").setRequired(false)
-        .addChoices([["Yes", "yes"], ["No", "no"]]))
-    .addChannelOption(option => option.setName("category").setDescription("The category where tickets are created").addChannelType(ChannelType.GuildCategory).setRequired(false))
-    .addNumberOption(option => option.setName("maxticketsperuser").setDescription("The maximum amount of tickets a user can create | Default: 5").setRequired(false).setMinValue(1))
-    .addRoleOption(option => option.setName("supportrole").setDescription("This role will have view access to all tickets and will be pinged when a ticket is created").setRequired(false));
+const command = (builder: SlashCommandSubcommandBuilder) =>
+    builder
+        .setName("tickets")
+        .setDescription(
+            "Shows settings for tickets | Use no arguments to manage custom types"
+        )
+        .addStringOption((option) =>
+            option
+                .setName("enabled")
+                .setDescription("If users should be able to create tickets")
+                .setRequired(false)
+                .addChoices([
+                    ["Yes", "yes"],
+                    ["No", "no"]
+                ])
+        )
+        .addChannelOption((option) =>
+            option
+                .setName("category")
+                .setDescription("The category where tickets are created")
+                .addChannelType(ChannelType.GuildCategory)
+                .setRequired(false)
+        )
+        .addNumberOption((option) =>
+            option
+                .setName("maxticketsperuser")
+                .setDescription(
+                    "The maximum amount of tickets a user can create | Default: 5"
+                )
+                .setRequired(false)
+                .setMinValue(1)
+        )
+        .addRoleOption((option) =>
+            option
+                .setName("supportrole")
+                .setDescription(
+                    "This role will have view access to all tickets and will be pinged when a ticket is created"
+                )
+                .setRequired(false)
+        );
 
-const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
-    let m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true}) as Message;
+const callback = async (
+    interaction: CommandInteraction
+): Promise<void | unknown> => {
+    let m = (await interaction.reply({
+        embeds: LoadingEmbed,
+        ephemeral: true,
+        fetchReply: true
+    })) as Message;
     const options = {
         enabled: interaction.options.getString("enabled") as string | boolean,
         category: interaction.options.getChannel("category"),
         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")
-                        .setStatus("Danger")
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("CHANNEL.TEXT.DELETE")
+                            .setTitle("Tickets > Category")
+                            .setDescription(
+                                "The channel you provided is not a valid category"
+                            )
+                            .setStatus("Danger")
                     ]
                 });
             }
             channel = channel as Discord.CategoryChannel;
-            if (channel.guild.id !== interaction.guild.id) return interaction.editReply({
-                embeds: [new EmojiEmbed()
-                    .setTitle("Tickets > Category")
-                    .setDescription("You must choose a category in this server")
-                    .setStatus("Danger")
-                    .setEmoji("CHANNEL.TEXT.DELETE")
-                ]
-            });
+            if (channel.guild.id !== interaction.guild.id)
+                return interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Tickets > Category")
+                            .setDescription(
+                                "You must choose a category in this server"
+                            )
+                            .setStatus("Danger")
+                            .setEmoji("CHANNEL.TEXT.DELETE")
+                    ]
+                });
         }
         if (options.maxtickets) {
-            if (options.maxtickets < 1) return interaction.editReply({
-                embeds: [new EmojiEmbed()
-                    .setTitle("Tickets > Max Tickets")
-                    .setDescription("You must choose a number greater than 0")
-                    .setStatus("Danger")
-                    .setEmoji("CHANNEL.TEXT.DELETE")
-                ]
-            });
+            if (options.maxtickets < 1)
+                return interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Tickets > Max Tickets")
+                            .setDescription(
+                                "You must choose a number greater than 0"
+                            )
+                            .setStatus("Danger")
+                            .setEmoji("CHANNEL.TEXT.DELETE")
+                    ]
+                });
         }
         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")
-                        .setStatus("Danger")
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("GUILD.ROLE.DELETE")
+                            .setTitle("Tickets > Support Ping")
+                            .setDescription(
+                                "The role you provided is not a valid role"
+                            )
+                            .setStatus("Danger")
                     ]
                 });
             }
             role = role as Discord.Role;
-            if (role.guild.id !== interaction.guild.id) return interaction.editReply({
-                embeds: [new EmojiEmbed()
-                    .setTitle("Tickets > Support Ping")
-                    .setDescription("You must choose a role in this server")
-                    .setStatus("Danger")
-                    .setEmoji("GUILD.ROLE.DELETE")
-                ]
-            });
+            if (role.guild.id !== interaction.guild.id)
+                return interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Tickets > Support Ping")
+                            .setDescription(
+                                "You must choose a role in this server"
+                            )
+                            .setStatus("Danger")
+                            .setEmoji("GUILD.ROLE.DELETE")
+                    ]
+                });
         }
 
         const confirmation = await new confirmationMessage(interaction)
             .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.enabled !== null ? `**Enabled:** ${options.enabled ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`
-                }\n` : "") +
-                "\nAre you sure you want to apply these settings?"
+                (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
+                                  ? `${getEmojiByName("CONTROL.TICK")} Yes`
+                                  : `${getEmojiByName("CONTROL.CROSS")} No`
+                          }\n`
+                        : "") +
+                    "\nAre you sure you want to apply these settings?"
             )
             .setColor("Warning")
             .setInverted(true)
@@ -106,35 +201,51 @@
         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")
-                        .setStatus("Danger")
-                        .setEmoji("GUILD.TICKET.DELETE")
-                    ], components: []
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Tickets")
+                            .setDescription(
+                                "Something went wrong and the staff notifications channel could not be set"
+                            )
+                            .setStatus("Danger")
+                            .setEmoji("GUILD.TICKET.DELETE")
+                    ],
+                    components: []
                 });
             }
         } else {
             return interaction.editReply({
-                embeds: [new EmojiEmbed()
-                    .setTitle("Tickets")
-                    .setDescription("No changes were made")
-                    .setStatus("Success")
-                    .setEmoji("GUILD.TICKET.OPEN")
-                ], components: []
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Tickets")
+                        .setDescription("No changes were made")
+                        .setStatus("Success")
+                        .setEmoji("GUILD.TICKET.OPEN")
+                ],
+                components: []
             });
         }
     }
     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);
+    data.tickets.customTypes = (data.tickets.customTypes || []).filter(
+        (value: string, index: number, array: string[]) =>
+            array.indexOf(value) === index
+    );
     let lastClicked = "";
     let embed: EmojiEmbed;
     data = {
@@ -150,235 +261,449 @@
         embed = new EmojiEmbed()
             .setTitle("Tickets")
             .setDescription(
-                `${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 ? `<#${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")} ` : "") +
-                `${data.useCustom ? "Custom" : "Default"} types in use` + "\n\n" +
-                `${getEmojiByName("TICKETS.REPORT")} *Indicates a setting stopping tickets from being used*`
+                `${
+                    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 ? `<#${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")} `
+                        : "") +
+                    `${data.useCustom ? "Custom" : "Default"} types in use` +
+                    "\n\n" +
+                    `${getEmojiByName(
+                        "TICKETS.REPORT"
+                    )} *Indicates a setting stopping tickets from being used*`
             )
             .setStatus("Success")
             .setEmoji("GUILD.TICKET.OPEN");
-        m = await interaction.editReply({
-            embeds: [embed], components: [new MessageActionRow().addComponents([
-                new MessageButton()
-                    .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")
-                    .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")
-                    .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")
-                    .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-                    .setStyle("DANGER")
-                    .setCustomId("clearSupportPing")
-                    .setDisabled(data.supportRole === null)
-            ]), new MessageActionRow().addComponents([
-                new MessageButton()
-                    .setLabel("Manage types")
-                    .setEmoji(getEmojiByName("TICKETS.OTHER", "id"))
-                    .setStyle("SECONDARY")
-                    .setCustomId("manageTypes"),
-                new MessageButton()
-                    .setLabel("Add create ticket button")
-                    .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
-                    .setStyle("PRIMARY")
-                    .setCustomId("send")
-            ])]
-        }) as Message;
+        m = (await interaction.editReply({
+            embeds: [embed],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .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"
+                        )
+                        .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"
+                        )
+                        .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"
+                        )
+                        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                        .setStyle("DANGER")
+                        .setCustomId("clearSupportPing")
+                        .setDisabled(data.supportRole === null)
+                ]),
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setLabel("Manage types")
+                        .setEmoji(getEmojiByName("TICKETS.OTHER", "id"))
+                        .setStyle("SECONDARY")
+                        .setCustomId("manageTypes"),
+                    new MessageButton()
+                        .setLabel("Add create ticket button")
+                        .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
+                        .setStyle("PRIMARY")
+                        .setCustomId("send")
+                ])
+            ]
+        })) as Message;
         let i: MessageComponentInteraction;
         try {
             i = await m.awaitMessageComponent({ time: 300000 });
-        } catch (e) { break; }
+        } catch (e) {
+            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", description: "Click the button below to create a ticket"},
-                {label: "Issues, questions or feedback?", 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"}
+                {
+                    label: "Create ticket",
+                    description: "Click the button below to create a ticket"
+                },
+                {
+                    label: "Issues, questions or feedback?",
+                    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"
+                }
             ];
             while (true) {
                 const enabled = data.enabled && data.category !== null;
-                await interaction.editReply({embeds: [new EmojiEmbed()
-                    .setTitle("Ticket Button")
-                    .setDescription("Select a message template to send in this channel")
-                    .setFooter({text: enabled ? "" : "Tickets are not set up correctly so the button may not work for users. Check the main menu to find which options must be set."})
-                    .setStatus(enabled ? "Success" : "Warning")
-                    .setEmoji("GUILD.ROLES.CREATE")
-                ], components: [
-                    new MessageActionRow().addComponents([
-                        new MessageSelectMenu().setOptions(ticketMessages.map((t: {label: string, description: string, value?: string}, index) => {
-                            t.value = index.toString(); return t as {value: string, label: string, description: string};
-                        })).setCustomId("template").setMaxValues(1).setMinValues(1).setPlaceholder("Select a message template")
-                    ]),
-                    new MessageActionRow().addComponents([
-                        new MessageButton()
-                            .setCustomId("back")
-                            .setLabel("Back")
-                            .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
-                            .setStyle("DANGER"),
-                        new MessageButton()
-                            .setCustomId("blank")
-                            .setLabel("Empty")
-                            .setStyle("SECONDARY"),
-                        new MessageButton()
-                            .setCustomId("custom")
-                            .setLabel("Custom")
-                            .setEmoji(getEmojiByName("TICKETS.OTHER", "id"))
-                            .setStyle("PRIMARY")
-                    ])
-                ]});
+                await interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Ticket Button")
+                            .setDescription(
+                                "Select a message template to send in this channel"
+                            )
+                            .setFooter({
+                                text: enabled
+                                    ? ""
+                                    : "Tickets are not set up correctly so the button may not work for users. Check the main menu to find which options must be set."
+                            })
+                            .setStatus(enabled ? "Success" : "Warning")
+                            .setEmoji("GUILD.ROLES.CREATE")
+                    ],
+                    components: [
+                        new MessageActionRow().addComponents([
+                            new MessageSelectMenu()
+                                .setOptions(
+                                    ticketMessages.map(
+                                        (
+                                            t: {
+                                                label: string;
+                                                description: string;
+                                                value?: string;
+                                            },
+                                            index
+                                        ) => {
+                                            t.value = index.toString();
+                                            return t as {
+                                                value: string;
+                                                label: string;
+                                                description: string;
+                                            };
+                                        }
+                                    )
+                                )
+                                .setCustomId("template")
+                                .setMaxValues(1)
+                                .setMinValues(1)
+                                .setPlaceholder("Select a message template")
+                        ]),
+                        new MessageActionRow().addComponents([
+                            new MessageButton()
+                                .setCustomId("back")
+                                .setLabel("Back")
+                                .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                                .setStyle("DANGER"),
+                            new MessageButton()
+                                .setCustomId("blank")
+                                .setLabel("Empty")
+                                .setStyle("SECONDARY"),
+                            new MessageButton()
+                                .setCustomId("custom")
+                                .setLabel("Custom")
+                                .setEmoji(getEmojiByName("TICKETS.OTHER", "id"))
+                                .setStyle("PRIMARY")
+                        ])
+                    ]
+                });
                 let i: MessageComponentInteraction;
                 try {
-                    i = await m.awaitMessageComponent({time: 300000});
-                } catch(e) { break; }
-                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)
-                        .setDescription(ticketMessages[parseInt((i as SelectMenuInteraction).values[0])].description)
-                        .setStatus("Success")
-                        .setEmoji("GUILD.TICKET.OPEN")
-                    ], components: [new MessageActionRow().addComponents([new MessageButton()
-                        .setLabel("Create Ticket")
-                        .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
-                        .setStyle("SUCCESS")
-                        .setCustomId("createticket")
-                    ])]});
+                    i = await m.awaitMessageComponent({ time: 300000 });
+                } catch (e) {
                     break;
-                } else if ((i.component as MessageActionRowComponent).customId === "blank") {
+                }
+                if (
+                    (i.component as MessageActionRowComponent).customId ===
+                    "template"
+                ) {
                     i.deferUpdate();
-                    await interaction.channel.send({components: [new MessageActionRow().addComponents([new MessageButton()
-                        .setLabel("Create Ticket")
-                        .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
-                        .setStyle("SUCCESS")
-                        .setCustomId("createticket")
-                    ])]});
+                    await interaction.channel.send({
+                        embeds: [
+                            new EmojiEmbed()
+                                .setTitle(
+                                    ticketMessages[
+                                        parseInt(
+                                            (i as SelectMenuInteraction)
+                                                .values[0]
+                                        )
+                                    ].label
+                                )
+                                .setDescription(
+                                    ticketMessages[
+                                        parseInt(
+                                            (i as SelectMenuInteraction)
+                                                .values[0]
+                                        )
+                                    ].description
+                                )
+                                .setStatus("Success")
+                                .setEmoji("GUILD.TICKET.OPEN")
+                        ],
+                        components: [
+                            new MessageActionRow().addComponents([
+                                new MessageButton()
+                                    .setLabel("Create Ticket")
+                                    .setEmoji(
+                                        getEmojiByName("CONTROL.TICK", "id")
+                                    )
+                                    .setStyle("SUCCESS")
+                                    .setCustomId("createticket")
+                            ])
+                        ]
+                    });
                     break;
-                } else if ((i.component as MessageActionRowComponent).customId === "custom") {
-                    await i.showModal(new Discord.Modal().setCustomId("modal").setTitle("Enter embed details").addComponents(
-                        new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
-                            .setCustomId("title")
-                            .setLabel("Title")
-                            .setMaxLength(256)
-                            .setRequired(true)
-                            .setStyle("SHORT")
-                        ),
-                        new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
-                            .setCustomId("description")
-                            .setLabel("Description")
-                            .setMaxLength(4000)
-                            .setRequired(true)
-                            .setStyle("PARAGRAPH")
-                        )
-                    ));
+                } 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"
+                                        )
+                                    )
+                                    .setStyle("SUCCESS")
+                                    .setCustomId("createticket")
+                            ])
+                        ]
+                    });
+                    break;
+                } else if (
+                    (i.component as MessageActionRowComponent).customId ===
+                    "custom"
+                ) {
+                    await i.showModal(
+                        new Discord.Modal()
+                            .setCustomId("modal")
+                            .setTitle("Enter embed details")
+                            .addComponents(
+                                new MessageActionRow<TextInputComponent>().addComponents(
+                                    new TextInputComponent()
+                                        .setCustomId("title")
+                                        .setLabel("Title")
+                                        .setMaxLength(256)
+                                        .setRequired(true)
+                                        .setStyle("SHORT")
+                                ),
+                                new MessageActionRow<TextInputComponent>().addComponents(
+                                    new TextInputComponent()
+                                        .setCustomId("description")
+                                        .setLabel("Description")
+                                        .setMaxLength(4000)
+                                        .setRequired(true)
+                                        .setStyle("PARAGRAPH")
+                                )
+                            )
+                    );
                     await interaction.editReply({
-                        embeds: [new EmojiEmbed()
-                            .setTitle("Ticket Button")
-                            .setDescription("Modal opened. If you can't see it, click back and try again.")
-                            .setStatus("Success")
-                            .setEmoji("GUILD.TICKET.OPEN")
-                        ], components: [new MessageActionRow().addComponents([new MessageButton()
-                            .setLabel("Back")
-                            .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
-                            .setStyle("PRIMARY")
-                            .setCustomId("back")
-                        ])]
+                        embeds: [
+                            new EmojiEmbed()
+                                .setTitle("Ticket Button")
+                                .setDescription(
+                                    "Modal opened. If you can't see it, click back and try again."
+                                )
+                                .setStatus("Success")
+                                .setEmoji("GUILD.TICKET.OPEN")
+                        ],
+                        components: [
+                            new MessageActionRow().addComponents([
+                                new MessageButton()
+                                    .setLabel("Back")
+                                    .setEmoji(
+                                        getEmojiByName("CONTROL.LEFT", "id")
+                                    )
+                                    .setStyle("PRIMARY")
+                                    .setCustomId("back")
+                            ])
+                        ]
                     });
                     let out;
                     try {
-                        out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (m) => m.customId === "modify");
-                    } catch (e) { break; }
+                        out = await modalInteractionCollector(
+                            m,
+                            (m) => m.channel.id === interaction.channel.id,
+                            (m) => m.customId === "modify"
+                        );
+                    } catch (e) {
+                        break;
+                    }
                     if (out.fields) {
                         const title = out.fields.getTextInputValue("title");
-                        const description = out.fields.getTextInputValue("description");
-                        await interaction.channel.send({embeds: [new EmojiEmbed()
-                            .setTitle(title)
-                            .setDescription(description)
-                            .setStatus("Success")
-                            .setEmoji("GUILD.TICKET.OPEN")
-                        ], components: [new MessageActionRow().addComponents([new MessageButton()
-                            .setLabel("Create Ticket")
-                            .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
-                            .setStyle("SUCCESS")
-                            .setCustomId("createticket")
-                        ])]});
+                        const description =
+                            out.fields.getTextInputValue("description");
+                        await interaction.channel.send({
+                            embeds: [
+                                new EmojiEmbed()
+                                    .setTitle(title)
+                                    .setDescription(description)
+                                    .setStatus("Success")
+                                    .setEmoji("GUILD.TICKET.OPEN")
+                            ],
+                            components: [
+                                new MessageActionRow().addComponents([
+                                    new MessageButton()
+                                        .setLabel("Create Ticket")
+                                        .setEmoji(
+                                            getEmojiByName(
+                                                "TICKETS.SUGGESTION",
+                                                "id"
+                                            )
+                                        )
+                                        .setStyle("SUCCESS")
+                                        .setCustomId("createticket")
+                                ])
+                            ]
+                        });
                         break;
-                    } else { continue; }
+                    } else {
+                        continue;
+                    }
                 }
             }
-        } else if ((i.component as MessageActionRowComponent).customId === "enabled") {
-            await client.database.guilds.write(interaction.guild.id, { "tickets.enabled": !data.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;
         }
     }
-    await interaction.editReply({ embeds: [embed.setFooter({ text: "Message closed" })], components: [] });
+    await interaction.editReply({
+        embeds: [embed.setFooter({ text: "Message closed" })],
+        components: []
+    });
 };
 
-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;
             await interaction.editReply({
-                embeds: [new EmojiEmbed()
-                    .setTitle("Tickets > Types")
-                    .setDescription(
-                        "**Custom types enabled**\n\n" +
-                        "**Types in use:**\n" + ((customTypes !== null) ?
-                            (customTypes.map((t) => `> ${t}`).join("\n")) :
-                            "*None set*"
-                        ) + "\n\n" + (customTypes === null ?
-                            `${getEmojiByName("TICKETS.REPORT")} Having no types will disable tickets. Please add at least 1 type or use default types` : ""
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Tickets > Types")
+                        .setDescription(
+                            "**Custom types enabled**\n\n" +
+                                "**Types in use:**\n" +
+                                (customTypes !== null
+                                    ? customTypes
+                                          .map((t) => `> ${t}`)
+                                          .join("\n")
+                                    : "*None set*") +
+                                "\n\n" +
+                                (customTypes === null
+                                    ? `${getEmojiByName(
+                                          "TICKETS.REPORT"
+                                      )} Having no types will disable tickets. Please add at least 1 type or use default types`
+                                    : "")
                         )
-                    )
-                    .setStatus("Success")
-                    .setEmoji("GUILD.TICKET.OPEN")
-                ], components: (customTypes ? [
-                    new MessageActionRow().addComponents([new Discord.MessageSelectMenu()
-                        .setCustomId("removeTypes")
-                        .setPlaceholder("Select types to remove")
-                        .setMaxValues(customTypes.length)
-                        .setMinValues(1)
-                        .addOptions(customTypes.map((t) => ({
-                            label: t,
-                            value: t
-                        })))
-                    ])
-                ] : []).concat([
+                        .setStatus("Success")
+                        .setEmoji("GUILD.TICKET.OPEN")
+                ],
+                components: (customTypes
+                    ? [
+                          new MessageActionRow().addComponents([
+                              new Discord.MessageSelectMenu()
+                                  .setCustomId("removeTypes")
+                                  .setPlaceholder("Select types to remove")
+                                  .setMaxValues(customTypes.length)
+                                  .setMinValues(1)
+                                  .addOptions(
+                                      customTypes.map((t) => ({
+                                          label: t,
+                                          value: t
+                                      }))
+                                  )
+                          ])
+                      ]
+                    : []
+                ).concat([
                     new MessageActionRow().addComponents([
                         new MessageButton()
                             .setLabel("Back")
@@ -387,10 +712,14 @@
                             .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")
@@ -401,13 +730,20 @@
         } else {
             const inUse = toHexArray(data.types, ticketTypes);
             const options = [];
-            ticketTypes.forEach(type => {
-                options.push(new SelectMenuOption({
-                    label: capitalize(type),
-                    value: type,
-                    emoji: client.emojis.cache.get(getEmojiByName(`TICKETS.${type.toUpperCase()}`, "id")),
-                    default: inUse.includes(type)
-                }));
+            ticketTypes.forEach((type) => {
+                options.push(
+                    new SelectMenuOption({
+                        label: capitalize(type),
+                        value: type,
+                        emoji: client.emojis.cache.get(
+                            getEmojiByName(
+                                `TICKETS.${type.toUpperCase()}`,
+                                "id"
+                            )
+                        ),
+                        default: inUse.includes(type)
+                    })
+                );
             });
             const selectPane = new MessageActionRow().addComponents([
                 new Discord.MessageSelectMenu()
@@ -418,16 +754,25 @@
                     .setPlaceholder("Select types to use")
             ]);
             await interaction.editReply({
-                embeds: [new EmojiEmbed()
-                    .setTitle("Tickets > Types")
-                    .setDescription(
-                        "**Default types enabled**\n\n" +
-                        "**Types in use:**\n" +
-                        (inUse.map((t) => `> ${getEmojiByName("TICKETS." + t.toUpperCase())} ${capitalize(t)}`).join("\n"))
-                    )
-                    .setStatus("Success")
-                    .setEmoji("GUILD.TICKET.OPEN")
-                ], components: [
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Tickets > Types")
+                        .setDescription(
+                            "**Default types enabled**\n\n" +
+                                "**Types in use:**\n" +
+                                inUse
+                                    .map(
+                                        (t) =>
+                                            `> ${getEmojiByName(
+                                                "TICKETS." + t.toUpperCase()
+                                            )} ${capitalize(t)}`
+                                    )
+                                    .join("\n")
+                        )
+                        .setStatus("Success")
+                        .setEmoji("GUILD.TICKET.OPEN")
+                ],
+                components: [
                     selectPane,
                     new MessageActionRow().addComponents([
                         new MessageButton()
@@ -446,11 +791,15 @@
         let i;
         try {
             i = await m.awaitMessageComponent({ time: 300000 });
-        } catch (e) { break; }
+        } catch (e) {
+            break;
+        }
         if (i.component.customId === "types") {
             i.deferUpdate();
             const types = toHexInteger(i.values, ticketTypes);
-            await client.database.guilds.write(interaction.guild.id, { "tickets.types": types });
+            await client.database.guilds.write(interaction.guild.id, {
+                "tickets.types": types
+            });
             data.types = types;
         } else if (i.component.customId === "removeTypes") {
             i.deferUpdate();
@@ -459,57 +808,96 @@
             if (customTypes) {
                 customTypes = customTypes.filter((t) => !types.includes(t));
                 customTypes = customTypes.length > 0 ? customTypes : null;
-                await client.database.guilds.write(interaction.guild.id, { "tickets.customTypes": customTypes });
+                await client.database.guilds.write(interaction.guild.id, {
+                    "tickets.customTypes": customTypes
+                });
                 data.customTypes = customTypes;
             }
         } else if (i.component.customId === "addType") {
-            await i.showModal(new Discord.Modal().setCustomId("modal").setTitle("Enter a name for the new type").addComponents(
-                new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
-                    .setCustomId("type")
-                    .setLabel("Name")
-                    .setMaxLength(100)
-                    .setMinLength(1)
-                    .setPlaceholder("E.g. \"Server Idea\"")
-                    .setRequired(true)
-                    .setStyle("SHORT")
-                )
-            ));
+            await i.showModal(
+                new Discord.Modal()
+                    .setCustomId("modal")
+                    .setTitle("Enter a name for the new type")
+                    .addComponents(
+                        new MessageActionRow<TextInputComponent>().addComponents(
+                            new TextInputComponent()
+                                .setCustomId("type")
+                                .setLabel("Name")
+                                .setMaxLength(100)
+                                .setMinLength(1)
+                                .setPlaceholder('E.g. "Server Idea"')
+                                .setRequired(true)
+                                .setStyle("SHORT")
+                        )
+                    )
+            );
             await interaction.editReply({
-                embeds: [new EmojiEmbed()
-                    .setTitle("Tickets > Types")
-                    .setDescription("Modal opened. If you can't see it, click back and try again.")
-                    .setStatus("Success")
-                    .setEmoji("GUILD.TICKET.OPEN")
-                ], components: [new MessageActionRow().addComponents([new MessageButton()
-                    .setLabel("Back")
-                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
-                    .setStyle("PRIMARY")
-                    .setCustomId("back")
-                ])]
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Tickets > Types")
+                        .setDescription(
+                            "Modal opened. If you can't see it, click back and try again."
+                        )
+                        .setStatus("Success")
+                        .setEmoji("GUILD.TICKET.OPEN")
+                ],
+                components: [
+                    new MessageActionRow().addComponents([
+                        new MessageButton()
+                            .setLabel("Back")
+                            .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                            .setStyle("PRIMARY")
+                            .setCustomId("back")
+                    ])
+                ]
             });
             let out;
             try {
-                out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (m) => m.customId === "addType");
-            } catch (e) { continue; }
+                out = await modalInteractionCollector(
+                    m,
+                    (m) => m.channel.id === interaction.channel.id,
+                    (m) => m.customId === "addType"
+                );
+            } catch (e) {
+                continue;
+            }
             if (out.fields) {
                 let toAdd = out.fields.getTextInputValue("type");
-                if (!toAdd) { continue; }
+                if (!toAdd) {
+                    continue;
+                }
                 toAdd = toAdd.substring(0, 80);
                 try {
-                    await client.database.guilds.append(interaction.guild.id, "tickets.customTypes", toAdd);
-                } catch { continue; }
+                    await client.database.guilds.append(
+                        interaction.guild.id,
+                        "tickets.customTypes",
+                        toAdd
+                    );
+                } catch {
+                    continue;
+                }
                 data.customTypes = data.customTypes || [];
                 if (!data.customTypes.includes(toAdd)) {
                     data.customTypes.push(toAdd);
                 }
-            } else { continue; }
+            } else {
+                continue;
+            }
         } 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();
@@ -519,10 +907,10 @@
     return data;
 }
 
-
 const check = (interaction: CommandInteraction) => {
-    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";
+    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";
     return true;
 };
 
diff --git a/src/commands/settings/verify.ts b/src/commands/settings/verify.ts
index 4efd68c..e0af802 100644
--- a/src/commands/settings/verify.ts
+++ b/src/commands/settings/verify.ts
@@ -1,5 +1,17 @@
 import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, Message, MessageActionRow, MessageActionRowComponent, MessageButton, MessageComponentInteraction, MessageEmbed, MessageSelectMenu, Role, SelectMenuInteraction, TextInputComponent } from "discord.js";
+import Discord, {
+    CommandInteraction,
+    Message,
+    MessageActionRow,
+    MessageActionRowComponent,
+    MessageButton,
+    MessageComponentInteraction,
+    MessageEmbed,
+    MessageSelectMenu,
+    Role,
+    SelectMenuInteraction,
+    TextInputComponent
+} from "discord.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -11,45 +23,70 @@
     builder
         .setName("verify")
         .setDescription("Manage the role given after typing /verify")
-        .addRoleOption(option => option.setName("role").setDescription("The role to give after verifying").setRequired(false));
+        .addRoleOption((option) =>
+            option
+                .setName("role")
+                .setDescription("The role to give after verifying")
+                .setRequired(false)
+        );
 
-const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
-    const m = await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true}) as Message;
+const callback = async (
+    interaction: CommandInteraction
+): Promise<void | unknown> => {
+    const m = (await interaction.reply({
+        embeds: LoadingEmbed,
+        ephemeral: true,
+        fetchReply: true
+    })) as Message;
     if (interaction.options.getRole("role")) {
         let role: Role;
         try {
             role = interaction.options.getRole("role") as Role;
         } catch {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("GUILD.ROLES.DELETE")
-                .setTitle("Verify Role")
-                .setDescription("The role you provided is not a valid role")
-                .setStatus("Danger")
-            ]});
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("GUILD.ROLES.DELETE")
+                        .setTitle("Verify Role")
+                        .setDescription(
+                            "The role you provided is not a valid role"
+                        )
+                        .setStatus("Danger")
+                ]
+            });
         }
         role = role as Discord.Role;
         if (role.guild.id !== interaction.guild.id) {
-            return interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Verify Role")
-                .setDescription("You must choose a role in this server")
-                .setStatus("Danger")
-                .setEmoji("GUILD.ROLES.DELETE")
-            ]});
+            return interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Verify Role")
+                        .setDescription("You must choose a role in this server")
+                        .setStatus("Danger")
+                        .setEmoji("GUILD.ROLES.DELETE")
+                ]
+            });
         }
         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);
         if (confirmation.cancelled) return;
         if (confirmation.success) {
             try {
-                await client.database.guilds.write(interaction.guild.id, {"verify.role": role.id, "verify.enabled": true});
-                const { log, NucleusColors, entry, renderUser, renderRole } = client.logger;
+                await client.database.guilds.write(interaction.guild.id, {
+                    "verify.role": role.id,
+                    "verify.enabled": true
+                });
+                const { log, NucleusColors, entry, renderUser, renderRole } =
+                    client.logger;
                 const data = {
-                    meta:{
+                    meta: {
                         type: "verifyRoleChanged",
                         displayName: "Verify Role Changed",
                         calculateType: "nucleusSettingsUpdated",
@@ -58,8 +95,14 @@
                         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: {
@@ -69,169 +112,319 @@
                 log(data);
             } catch (e) {
                 console.log(e);
-                return interaction.editReply({embeds: [new EmojiEmbed()
-                    .setTitle("Verify Role")
-                    .setDescription("Something went wrong while setting the verify role")
-                    .setStatus("Danger")
-                    .setEmoji("GUILD.ROLES.DELETE")
-                ], components: []});
+                return interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Verify Role")
+                            .setDescription(
+                                "Something went wrong while setting the verify role"
+                            )
+                            .setStatus("Danger")
+                            .setEmoji("GUILD.ROLES.DELETE")
+                    ],
+                    components: []
+                });
             }
         } else {
-            return interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Verify Role")
-                .setDescription("No changes were made")
-                .setStatus("Success")
-                .setEmoji("GUILD.ROLES.CREATE")
-            ], components: []});
+            return interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Verify Role")
+                        .setDescription("No changes were made")
+                        .setStatus("Success")
+                        .setEmoji("GUILD.ROLES.CREATE")
+                ],
+                components: []
+            });
         }
     }
     let clicks = 0;
     const data = await client.database.guilds.read(interaction.guild.id);
     let role = data.verify.role;
     while (true) {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Verify Role")
-            .setDescription(role ? `Your verify role is currently set to <@&${role}>` : "You have not set a verify role")
-            .setStatus("Success")
-            .setEmoji("GUILD.ROLES.CREATE")
-        ], components: [new MessageActionRow().addComponents([
-            new MessageButton()
-                .setCustomId("clear")
-                .setLabel(clicks ? "Click again to confirm" : "Reset role")
-                .setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
-                .setStyle("DANGER")
-                .setDisabled(!role),
-            new MessageButton()
-                .setCustomId("send")
-                .setLabel("Add verify button")
-                .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
-                .setStyle("PRIMARY")
-        ])]});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Verify Role")
+                    .setDescription(
+                        role
+                            ? `Your verify role is currently set to <@&${role}>`
+                            : "You have not set a verify role"
+                    )
+                    .setStatus("Success")
+                    .setEmoji("GUILD.ROLES.CREATE")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setCustomId("clear")
+                        .setLabel(
+                            clicks ? "Click again to confirm" : "Reset role"
+                        )
+                        .setEmoji(
+                            getEmojiByName(
+                                clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS",
+                                "id"
+                            )
+                        )
+                        .setStyle("DANGER")
+                        .setDisabled(!role),
+                    new MessageButton()
+                        .setCustomId("send")
+                        .setLabel("Add verify button")
+                        .setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
+                        .setStyle("PRIMARY")
+                ])
+            ]
+        });
         let i: MessageComponentInteraction;
         try {
-            i = await m.awaitMessageComponent({time: 300000});
-        } catch(e) { break; }
+            i = await m.awaitMessageComponent({ time: 300000 });
+        } catch (e) {
+            break;
+        }
         i.deferUpdate();
         if ((i.component as MessageActionRowComponent).customId === "clear") {
             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", description: "Click the button below to get verified"},
-                {label: "Get verified", description: "To get access to the rest of the server, click the button below"},
-                {label: "Ready to verify?", description: "Click the button below to verify yourself"}
+                {
+                    label: "Verify",
+                    description: "Click the button below to get verified"
+                },
+                {
+                    label: "Get verified",
+                    description:
+                        "To get access to the rest of the server, click the button below"
+                },
+                {
+                    label: "Ready to verify?",
+                    description: "Click the button below to verify yourself"
+                }
             ];
             while (true) {
-                await interaction.editReply({embeds: [new EmojiEmbed()
-                    .setTitle("Verify Button")
-                    .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."})
-                    .setStatus(role ? "Success" : "Warning")
-                    .setEmoji("GUILD.ROLES.CREATE")
-                ], components: [
-                    new MessageActionRow().addComponents([
-                        new MessageSelectMenu().setOptions(verifyMessages.map((t: {label: string, description: string, value?: string}, index) => {
-                            t.value = index.toString(); return t as {value: string, label: string, description: string};
-                        })).setCustomId("template").setMaxValues(1).setMinValues(1).setPlaceholder("Select a message template")
-                    ]),
-                    new MessageActionRow().addComponents([
-                        new MessageButton()
-                            .setCustomId("back")
-                            .setLabel("Back")
-                            .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
-                            .setStyle("DANGER"),
-                        new MessageButton()
-                            .setCustomId("blank")
-                            .setLabel("Empty")
-                            .setStyle("SECONDARY"),
-                        new MessageButton()
-                            .setCustomId("custom")
-                            .setLabel("Custom")
-                            .setEmoji(getEmojiByName("TICKETS.OTHER", "id"))
-                            .setStyle("PRIMARY")
-                    ])
-                ]});
+                await interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Verify Button")
+                            .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."
+                            })
+                            .setStatus(role ? "Success" : "Warning")
+                            .setEmoji("GUILD.ROLES.CREATE")
+                    ],
+                    components: [
+                        new MessageActionRow().addComponents([
+                            new MessageSelectMenu()
+                                .setOptions(
+                                    verifyMessages.map(
+                                        (
+                                            t: {
+                                                label: string;
+                                                description: string;
+                                                value?: string;
+                                            },
+                                            index
+                                        ) => {
+                                            t.value = index.toString();
+                                            return t as {
+                                                value: string;
+                                                label: string;
+                                                description: string;
+                                            };
+                                        }
+                                    )
+                                )
+                                .setCustomId("template")
+                                .setMaxValues(1)
+                                .setMinValues(1)
+                                .setPlaceholder("Select a message template")
+                        ]),
+                        new MessageActionRow().addComponents([
+                            new MessageButton()
+                                .setCustomId("back")
+                                .setLabel("Back")
+                                .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                                .setStyle("DANGER"),
+                            new MessageButton()
+                                .setCustomId("blank")
+                                .setLabel("Empty")
+                                .setStyle("SECONDARY"),
+                            new MessageButton()
+                                .setCustomId("custom")
+                                .setLabel("Custom")
+                                .setEmoji(getEmojiByName("TICKETS.OTHER", "id"))
+                                .setStyle("PRIMARY")
+                        ])
+                    ]
+                });
                 let i: MessageComponentInteraction;
                 try {
-                    i = await m.awaitMessageComponent({time: 300000});
-                } catch(e) { break; }
-                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)
-                        .setDescription(verifyMessages[parseInt((i as SelectMenuInteraction).values[0])].description)
-                        .setStatus("Success")
-                        .setEmoji("CONTROL.BLOCKTICK")
-                    ], components: [new MessageActionRow().addComponents([new MessageButton()
-                        .setLabel("Verify")
-                        .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
-                        .setStyle("SUCCESS")
-                        .setCustomId("verifybutton")
-                    ])]});
+                    i = await m.awaitMessageComponent({ time: 300000 });
+                } catch (e) {
                     break;
-                } else if ((i.component as MessageActionRowComponent).customId === "blank") {
+                }
+                if (
+                    (i.component as MessageActionRowComponent).customId ===
+                    "template"
+                ) {
                     i.deferUpdate();
-                    await interaction.channel.send({components: [new MessageActionRow().addComponents([new MessageButton()
-                        .setLabel("Verify")
-                        .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
-                        .setStyle("SUCCESS")
-                        .setCustomId("verifybutton")
-                    ])]});
+                    await interaction.channel.send({
+                        embeds: [
+                            new EmojiEmbed()
+                                .setTitle(
+                                    verifyMessages[
+                                        parseInt(
+                                            (i as SelectMenuInteraction)
+                                                .values[0]
+                                        )
+                                    ].label
+                                )
+                                .setDescription(
+                                    verifyMessages[
+                                        parseInt(
+                                            (i as SelectMenuInteraction)
+                                                .values[0]
+                                        )
+                                    ].description
+                                )
+                                .setStatus("Success")
+                                .setEmoji("CONTROL.BLOCKTICK")
+                        ],
+                        components: [
+                            new MessageActionRow().addComponents([
+                                new MessageButton()
+                                    .setLabel("Verify")
+                                    .setEmoji(
+                                        getEmojiByName("CONTROL.TICK", "id")
+                                    )
+                                    .setStyle("SUCCESS")
+                                    .setCustomId("verifybutton")
+                            ])
+                        ]
+                    });
                     break;
-                } else if ((i.component as MessageActionRowComponent).customId === "custom") {
-                    await i.showModal(new Discord.Modal().setCustomId("modal").setTitle("Enter embed details").addComponents(
-                        new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
-                            .setCustomId("title")
-                            .setLabel("Title")
-                            .setMaxLength(256)
-                            .setRequired(true)
-                            .setStyle("SHORT")
-                        ),
-                        new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
-                            .setCustomId("description")
-                            .setLabel("Description")
-                            .setMaxLength(4000)
-                            .setRequired(true)
-                            .setStyle("PARAGRAPH")
-                        )
-                    ));
+                } 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")
+                                    )
+                                    .setStyle("SUCCESS")
+                                    .setCustomId("verifybutton")
+                            ])
+                        ]
+                    });
+                    break;
+                } else if (
+                    (i.component as MessageActionRowComponent).customId ===
+                    "custom"
+                ) {
+                    await i.showModal(
+                        new Discord.Modal()
+                            .setCustomId("modal")
+                            .setTitle("Enter embed details")
+                            .addComponents(
+                                new MessageActionRow<TextInputComponent>().addComponents(
+                                    new TextInputComponent()
+                                        .setCustomId("title")
+                                        .setLabel("Title")
+                                        .setMaxLength(256)
+                                        .setRequired(true)
+                                        .setStyle("SHORT")
+                                ),
+                                new MessageActionRow<TextInputComponent>().addComponents(
+                                    new TextInputComponent()
+                                        .setCustomId("description")
+                                        .setLabel("Description")
+                                        .setMaxLength(4000)
+                                        .setRequired(true)
+                                        .setStyle("PARAGRAPH")
+                                )
+                            )
+                    );
                     await interaction.editReply({
-                        embeds: [new EmojiEmbed()
-                            .setTitle("Verify Button")
-                            .setDescription("Modal opened. If you can't see it, click back and try again.")
-                            .setStatus("Success")
-                            .setEmoji("GUILD.TICKET.OPEN")
-                        ], components: [new MessageActionRow().addComponents([new MessageButton()
-                            .setLabel("Back")
-                            .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
-                            .setStyle("PRIMARY")
-                            .setCustomId("back")
-                        ])]
+                        embeds: [
+                            new EmojiEmbed()
+                                .setTitle("Verify Button")
+                                .setDescription(
+                                    "Modal opened. If you can't see it, click back and try again."
+                                )
+                                .setStatus("Success")
+                                .setEmoji("GUILD.TICKET.OPEN")
+                        ],
+                        components: [
+                            new MessageActionRow().addComponents([
+                                new MessageButton()
+                                    .setLabel("Back")
+                                    .setEmoji(
+                                        getEmojiByName("CONTROL.LEFT", "id")
+                                    )
+                                    .setStyle("PRIMARY")
+                                    .setCustomId("back")
+                            ])
+                        ]
                     });
                     let out;
                     try {
-                        out = await modalInteractionCollector(m, (m) => m.channel.id === interaction.channel.id, (m) => m.customId === "modify");
-                    } catch (e) { break; }
+                        out = await modalInteractionCollector(
+                            m,
+                            (m) => m.channel.id === interaction.channel.id,
+                            (m) => m.customId === "modify"
+                        );
+                    } catch (e) {
+                        break;
+                    }
                     if (out.fields) {
                         const title = out.fields.getTextInputValue("title");
-                        const description = out.fields.getTextInputValue("description");
-                        await interaction.channel.send({embeds: [new EmojiEmbed()
-                            .setTitle(title)
-                            .setDescription(description)
-                            .setStatus("Success")
-                            .setEmoji("CONTROL.BLOCKTICK")
-                        ], components: [new MessageActionRow().addComponents([new MessageButton()
-                            .setLabel("Verify")
-                            .setEmoji(getEmojiByName("CONTROL.TICK", "id"))
-                            .setStyle("SUCCESS")
-                            .setCustomId("verifybutton")
-                        ])]});
+                        const description =
+                            out.fields.getTextInputValue("description");
+                        await interaction.channel.send({
+                            embeds: [
+                                new EmojiEmbed()
+                                    .setTitle(title)
+                                    .setDescription(description)
+                                    .setStatus("Success")
+                                    .setEmoji("CONTROL.BLOCKTICK")
+                            ],
+                            components: [
+                                new MessageActionRow().addComponents([
+                                    new MessageButton()
+                                        .setLabel("Verify")
+                                        .setEmoji(
+                                            getEmojiByName("CONTROL.TICK", "id")
+                                        )
+                                        .setStyle("SUCCESS")
+                                        .setCustomId("verifybutton")
+                                ])
+                            ]
+                        });
                         break;
-                    } else { continue; }
+                    } else {
+                        continue;
+                    }
                 }
             }
         } else {
@@ -239,12 +432,16 @@
             break;
         }
     }
-    await interaction.editReply({embeds: [(m.embeds[0] as MessageEmbed).setFooter({text: "Message closed"})], components: []});
+    await interaction.editReply({
+        embeds: [m.embeds[0]!.setFooter({ text: "Message closed" })],
+        components: []
+    });
 };
 
 const check = (interaction: CommandInteraction) => {
-    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";
+    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";
     return true;
 };
 
diff --git a/src/commands/settings/welcome.ts b/src/commands/settings/welcome.ts
index f22f409..3eb0ec5 100644
--- a/src/commands/settings/welcome.ts
+++ b/src/commands/settings/welcome.ts
@@ -1,5 +1,13 @@
 import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { Channel, CommandInteraction, Message, MessageActionRow, MessageButton, MessageComponentInteraction, Role } from "discord.js";
+import Discord, {
+    Channel,
+    CommandInteraction,
+    Message,
+    MessageActionRow,
+    MessageButton,
+    MessageComponentInteraction,
+    Role
+} from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import client from "../../utils/client.js";
@@ -11,19 +19,52 @@
 const command = (builder: SlashCommandSubcommandBuilder) =>
     builder
         .setName("welcome")
-        .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").setAutocomplete(true))
-        .addRoleOption(option => 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"))
-        .addChannelOption(option => option.setName("channel").setDescription("The channel the welcome message should be sent to").addChannelTypes([
-            ChannelType.GuildText, ChannelType.GuildNews
-        ]));
+        .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"
+                )
+                .setAutocomplete(true)
+        )
+        .addRoleOption((option) =>
+            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")
+        )
+        .addChannelOption((option) =>
+            option
+                .setName("channel")
+                .setDescription(
+                    "The channel the welcome message should be sent to"
+                )
+                .addChannelTypes([ChannelType.GuildText, ChannelType.GuildNews])
+        );
 
-const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
-    const { renderRole, renderChannel, log, NucleusColors, entry, renderUser } = client.logger;
-    await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true});
+const callback = async (
+    interaction: CommandInteraction
+): Promise<void | unknown> => {
+    const { renderRole, renderChannel, log, NucleusColors, entry, renderUser } =
+        client.logger;
+    await interaction.reply({
+        embeds: LoadingEmbed,
+        fetchReply: true,
+        ephemeral: true
+    });
     let m: Message;
-    if (interaction.options.getRole("role") || interaction.options.getChannel("channel") || interaction.options.getString("message")) {
+    if (
+        interaction.options.getRole("role") ||
+        interaction.options.getChannel("channel") ||
+        interaction.options.getString("message")
+    ) {
         let role: Role;
         let ping: Role;
         const message = interaction.options.getString("message");
@@ -31,32 +72,42 @@
             role = interaction.options.getRole("role") as Role;
             ping = interaction.options.getRole("ping") as Role;
         } catch {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("GUILD.ROLES.DELETE")
-                .setTitle("Welcome Events")
-                .setDescription("The role you provided is not a valid role")
-                .setStatus("Danger")
-            ]});
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("GUILD.ROLES.DELETE")
+                        .setTitle("Welcome Events")
+                        .setDescription(
+                            "The role you provided is not a valid role"
+                        )
+                        .setStatus("Danger")
+                ]
+            });
         }
         let channel: Channel;
         try {
             channel = interaction.options.getChannel("channel") as Channel;
         } catch {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("GUILD.ROLES.DELETE")
-                .setTitle("Welcome Events")
-                .setDescription("The channel you provided is not a valid channel")
-                .setStatus("Danger")
-            ]});
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("GUILD.ROLES.DELETE")
+                        .setTitle("Welcome Events")
+                        .setDescription(
+                            "The channel you provided is not a valid channel"
+                        )
+                        .setStatus("Danger")
+                ]
+            });
         }
         role = role as Discord.Role;
         ping = ping as Discord.Role;
         channel = channel as Discord.TextChannel;
         const options = {};
-        if (role) options["role"] = renderRole(role);
-        if (ping) options["ping"] = renderRole(ping);
-        if (channel) options["channel"] = renderChannel(channel);
-        if (message) options["message"] = "\n> " + message;
+        if (role) options.role = renderRole(role);
+        if (ping) options.ping = renderRole(ping);
+        if (channel) options.channel = renderChannel(channel);
+        if (message) options.message = "\n> " + message;
         const confirmation = await new confirmationMessage(interaction)
             .setEmoji("GUILD.ROLES.EDIT")
             .setTitle("Welcome Events")
@@ -72,17 +123,27 @@
                 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 (message) list["message"] = entry(message, `\`${message}\``);
+                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 (message) list.message = entry(message, `\`${message}\``);
                 const data = {
-                    meta:{
+                    meta: {
                         type: "welcomeSettingsUpdated",
                         displayName: "Welcome Settings Changed",
                         calculateType: "nucleusSettingsUpdated",
@@ -98,68 +159,128 @@
                 log(data);
             } catch (e) {
                 console.log(e);
-                return interaction.editReply({embeds: [new EmojiEmbed()
-                    .setTitle("Welcome Events")
-                    .setDescription("Something went wrong while updating welcome settings")
-                    .setStatus("Danger")
-                    .setEmoji("GUILD.ROLES.DELETE")
-                ], components: []});
+                return interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle("Welcome Events")
+                            .setDescription(
+                                "Something went wrong while updating welcome settings"
+                            )
+                            .setStatus("Danger")
+                            .setEmoji("GUILD.ROLES.DELETE")
+                    ],
+                    components: []
+                });
             }
         } else {
-            return interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Welcome Events")
-                .setDescription("No changes were made")
-                .setStatus("Success")
-                .setEmoji("GUILD.ROLES.CREATE")
-            ], components: []});
+            return interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Welcome Events")
+                        .setDescription("No changes were made")
+                        .setStatus("Success")
+                        .setEmoji("GUILD.ROLES.CREATE")
+                ],
+                components: []
+            });
         }
     }
     let lastClicked = null;
     while (true) {
         const config = await client.database.guilds.read(interaction.guild.id);
-        m = await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Welcome Events")
-            .setDescription(
-                `**Message:** ${config.welcome.message ? `\n> ${config.welcome.message}` : "*None set*"}\n` +
-                `**Role:** ${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)) : "*None set*"}\n` +
-                `**Channel:** ${config.welcome.channel ? (config.welcome.channel == "dm" ? "DM" : renderChannel(await interaction.guild.channels.fetch(config.welcome.channel))) : "*None set*"}`
-            )
-            .setStatus("Success")
-            .setEmoji("CHANNEL.TEXT.CREATE")
-        ], components: [
-            new MessageActionRow().addComponents([
-                new MessageButton()
-                    .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")
-                    .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")
-                    .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")
-                    .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-                    .setCustomId("clear-channel")
-                    .setDisabled(!config.welcome.channel)
-                    .setStyle("DANGER"),
-                new MessageButton()
-                    .setLabel("Set Channel to DM")
-                    .setCustomId("set-channel-dm")
-                    .setDisabled(config.welcome.channel == "dm")
-                    .setStyle("SECONDARY")
-            ])
-        ]}) as Message;
+        m = (await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Welcome Events")
+                    .setDescription(
+                        `**Message:** ${
+                            config.welcome.message
+                                ? `\n> ${config.welcome.message}`
+                                : "*None set*"
+                        }\n` +
+                            `**Role:** ${
+                                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
+                                          )
+                                      )
+                                    : "*None set*"
+                            }\n` +
+                            `**Channel:** ${
+                                config.welcome.channel
+                                    ? config.welcome.channel == "dm"
+                                        ? "DM"
+                                        : renderChannel(
+                                              await interaction.guild.channels.fetch(
+                                                  config.welcome.channel
+                                              )
+                                          )
+                                    : "*None set*"
+                            }`
+                    )
+                    .setStatus("Success")
+                    .setEmoji("CHANNEL.TEXT.CREATE")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .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"
+                        )
+                        .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"
+                        )
+                        .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"
+                        )
+                        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                        .setCustomId("clear-channel")
+                        .setDisabled(!config.welcome.channel)
+                        .setStyle("DANGER"),
+                    new MessageButton()
+                        .setLabel("Set Channel to DM")
+                        .setCustomId("set-channel-dm")
+                        .setDisabled(config.welcome.channel == "dm")
+                        .setStyle("SECONDARY")
+                ])
+            ]
+        })) as Message;
         let i: MessageComponentInteraction;
         try {
             i = await m.awaitMessageComponent({ time: 300000 });
@@ -169,35 +290,57 @@
         i.deferUpdate();
         if (i.customId == "clear-message") {
             if (lastClicked == "clear-message") {
-                await client.database.guilds.write(interaction.guild.id, {"welcome.message": null});
+                await client.database.guilds.write(interaction.guild.id, {
+                    "welcome.message": null
+                });
                 lastClicked = null;
-            } else { lastClicked = "clear-message"; }
+            } else {
+                lastClicked = "clear-message";
+            }
         } else if (i.customId == "clear-role") {
             if (lastClicked == "clear-role") {
-                await client.database.guilds.write(interaction.guild.id, {"welcome.role": null});
+                await client.database.guilds.write(interaction.guild.id, {
+                    "welcome.role": null
+                });
                 lastClicked = null;
-            } else { lastClicked = "clear-role"; }
+            } else {
+                lastClicked = "clear-role";
+            }
         } else if (i.customId == "clear-ping") {
             if (lastClicked == "clear-ping") {
-                await client.database.guilds.write(interaction.guild.id, {"welcome.ping": null});
+                await client.database.guilds.write(interaction.guild.id, {
+                    "welcome.ping": null
+                });
                 lastClicked = null;
-            } else { lastClicked = "clear-ping"; }
+            } else {
+                lastClicked = "clear-ping";
+            }
         } else if (i.customId == "clear-channel") {
             if (lastClicked == "clear-channel") {
-                await client.database.guilds.write(interaction.guild.id, {"welcome.channel": null});
+                await client.database.guilds.write(interaction.guild.id, {
+                    "welcome.channel": null
+                });
                 lastClicked = null;
-            } else { lastClicked = "clear-channel"; }
+            } else {
+                lastClicked = "clear-channel";
+            }
         } else if (i.customId == "set-channel-dm") {
-            await client.database.guilds.write(interaction.guild.id, {"welcome.channel": "dm"});
+            await client.database.guilds.write(interaction.guild.id, {
+                "welcome.channel": "dm"
+            });
             lastClicked = null;
         }
     }
-    await interaction.editReply({embeds: [m.embeds[0].setFooter({text: "Message closed"})], components: []});
+    await interaction.editReply({
+        embeds: [m.embeds[0].setFooter({ text: "Message closed" })],
+        components: []
+    });
 };
 
 const check = (interaction: CommandInteraction) => {
-    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";
+    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";
     return true;
 };
 
diff --git a/src/commands/tag.ts b/src/commands/tag.ts
index adaf2cc..34c3152 100644
--- a/src/commands/tag.ts
+++ b/src/commands/tag.ts
@@ -1,4 +1,9 @@
-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";
@@ -6,45 +11,68 @@
 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);
     const tags = config.getKey("tags");
     const tag = tags[interaction.options.getString("tag")];
     if (!tag) {
-        return await interaction.reply({embeds: [new EmojiEmbed()
-            .setTitle("Tag")
-            .setDescription(`Tag \`${interaction.options.getString("tag")}\` does not exist`)
-            .setEmoji("PUNISH.NICKNAME.RED")
-            .setStatus("Danger")
-        ], ephemeral: true});
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag")
+                    .setDescription(
+                        `Tag \`${interaction.options.getString(
+                            "tag"
+                        )}\` does not exist`
+                    )
+                    .setEmoji("PUNISH.NICKNAME.RED")
+                    .setStatus("Danger")
+            ],
+            ephemeral: true
+        });
     }
     let url = "";
     let components = [];
     if (tag.match(/^(http|https):\/\/[^ "]+$/)) {
         url = tag;
-        components = [new MessageActionRow().addComponents([new MessageButton()
-            .setLabel("Open")
-            .setURL(url)
-            .setStyle("LINK")
-        ])];
+        components = [
+            new MessageActionRow().addComponents([
+                new MessageButton()
+                    .setLabel("Open")
+                    .setURL(url)
+                    .setStyle("LINK")
+            ])
+        ];
     }
-    return await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle(interaction.options.getString("tag"))
-        .setDescription(tag)
-        .setEmoji("PUNISH.NICKNAME.GREEN")
-        .setStatus("Success")
-        .setImage(url)
-    ], components: components, ephemeral: true});
-
+    return await interaction.reply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle(interaction.options.getString("tag"))
+                .setDescription(tag)
+                .setEmoji("PUNISH.NICKNAME.GREEN")
+                .setStatus("Success")
+                .setImage(url)
+        ],
+        components: components,
+        ephemeral: true
+    });
 };
 
 const check = () => {
     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/_meta.ts b/src/commands/tags/_meta.ts
index 8c07682..2ce5318 100644
--- a/src/commands/tags/_meta.ts
+++ b/src/commands/tags/_meta.ts
@@ -1,4 +1,4 @@
 const name = "tags";
 const description = "manage server tags";
 
-export { name, description };
\ No newline at end of file
+export { name, description };
diff --git a/src/commands/tags/create.ts b/src/commands/tags/create.ts
index 4aaa49d..5d6621b 100644
--- a/src/commands/tags/create.ts
+++ b/src/commands/tags/create.ts
@@ -9,76 +9,132 @@
     builder
         .setName("create")
         .setDescription("Creates a 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"));
+        .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"
+                )
+        );
 
-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) return await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Create")
-        .setDescription("Tag names cannot be longer than 100 characters")
-        .setStatus("Danger")
-        .setEmoji("PUNISH.NICKNAME.RED")
-    ], ephemeral: true});
-    if (value.length > 1000) return await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Create")
-        .setDescription("Tag values cannot be longer than 1000 characters")
-        .setStatus("Danger")
-        .setEmoji("PUNISH.NICKNAME.RED")
-    ], ephemeral: true});
+    if (name.length > 100)
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Create")
+                    .setDescription(
+                        "Tag names cannot be longer than 100 characters"
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("PUNISH.NICKNAME.RED")
+            ],
+            ephemeral: true
+        });
+    if (value.length > 1000)
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Create")
+                    .setDescription(
+                        "Tag values cannot be longer than 1000 characters"
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("PUNISH.NICKNAME.RED")
+            ],
+            ephemeral: true
+        });
     const data = await client.database.guilds.read(interaction.guild.id);
-    if (data.tags.length >= 100) return await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Create")
-        .setDescription("You cannot have more than 100 tags")
-        .setStatus("Danger")
-        .setEmoji("PUNISH.NICKNAME.RED")
-    ], ephemeral: true});
-    if (data.tags[name]) return await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Create")
-        .setDescription("That tag already exists")
-        .setStatus("Danger")
-        .setEmoji("PUNISH.NICKNAME.RED")
-    ], ephemeral: true});
+    if (data.tags.length >= 100)
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Create")
+                    .setDescription("You cannot have more than 100 tags")
+                    .setStatus("Danger")
+                    .setEmoji("PUNISH.NICKNAME.RED")
+            ],
+            ephemeral: true
+        });
+    if (data.tags[name])
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Create")
+                    .setDescription("That tag already exists")
+                    .setStatus("Danger")
+                    .setEmoji("PUNISH.NICKNAME.RED")
+            ],
+            ephemeral: true
+        });
     const confirmation = await new confirmationMessage(interaction)
         .setEmoji("PUNISH.NICKNAME.YELLOW")
         .setTitle("Tag create")
-        .setDescription(keyValueList({
-            "name": `${name}`,
-            "value": `\n> ${value}`
-        })
-        + "\nAre you sure you want to create this tag?")
+        .setDescription(
+            keyValueList({
+                name: `${name}`,
+                value: `\n> ${value}`
+            }) + "\nAre you sure you want to create this tag?"
+        )
         .setColor("Warning")
         .setInverted(true)
         .send();
     if (confirmation.cancelled) return;
-    if (!confirmation) return await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Create")
-        .setDescription("No changes were made")
-        .setStatus("Success")
-        .setEmoji("PUNISH.NICKNAME.GREEN")
-    ]});
+    if (!confirmation)
+        return await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Create")
+                    .setDescription("No changes were made")
+                    .setStatus("Success")
+                    .setEmoji("PUNISH.NICKNAME.GREEN")
+            ]
+        });
     try {
-        await client.database.guilds.write(interaction.guild.id, {[`tags.${name}`]: value});
+        await client.database.guilds.write(interaction.guild.id, {
+            [`tags.${name}`]: value
+        });
     } catch (e) {
-        return await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Tag Create")
-            .setDescription("Something went wrong and the tag was not created")
-            .setStatus("Danger")
-            .setEmoji("PUNISH.NICKNAME.RED")
-        ], components: []});
+        return await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Create")
+                    .setDescription(
+                        "Something went wrong and the tag was not created"
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("PUNISH.NICKNAME.RED")
+            ],
+            components: []
+        });
     }
-    return await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Create")
-        .setDescription("Tag created")
-        .setStatus("Success")
-        .setEmoji("PUNISH.NICKNAME.GREEN")
-    ], components: []});
+    return await interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Tag Create")
+                .setDescription("Tag created")
+                .setStatus("Success")
+                .setEmoji("PUNISH.NICKNAME.GREEN")
+        ],
+        components: []
+    });
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as Discord.GuildMember);
-    if (!member.permissions.has("MANAGE_MESSAGES")) throw "You must have the *Manage Messages* permission to use this command";
+    const member = interaction.member as Discord.GuildMember;
+    if (!member.permissions.has("MANAGE_MESSAGES"))
+        throw "You must have the *Manage Messages* permission to use this command";
     return true;
 };
 
diff --git a/src/commands/tags/delete.ts b/src/commands/tags/delete.ts
index 3509dcc..4d1a1aa 100644
--- a/src/commands/tags/delete.ts
+++ b/src/commands/tags/delete.ts
@@ -9,57 +9,87 @@
     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]) return await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Tags")
-        .setDescription("That tag does not exist")
-        .setStatus("Danger")
-        .setEmoji("PUNISH.NICKNAME.RED")
-    ], ephemeral: true});
+    if (!data.tags[name])
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tags")
+                    .setDescription("That tag does not exist")
+                    .setStatus("Danger")
+                    .setEmoji("PUNISH.NICKNAME.RED")
+            ],
+            ephemeral: true
+        });
     const confirmation = await new confirmationMessage(interaction)
         .setEmoji("PUNISH.NICKNAME.YELLOW")
         .setTitle("Tag Delete")
-        .setDescription(keyValueList({
-            "name": `${name}`,
-            "value": `\n> ${data.tags[name]}`
-        })
-        + "\nAre you sure you want to delete this tag?")
+        .setDescription(
+            keyValueList({
+                name: `${name}`,
+                value: `\n> ${data.tags[name]}`
+            }) + "\nAre you sure you want to delete this tag?"
+        )
         .setColor("Warning")
         .setInverted(true)
         .send();
     if (confirmation.cancelled) return;
-    if (!confirmation) return await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Delete")
-        .setDescription("No changes were made")
-        .setStatus("Success")
-        .setEmoji("PUNISH.NICKNAME.GREEN")
-    ]});
+    if (!confirmation)
+        return await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Delete")
+                    .setDescription("No changes were made")
+                    .setStatus("Success")
+                    .setEmoji("PUNISH.NICKNAME.GREEN")
+            ]
+        });
     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")
-            .setStatus("Danger")
-            .setEmoji("PUNISH.NICKNAME.RED")
-        ], components: []});
+        return await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Delete")
+                    .setDescription(
+                        "Something went wrong and the tag was not deleted"
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("PUNISH.NICKNAME.RED")
+            ],
+            components: []
+        });
     }
-    return await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Delete")
-        .setDescription("Tag deleted")
-        .setStatus("Success")
-        .setEmoji("PUNISH.NICKNAME.GREEN")
-    ], components: []});
+    return await interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Tag Delete")
+                .setDescription("Tag deleted")
+                .setStatus("Success")
+                .setEmoji("PUNISH.NICKNAME.GREEN")
+        ],
+        components: []
+    });
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as Discord.GuildMember);
-    if (!member.permissions.has("MANAGE_MESSAGES")) throw "You must have the *Manage Messages* permission to use this command";
+    const member = interaction.member as Discord.GuildMember;
+    if (!member.permissions.has("MANAGE_MESSAGES"))
+        throw "You must have the *Manage Messages* permission to use this command";
     return true;
 };
 
diff --git a/src/commands/tags/edit.ts b/src/commands/tags/edit.ts
index b9cdddf..192a2d4 100644
--- a/src/commands/tags/edit.ts
+++ b/src/commands/tags/edit.ts
@@ -9,63 +9,112 @@
     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("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"));
+        .addStringOption((o) =>
+            o
+                .setName("name")
+                .setRequired(true)
+                .setDescription("The tag to edit")
+        )
+        .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")
+        );
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     const name = interaction.options.getString("name");
     const value = interaction.options.getString("value") || "";
     const newname = interaction.options.getString("newname") || "";
-    if (!newname && !value) return await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Edit")
-        .setDescription("You must specify a value or a new name")
-        .setStatus("Danger")
-        .setEmoji("PUNISH.NICKNAME.RED")
-    ], ephemeral: true});
-    if (newname.length > 100) return await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Edit")
-        .setDescription("Tag names cannot be longer than 100 characters")
-        .setStatus("Danger")
-        .setEmoji("PUNISH.NICKNAME.RED")
-    ], ephemeral: true});
-    if (value.length > 2000) return await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Edit")
-        .setDescription("Tag values cannot be longer than 2000 characters")
-        .setStatus("Danger")
-        .setEmoji("PUNISH.NICKNAME.RED")
-    ], ephemeral: true});
+    if (!newname && !value)
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Edit")
+                    .setDescription("You must specify a value or a new name")
+                    .setStatus("Danger")
+                    .setEmoji("PUNISH.NICKNAME.RED")
+            ],
+            ephemeral: true
+        });
+    if (newname.length > 100)
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Edit")
+                    .setDescription(
+                        "Tag names cannot be longer than 100 characters"
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("PUNISH.NICKNAME.RED")
+            ],
+            ephemeral: true
+        });
+    if (value.length > 2000)
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Edit")
+                    .setDescription(
+                        "Tag values cannot be longer than 2000 characters"
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("PUNISH.NICKNAME.RED")
+            ],
+            ephemeral: true
+        });
     const data = await client.database.guilds.read(interaction.guild.id);
-    if (!data.tags[name]) return await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Edit")
-        .setDescription("That tag does not exist")
-        .setStatus("Danger")
-        .setEmoji("PUNISH.NICKNAME.RED")
-    ], ephemeral: true});
-    if (newname && newname !== name && data.tags[newname]) return await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Edit")
-        .setDescription("A tag with that name already exists")
-        .setStatus("Danger")
-        .setEmoji("PUNISH.NICKNAME.RED")
-    ], ephemeral: true});
+    if (!data.tags[name])
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Edit")
+                    .setDescription("That tag does not exist")
+                    .setStatus("Danger")
+                    .setEmoji("PUNISH.NICKNAME.RED")
+            ],
+            ephemeral: true
+        });
+    if (newname && newname !== name && data.tags[newname])
+        return await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Edit")
+                    .setDescription("A tag with that name already exists")
+                    .setStatus("Danger")
+                    .setEmoji("PUNISH.NICKNAME.RED")
+            ],
+            ephemeral: true
+        });
     const confirmation = await new confirmationMessage(interaction)
         .setEmoji("PUNISH.NICKNAME.YELLOW")
         .setTitle("Tag Edit")
-        .setDescription(keyValueList({
-            "name": `${name}` + (newname ? ` -> ${newname}` : ""),
-            "value": `\n> ${value ? value : data.tags[name]}`
-        })
-        + "\nAre you sure you want to edit this tag?")
+        .setDescription(
+            keyValueList({
+                name: `${name}` + (newname ? ` -> ${newname}` : ""),
+                value: `\n> ${value ? value : data.tags[name]}`
+            }) + "\nAre you sure you want to edit this tag?"
+        )
         .setColor("Warning")
         .setInverted(true)
         .send();
     if (confirmation.cancelled) return;
-    if (!confirmation) return await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Tag Edit")
-        .setDescription("No changes were made")
-        .setStatus("Success")
-        .setEmoji("PUNISH.NICKNAME.GREEN")
-    ]});
+    if (!confirmation)
+        return await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Edit")
+                    .setDescription("No changes were made")
+                    .setStatus("Success")
+                    .setEmoji("PUNISH.NICKNAME.GREEN")
+            ]
+        });
     try {
         const toSet = {};
         const toUnset = [];
@@ -74,26 +123,41 @@
             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")
-            .setStatus("Danger")
-            .setEmoji("PUNISH.NICKNAME.RED")
-        ], components: []});
+        return await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Tag Edit")
+                    .setDescription(
+                        "Something went wrong and the tag was not edited"
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("PUNISH.NICKNAME.RED")
+            ],
+            components: []
+        });
     }
-    return await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Tags")
-        .setDescription("Tag edited successfully")
-        .setStatus("Success")
-        .setEmoji("PUNISH.NICKNAME.GREEN")
-    ], components: []});
+    return await interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Tags")
+                .setDescription("Tag edited successfully")
+                .setStatus("Success")
+                .setEmoji("PUNISH.NICKNAME.GREEN")
+        ],
+        components: []
+    });
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as Discord.GuildMember);
-    if (!member.permissions.has("MANAGE_MESSAGES")) throw "You must have the *Manage Messages* permission to use this command";
+    const member = interaction.member as Discord.GuildMember;
+    if (!member.permissions.has("MANAGE_MESSAGES"))
+        throw "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 1a6c22c..070aa8b 100644
--- a/src/commands/tags/list.ts
+++ b/src/commands/tags/list.ts
@@ -1,5 +1,13 @@
 import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, Message, MessageActionRow, MessageActionRowComponent, MessageButton, MessageComponentInteraction, SelectMenuInteraction } from "discord.js";
+import Discord, {
+    CommandInteraction,
+    Message,
+    MessageActionRow,
+    MessageActionRowComponent,
+    MessageButton,
+    MessageComponentInteraction,
+    SelectMenuInteraction
+} from "discord.js";
 import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import client from "../../utils/client.js";
@@ -7,22 +15,31 @@
 import getEmojiByName from "../../utils/getEmojiByName.js";
 import createPageIndicator from "../../utils/createPageIndicator.js";
 
-
 class Embed {
     embed: Discord.MessageEmbed;
     title: string;
     description = "";
     pageId = 0;
-    setEmbed(embed: Discord.MessageEmbed) { this.embed = embed; return this; }
-    setTitle(title: string) { this.title = title; return this; }
-    setDescription(description: string) { this.description = description; return this; }
-    setPageId(pageId: number) { this.pageId = pageId; return this; }
+    setEmbed(embed: Discord.MessageEmbed) {
+        this.embed = embed;
+        return this;
+    }
+    setTitle(title: string) {
+        this.title = title;
+        return this;
+    }
+    setDescription(description: string) {
+        this.description = description;
+        return this;
+    }
+    setPageId(pageId: number) {
+        this.pageId = pageId;
+        return this;
+    }
 }
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
-    builder
-        .setName("list")
-        .setDescription("Lists all tags in the server");
+    builder.setName("list").setDescription("Lists all tags in the server");
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     const data = await client.database.guilds.read(interaction.guild.id);
@@ -44,15 +61,24 @@
 
     const pages = [];
     for (const string of strings) {
-        pages.push(new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Tags")
-                .setDescription(string)
-                .setEmoji("PUNISH.NICKNAME.GREEN")
-                .setStatus("Success")
-            ).setTitle(`Page ${pages.length + 1}`).setPageId(pages.length));
+        pages.push(
+            new Embed()
+                .setEmbed(
+                    new EmojiEmbed()
+                        .setTitle("Tags")
+                        .setDescription(string)
+                        .setEmoji("PUNISH.NICKNAME.GREEN")
+                        .setStatus("Success")
+                )
+                .setTitle(`Page ${pages.length + 1}`)
+                .setPageId(pages.length)
+        );
     }
-    const m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true}) as Message;
+    const m = (await interaction.reply({
+        embeds: LoadingEmbed,
+        fetchReply: true,
+        ephemeral: true
+    })) as Message;
     let page = 0;
     let selectPaneOpen = false;
     while (true) {
@@ -60,72 +86,150 @@
 
         if (selectPaneOpen) {
             const options = [];
-            pages.forEach(embed => {
-                options.push(new SelectMenuOption({
-                    label: embed.title,
-                    value: embed.pageId.toString(),
-                    description: embed.description || ""
-                }));
+            pages.forEach((embed) => {
+                options.push(
+                    new SelectMenuOption({
+                        label: embed.title,
+                        value: embed.pageId.toString(),
+                        description: embed.description || ""
+                    })
+                );
             });
-            selectPane = [new MessageActionRow().addComponents([
-                new Discord.MessageSelectMenu()
-                    .addOptions(options)
-                    .setCustomId("page")
-                    .setMaxValues(1)
-                    .setPlaceholder("Choose a page...")
-            ])];
+            selectPane = [
+                new MessageActionRow().addComponents([
+                    new Discord.MessageSelectMenu()
+                        .addOptions(options)
+                        .setCustomId("page")
+                        .setMaxValues(1)
+                        .setPlaceholder("Choose a page...")
+                ])
+            ];
         }
         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([new MessageActionRow().addComponents([
-                new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(page === 0),
-                new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY").setDisabled(false),
-                new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(page === pages.length - 1),
-                new MessageButton().setCustomId("close").setEmoji(getEmojiByName("CONTROL.CROSS", "id")).setStyle("DANGER")
-            ])])
+            components: selectPane.concat([
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setCustomId("left")
+                        .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                        .setStyle("SECONDARY")
+                        .setDisabled(page === 0),
+                    new MessageButton()
+                        .setCustomId("select")
+                        .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
+                        .setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY")
+                        .setDisabled(false),
+                    new MessageButton()
+                        .setCustomId("right")
+                        .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                        .setStyle("SECONDARY")
+                        .setDisabled(page === pages.length - 1),
+                    new MessageButton()
+                        .setCustomId("close")
+                        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                        .setStyle("DANGER")
+                ])
+            ])
         });
         let i: MessageComponentInteraction;
         try {
-            i = await m.awaitMessageComponent({time: 300000 });
-        } catch (e) { break; }
+            i = await m.awaitMessageComponent({ time: 300000 });
+        } catch (e) {
+            break;
+        }
         i.deferUpdate();
         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: [new MessageActionRow().addComponents([
-                    new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(true),
-                    new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY").setDisabled(true),
-                    new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(true),
-                    new MessageButton().setCustomId("close").setEmoji(getEmojiByName("CONTROL.CROSS", "id")).setStyle("DANGER").setDisabled(true)
-                ])]
+                embeds: [em],
+                components: [
+                    new MessageActionRow().addComponents([
+                        new MessageButton()
+                            .setCustomId("left")
+                            .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                            .setStyle("SECONDARY")
+                            .setDisabled(true),
+                        new MessageButton()
+                            .setCustomId("select")
+                            .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
+                            .setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY")
+                            .setDisabled(true),
+                        new MessageButton()
+                            .setCustomId("right")
+                            .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                            .setStyle("SECONDARY")
+                            .setDisabled(true),
+                        new MessageButton()
+                            .setCustomId("close")
+                            .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                            .setStyle("DANGER")
+                            .setDisabled(true)
+                    ])
+                ]
             });
             return;
         }
     }
     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: [new MessageActionRow().addComponents([
-            new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(true),
-            new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle("SECONDARY").setDisabled(true),
-            new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(true),
-            new MessageButton().setCustomId("close").setEmoji(getEmojiByName("CONTROL.CROSS", "id")).setStyle("DANGER").setDisabled(true)
-        ])]
+        components: [
+            new MessageActionRow().addComponents([
+                new MessageButton()
+                    .setCustomId("left")
+                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                    .setStyle("SECONDARY")
+                    .setDisabled(true),
+                new MessageButton()
+                    .setCustomId("select")
+                    .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
+                    .setStyle("SECONDARY")
+                    .setDisabled(true),
+                new MessageButton()
+                    .setCustomId("right")
+                    .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                    .setStyle("SECONDARY")
+                    .setDisabled(true),
+                new MessageButton()
+                    .setCustomId("close")
+                    .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                    .setStyle("DANGER")
+                    .setDisabled(true)
+            ])
+        ]
     });
 };
 
diff --git a/src/commands/ticket/_meta.ts b/src/commands/ticket/_meta.ts
index 8c21466..e484928 100644
--- a/src/commands/ticket/_meta.ts
+++ b/src/commands/ticket/_meta.ts
@@ -1,4 +1,4 @@
 const name = "ticket";
 const description = "Manage modmail tickets";
 
-export { name, description };
\ No newline at end of file
+export { name, description };
diff --git a/src/commands/ticket/close.ts b/src/commands/ticket/close.ts
index ed27abc..71044dd 100644
--- a/src/commands/ticket/close.ts
+++ b/src/commands/ticket/close.ts
@@ -3,9 +3,7 @@
 import close from "../../actions/tickets/delete.js";
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
-    builder
-        .setName("close")
-        .setDescription("Closes a ticket");
+    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 55962d7..10ec842 100644
--- a/src/commands/ticket/create.ts
+++ b/src/commands/ticket/create.ts
@@ -6,7 +6,12 @@
     builder
         .setName("create")
         .setDescription("Creates a new modmail ticket")
-        .addStringOption(option => option.setName("message").setDescription("The content of the ticket").setRequired(false));
+        .addStringOption((option) =>
+            option
+                .setName("message")
+                .setDescription("The content of the ticket")
+                .setRequired(false)
+        );
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     await create(interaction);
diff --git a/src/commands/user/_meta.ts b/src/commands/user/_meta.ts
index 6c14052..8677d79 100644
--- a/src/commands/user/_meta.ts
+++ b/src/commands/user/_meta.ts
@@ -1,4 +1,4 @@
 const name = "user";
 const description = "Commands for user info";
 
-export { name, description };
\ No newline at end of file
+export { name, description };
diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index ede84b3..5f096ae 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -1,6 +1,18 @@
 import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, GuildMember, Message, MessageActionRow, MessageActionRowComponent, MessageButton, MessageComponentInteraction, SelectMenuInteraction } from "discord.js";
-import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import Discord, {
+    CommandInteraction,
+    GuildMember,
+    Message,
+    MessageActionRow,
+    MessageActionRowComponent,
+    MessageButton,
+    MessageComponentInteraction,
+    SelectMenuInteraction
+} from "discord.js";
+import {
+    SelectMenuOption,
+    SlashCommandSubcommandBuilder
+} from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
 import generateKeyValueList from "../../utils/generateKeyValueList.js";
@@ -11,218 +23,320 @@
     builder
         .setName("about")
         .setDescription("Shows info about a user")
-        .addUserOption(option => option.setName("user").setDescription("The user to get info about | Default: Yourself"));
-
+        .addUserOption((option) =>
+            option
+                .setName("user")
+                .setDescription(
+                    "The user to get info about | Default: Yourself"
+                )
+        );
 
 class Embed {
     embed: Discord.MessageEmbed;
     title: string;
     description = "";
     pageId = 0;
-    setEmbed(embed: Discord.MessageEmbed) { this.embed = embed; return this; }
-    setTitle(title: string) { this.title = title; return this; }
-    setDescription(description: string) { this.description = description; return this; }
-    setPageId(pageId: number) { this.pageId = pageId; return this; }
+    setEmbed(embed: Discord.MessageEmbed) {
+        this.embed = embed;
+        return this;
+    }
+    setTitle(title: string) {
+        this.title = title;
+        return this;
+    }
+    setDescription(description: string) {
+        this.description = description;
+        return this;
+    }
+    setPageId(pageId: number) {
+        this.pageId = pageId;
+        return this;
+    }
 }
 
-
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     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 ([
-        "438733159748599813", // Pinea
-        "317731855317336067", // Mini
-        "261900651230003201", // Coded
-        "511655498676699136" // Zan
-    ].includes(member.user.id)) { flags.push("NUCLEUSDEVELOPER"); }
-    if ((await client.guilds.cache.get("684492926528651336")?.members.fetch())?.filter((m: GuildMember) => m.roles.cache.has("760896837866749972"))?.map((m: GuildMember) => m.id).includes(member.user.id)) { flags.push("CLICKSDEVELOPER"); }
-    member.user.flags.toArray().map(flag => {
+    if (
+        [
+            "438733159748599813", // Pinea
+            "317731855317336067", // Mini
+            "261900651230003201", // Coded
+            "511655498676699136" // Zan
+        ].includes(member.user.id)
+    ) {
+        flags.push("NUCLEUSDEVELOPER");
+    }
+    if (
+        (await client.guilds.cache.get("684492926528651336")?.members.fetch())
+            ?.filter((m: GuildMember) =>
+                m.roles.cache.has("760896837866749972")
+            )
+            ?.map((m: GuildMember) => m.id)
+            .includes(member.user.id)
+    ) {
+        flags.push("CLICKSDEVELOPER");
+    }
+    member.user.flags.toArray().map((flag) => {
         flags.push(flag.toString());
     });
-    if (member.user.bot === true) { flags.push("BOT"); }
+    if (member.user.bot) {
+        flags.push("BOT");
+    }
     // Check if they are boosting the server
-    if (member.premiumSince) { flags.push("BOOSTER"); }
+    if (member.premiumSince) {
+        flags.push("BOOSTER");
+    }
     const nameReplacements = {
-        "NUCLEUSDEVELOPER": "**Nucleus Developer**",
-        "CLICKSDEVELOPER": "Clicks Developer",
-        "HOUSE_BRAVERY": "Hypesquad Bravery",
-        "HOUSE_BRILLIANCE": "Hypesquad Brilliance",
-        "HOUSE_BALANCE": "Hypesquad Balance",
-        "HYPESQUAD_EVENTS": "Hypesquad Events",
-        "EARLY_SUPPORTER": "Early Supporter",
-        "BUGHUNTER_LEVEL_1": "Bug Hunter Level 1",
-        "BUGHUNTER_LEVEL_2": "Bug Hunter Level 2",
-        "PARTNERED_SERVER_OWNER": "Partnered Server Owner",
-        "DISCORD_EMPLOYEE": "Discord Staff",
-        "EARLY_VERIFIED_BOT_DEVELOPER": "Verified Bot Developer",
-        "BOT": "Bot",
-        "BOOSTER": "Server Booster"
+        NUCLEUSDEVELOPER: "**Nucleus Developer**",
+        CLICKSDEVELOPER: "Clicks Developer",
+        HOUSE_BRAVERY: "Hypesquad Bravery",
+        HOUSE_BRILLIANCE: "Hypesquad Brilliance",
+        HOUSE_BALANCE: "Hypesquad Balance",
+        HYPESQUAD_EVENTS: "Hypesquad Events",
+        EARLY_SUPPORTER: "Early Supporter",
+        BUGHUNTER_LEVEL_1: "Bug Hunter Level 1",
+        BUGHUNTER_LEVEL_2: "Bug Hunter Level 2",
+        PARTNERED_SERVER_OWNER: "Partnered Server Owner",
+        DISCORD_EMPLOYEE: "Discord Staff",
+        EARLY_VERIFIED_BOT_DEVELOPER: "Verified Bot Developer",
+        BOT: "Bot",
+        BOOSTER: "Server Booster"
     };
     const members = await interaction.guild.members.fetch();
     const membersArray = [...members.values()];
     membersArray.sort((a, b) => a.joinedTimestamp - b.joinedTimestamp);
-    const joinPos = membersArray.findIndex(m => m.id === member.user.id);
+    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;
-    roles.map(item => {
+    roles.map((item) => {
         if (ended) return;
         const string = `<@&${item.id}>, `;
-        if(s.length + string.length > 1000) {
+        if (s.length + string.length > 1000) {
             ended = true;
             s += `and ${roles.size - count} more`;
             return;
         }
-        count ++;
+        count++;
         s += string;
     });
-    if(s.length > 0 && !ended) s = s.slice(0, -2);
+    if (s.length > 0 && !ended) s = s.slice(0, -2);
 
     let perms = "";
     const permsArray = {
-        "ADMINISTRATOR": "Administrator",
-        "MANAGE_GUILD": "Manage Server",
-        "MANAGE_ROLES": "Manage Roles",
-        "MANAGE_CHANNELS": "Manage Channels",
-        "KICK_MEMBERS": "Kick Members",
-        "BAN_MEMBERS": "Ban Members",
-        "MODERATE_MEMBERS": "Moderate Members",
-        "MANAGE_NICKNAMES": "Manage Nicknames",
-        "MANAGE_WEBHOOKS": "Manage Webhooks",
-        "MANAGE_MESSAGES": "Manage Messages",
-        "VIEW_AUDIT_LOG": "View Audit Log",
-        "MENTION_EVERYONE": "Mention Everyone"
+        ADMINISTRATOR: "Administrator",
+        MANAGE_GUILD: "Manage Server",
+        MANAGE_ROLES: "Manage Roles",
+        MANAGE_CHANNELS: "Manage Channels",
+        KICK_MEMBERS: "Kick Members",
+        BAN_MEMBERS: "Ban Members",
+        MODERATE_MEMBERS: "Moderate Members",
+        MANAGE_NICKNAMES: "Manage Nicknames",
+        MANAGE_WEBHOOKS: "Manage Webhooks",
+        MANAGE_MESSAGES: "Manage Messages",
+        VIEW_AUDIT_LOG: "View Audit Log",
+        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`;
+    Object.keys(permsArray).map((perm) => {
+        const hasPerm = member.permissions.has(
+            perm as Discord.PermissionString
+        );
+        perms += `${getEmojiByName(
+            "CONTROL." + (hasPerm ? "TICK" : "CROSS")
+        )} ${permsArray[perm]}\n`;
     });
 
     let selectPaneOpen = false;
 
     const embeds = [
         new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("User Info: General")
-                .setStatus("Success")
-                .setEmoji("MEMBER.JOIN")
-                .setDescription(
-                    flags.map(flag => {
-                        if (nameReplacements[flag]) {
-                            return getEmojiByName(`BADGES.${flag}`) + " " + nameReplacements[flag];
-                        }
-                    }).join("\n") + "\n\n" +
-                    generateKeyValueList({
-                        "member": renderUser(member.user),
-                        "nickname": member.nickname || "*None set*",
-                        "id": `\`${member.id}\``,
-                        "joined the server": renderDelta(member.joinedTimestamp),
-                        "joined discord": renderDelta(member.user.createdTimestamp),
-                        "boost status": member.premiumSince ? `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"}))
-            ).setTitle("General").setDescription("General information about the user").setPageId(0),
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("User Info: General")
+                    .setStatus("Success")
+                    .setEmoji("MEMBER.JOIN")
+                    .setDescription(
+                        flags
+                            .map((flag) => {
+                                if (nameReplacements[flag]) {
+                                    return (
+                                        getEmojiByName(`BADGES.${flag}`) +
+                                        " " +
+                                        nameReplacements[flag]
+                                    );
+                                }
+                            })
+                            .join("\n") +
+                            "\n\n" +
+                            generateKeyValueList({
+                                member: renderUser(member.user),
+                                nickname: member.nickname || "*None set*",
+                                id: `\`${member.id}\``,
+                                "joined the server": renderDelta(
+                                    member.joinedTimestamp
+                                ),
+                                "joined discord": renderDelta(
+                                    member.user.createdTimestamp
+                                ),
+                                "boost status": member.premiumSince
+                                    ? `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" })
+                    )
+            )
+            .setTitle("General")
+            .setDescription("General information about the user")
+            .setPageId(0),
         new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("User Info: Roles")
-                .setStatus("Success")
-                .setEmoji("GUILD.ROLES.CREATE")
-                .setDescription(
-                    generateKeyValueList({
-                        "member": renderUser(member.user),
-                        "id": `\`${member.id}\``,
-                        "roles": `${member.roles.cache.size - 1}`
-                    }) + "\n" +
-                    (s.length > 0 ? s : "*None*") + "\n"
-                )
-                .setThumbnail(member.user.displayAvatarURL({dynamic: true}))
-            ).setTitle("Roles").setDescription("Roles the user has").setPageId(1),
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("User Info: Roles")
+                    .setStatus("Success")
+                    .setEmoji("GUILD.ROLES.CREATE")
+                    .setDescription(
+                        generateKeyValueList({
+                            member: renderUser(member.user),
+                            id: `\`${member.id}\``,
+                            roles: `${member.roles.cache.size - 1}`
+                        }) +
+                            "\n" +
+                            (s.length > 0 ? s : "*None*") +
+                            "\n"
+                    )
+                    .setThumbnail(
+                        member.user.displayAvatarURL({ dynamic: true })
+                    )
+            )
+            .setTitle("Roles")
+            .setDescription("Roles the user has")
+            .setPageId(1),
         new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("User Info: Key Permissions")
-                .setStatus("Success")
-                .setEmoji("GUILD.ROLES.CREATE")
-                .setDescription(
-                    generateKeyValueList({
-                        "member": renderUser(member.user),
-                        "id": `\`${member.id}\``
-                    }) + "\n" + perms
-                )
-                .setThumbnail(member.user.displayAvatarURL({dynamic: true}))
-            ).setTitle("Key Permissions").setDescription("Key permissions the user has").setPageId(2)
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("User Info: Key Permissions")
+                    .setStatus("Success")
+                    .setEmoji("GUILD.ROLES.CREATE")
+                    .setDescription(
+                        generateKeyValueList({
+                            member: renderUser(member.user),
+                            id: `\`${member.id}\``
+                        }) +
+                            "\n" +
+                            perms
+                    )
+                    .setThumbnail(
+                        member.user.displayAvatarURL({ dynamic: true })
+                    )
+            )
+            .setTitle("Key Permissions")
+            .setDescription("Key permissions the user has")
+            .setPageId(2)
     ];
-    const m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true}) as Message;
+    const m = (await interaction.reply({
+        embeds: LoadingEmbed,
+        fetchReply: true,
+        ephemeral: true
+    })) as Message;
     let page = 0;
     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) {
             const options = [];
-            embeds.forEach(embed => {
-                options.push(new SelectMenuOption({
-                    label: embed.title,
-                    value: embed.pageId.toString(),
-                    description: embed.description || ""
-                }));
+            embeds.forEach((embed) => {
+                options.push(
+                    new SelectMenuOption({
+                        label: embed.title,
+                        value: embed.pageId.toString(),
+                        description: embed.description || ""
+                    })
+                );
             });
-            selectPane = [new MessageActionRow().addComponents([
-                new Discord.MessageSelectMenu()
-                    .addOptions(options)
-                    .setCustomId("page")
-                    .setMaxValues(1)
-                    .setPlaceholder("Choose a page...")
-            ])];
+            selectPane = [
+                new MessageActionRow().addComponents([
+                    new Discord.MessageSelectMenu()
+                        .addOptions(options)
+                        .setCustomId("page")
+                        .setMaxValues(1)
+                        .setPlaceholder("Choose a page...")
+                ])
+            ];
         }
         await interaction.editReply({
             embeds: [em],
-            components: selectPane.concat([new MessageActionRow().addComponents([
-                new MessageButton()
-                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
-                    .setStyle("SECONDARY")
-                    .setCustomId("left")
-                    .setDisabled(page === 0),
-                new MessageButton()
-                    .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
-                    .setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY")
-                    .setCustomId("select")
-                    .setDisabled(false),
-                new MessageButton()
-                    .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
-                    .setCustomId("right")
-                    .setStyle("SECONDARY")
-                    .setDisabled(page === embeds.length - 1),
-                new MessageButton()
-                    .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-                    .setCustomId("close")
-                    .setStyle("DANGER")
-            ])])
+            components: selectPane.concat([
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                        .setStyle("SECONDARY")
+                        .setCustomId("left")
+                        .setDisabled(page === 0),
+                    new MessageButton()
+                        .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
+                        .setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY")
+                        .setCustomId("select")
+                        .setDisabled(false),
+                    new MessageButton()
+                        .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                        .setCustomId("right")
+                        .setStyle("SECONDARY")
+                        .setDisabled(page === embeds.length - 1),
+                    new MessageButton()
+                        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                        .setCustomId("close")
+                        .setStyle("DANGER")
+                ])
+            ])
         });
         let i: MessageComponentInteraction;
         try {
-            i = await m.awaitMessageComponent({time: 300000});
-        } catch { breakReason = "Message timed out"; break; }
+            i = await m.awaitMessageComponent({ time: 300000 });
+        } catch {
+            breakReason = "Message timed out";
+            break;
+        }
         i.deferUpdate();
         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 {
@@ -231,29 +345,40 @@
         }
     }
     const em = new Discord.MessageEmbed(embeds[page].embed);
-    em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page) + " | " + breakReason);
-    await interaction.editReply({embeds: [em], components: [new MessageActionRow().addComponents([
-        new MessageButton()
-            .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
-            .setStyle("SECONDARY")
-            .setCustomId("left")
-            .setDisabled(true),
-        new MessageButton()
-            .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
-            .setStyle("SECONDARY")
-            .setCustomId("select")
-            .setDisabled(true),
-        new MessageButton()
-            .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
-            .setCustomId("right")
-            .setStyle("SECONDARY")
-            .setDisabled(true),
-        new MessageButton()
-            .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-            .setCustomId("close")
-            .setStyle("DANGER")
-            .setDisabled(true)
-    ])]});
+    em.setDescription(
+        em.description +
+            "\n" +
+            createPageIndicator(embeds.length, page) +
+            " | " +
+            breakReason
+    );
+    await interaction.editReply({
+        embeds: [em],
+        components: [
+            new MessageActionRow().addComponents([
+                new MessageButton()
+                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                    .setStyle("SECONDARY")
+                    .setCustomId("left")
+                    .setDisabled(true),
+                new MessageButton()
+                    .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
+                    .setStyle("SECONDARY")
+                    .setCustomId("select")
+                    .setDisabled(true),
+                new MessageButton()
+                    .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                    .setCustomId("right")
+                    .setStyle("SECONDARY")
+                    .setDisabled(true),
+                new MessageButton()
+                    .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                    .setCustomId("close")
+                    .setStyle("DANGER")
+                    .setDisabled(true)
+            ])
+        ]
+    });
 };
 
 const check = () => {
diff --git a/src/commands/user/avatar.ts b/src/commands/user/avatar.ts
index 8f327a5..35c475f 100644
--- a/src/commands/user/avatar.ts
+++ b/src/commands/user/avatar.ts
@@ -9,29 +9,44 @@
     builder
         .setName("avatar")
         .setDescription("Shows the avatar of a user")
-        .addUserOption(option => option.setName("user").setDescription("The user to get the avatar of | Default: Yourself"));
+        .addUserOption((option) =>
+            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;
-    await interaction.reply({embeds: [new EmojiEmbed()
-        .setTitle("User Info")
-        .setStatus("Success")
-        .setEmoji("MEMBER.JOIN")
-        .setDescription(
-            generateKeyValueList({
-                "member": renderUser(member.user),
-                "url": member.user.displayAvatarURL({dynamic: true})
-            })
-        )
-        .setImage(await member.user.displayAvatarURL({dynamic: true}))
-    ], ephemeral: true, fetchReply: true});
+    const member = (interaction.options.getMember("user") ||
+        interaction.member) as Discord.GuildMember;
+    await interaction.reply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("User Info")
+                .setStatus("Success")
+                .setEmoji("MEMBER.JOIN")
+                .setDescription(
+                    generateKeyValueList({
+                        member: renderUser(member.user),
+                        url: member.user.displayAvatarURL({ dynamic: true })
+                    })
+                )
+                .setImage(await member.user.displayAvatarURL({ dynamic: true }))
+        ],
+        ephemeral: true,
+        fetchReply: true
+    });
 };
 
-const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
+const check = (
+    _interaction: CommandInteraction,
+    _defaultCheck: WrappedCheck
+) => {
     return true;
 };
 
 export { command };
 export { callback };
-export { check };
\ No newline at end of file
+export { check };
diff --git a/src/commands/user/track.ts b/src/commands/user/track.ts
index 4720032..e0e41e0 100644
--- a/src/commands/user/track.ts
+++ b/src/commands/user/track.ts
@@ -1,8 +1,17 @@
 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";
 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-ignore
+// @ts-expect-error
 import { WrappedCheck } from "jshaiku";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -13,24 +22,38 @@
     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;
 };
 
-const callback = async (interaction: CommandInteraction): Promise<void | unknown> => {
+const callback = async (
+    interaction: CommandInteraction
+): Promise<void | unknown> => {
     const { renderUser } = client.logger;
     const member = interaction.options.getMember("user") as GuildMember;
     const guild = interaction.guild;
     if (!guild) return;
     const config = await client.database.guilds.read(guild.id);
-    await interaction.reply({embeds: LoadingEmbed, ephemeral: true});
+    await interaction.reply({ embeds: LoadingEmbed, ephemeral: true });
     let track = 0;
     let generated;
     const roles = await guild.roles.fetch();
@@ -38,119 +61,206 @@
     let managed: boolean;
     while (true) {
         const data = config.tracks[track];
-        if (data.manageableBy !== undefined) managed = data.manageableBy.some((element: string) => {return memberRoles.cache.has(element);});
-        else managed = false;
-        const dropdown = new Discord.MessageSelectMenu().addOptions(config.tracks.map((option, index) => {
-            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"),
-                emoji: client.emojis.resolve(getEmojiByName("TRACKS.SINGLE." + (hasRoleInTrack ? "ACTIVE" : "INACTIVE"), "id"))
+        if (data.manageableBy !== undefined)
+            managed = data.manageableBy.some((element: string) => {
+                return memberRoles.cache.has(element);
             });
-        })).setCustomId("select").setMaxValues(1);
+        else managed = false;
+        const dropdown = new Discord.MessageSelectMenu()
+            .addOptions(
+                config.tracks.map((option, index) => {
+                    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"),
+                        emoji: client.emojis.resolve(
+                            getEmojiByName(
+                                "TRACKS.SINGLE." +
+                                    (hasRoleInTrack ? "ACTIVE" : "INACTIVE"),
+                                "id"
+                            )
+                        )
+                    });
+                })
+            )
+            .setCustomId("select")
+            .setMaxValues(1);
         const allowed = [];
-        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";
-        generated += (data.retainPrevious ? "When promoted, the user keeps previous roles" : "Members will lose their current role when promoted") + "\n";
-        generated += "\n" + data.track.map((role, index) => {
-            const allow = (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
-            )) + " " +
-            roles.get(role).name + " [<@&" + roles.get(role).id + ">]";
-        }).join("\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";
+        generated +=
+            (data.retainPrevious
+                ? "When promoted, the user keeps previous roles"
+                : "Members will lose their current role when promoted") + "\n";
+        generated +=
+            "\n" +
+            data.track
+                .map((role, index) => {
+                    const allow =
+                        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
+                            )
+                        ) +
+                        " " +
+                        roles.get(role).name +
+                        " [<@&" +
+                        roles.get(role).id +
+                        ">]"
+                    );
+                })
+                .join("\n");
         const selected = [];
         for (let i = 0; i < data.track.length; i++) {
-            if (memberRoles.cache.has(data.track[i])) selected.push(data.track[i]);
+            if (memberRoles.cache.has(data.track[i]))
+                selected.push(data.track[i]);
         }
         const conflict = data.retainPrevious ? false : selected.length > 1;
         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
+                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 => {
-                    conflictDropdown.push(new SelectMenuOption({
-                        label: roles.get(role).name,
-                        value: roles.get(role).id
-                    }));
+                generated +=
+                    "In order to promote or demote this user, you must select which role the member should keep.";
+                selected.forEach((role) => {
+                    conflictDropdown.push(
+                        new SelectMenuOption({
+                            label: roles.get(role).name,
+                            value: roles.get(role).id
+                        })
+                    );
                 });
-                conflictDropdown = [new Discord.MessageSelectMenu()
-                    .addOptions(conflictDropdown)
-                    .setCustomId("conflict")
-                    .setMaxValues(1)
-                    .setPlaceholder("Select a role to keep")];
+                conflictDropdown = [
+                    new Discord.MessageSelectMenu()
+                        .addOptions(conflictDropdown)
+                        .setCustomId("conflict")
+                        .setMaxValues(1)
+                        .setPlaceholder("Select a role to keep")
+                ];
             } else {
-                generated += "You don't have permission to manage one or more of the users roles, and therefore can't select one to keep.";
+                generated +=
+                    "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: [new EmojiEmbed()
-            .setEmoji("TRACKS.ICON")
-            .setTitle("Tracks")
-            .setDescription(`${generated}`)
-            .setStatus("Success")
-        ], components: [
-            new MessageActionRow().addComponents(dropdown)
-        ]
-            .concat(conflict && conflictDropdown.length ? [new MessageActionRow().addComponents(conflictDropdown)] : [])
-            .concat([
-                new MessageActionRow().addComponents([
-                    new MessageButton()
-                        .setEmoji(getEmojiByName("CONTROL.UP", "id"))
-                        .setLabel("Move up")
-                        .setCustomId("promote")
-                        .setStyle("SUCCESS")
-                        .setDisabled(conflict || currentRoleIndex === 0 || (currentRoleIndex === -1 ? false : !allowed[currentRoleIndex - 1])),
-                    new MessageButton()
-                        .setEmoji(getEmojiByName("CONTROL.DOWN", "id"))
-                        .setLabel("Move down")
-                        .setCustomId("demote")
-                        .setStyle("DANGER")
-                        .setDisabled(conflict || (
-                            data.nullable ? currentRoleIndex <= -1 :
-                                currentRoleIndex === data.track.length - 1 || currentRoleIndex <= -1
-                        ) || !allowed[currentRoleIndex])
+        const m = (await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("TRACKS.ICON")
+                    .setTitle("Tracks")
+                    .setDescription(`${generated}`)
+                    .setStatus("Success")
+            ],
+            components: [new MessageActionRow().addComponents(dropdown)]
+                .concat(
+                    conflict && conflictDropdown.length
+                        ? [
+                              new MessageActionRow().addComponents(
+                                  conflictDropdown
+                              )
+                          ]
+                        : []
+                )
+                .concat([
+                    new MessageActionRow().addComponents([
+                        new MessageButton()
+                            .setEmoji(getEmojiByName("CONTROL.UP", "id"))
+                            .setLabel("Move up")
+                            .setCustomId("promote")
+                            .setStyle("SUCCESS")
+                            .setDisabled(
+                                conflict ||
+                                    currentRoleIndex === 0 ||
+                                    (currentRoleIndex === -1
+                                        ? false
+                                        : !allowed[currentRoleIndex - 1])
+                            ),
+                        new MessageButton()
+                            .setEmoji(getEmojiByName("CONTROL.DOWN", "id"))
+                            .setLabel("Move down")
+                            .setCustomId("demote")
+                            .setStyle("DANGER")
+                            .setDisabled(
+                                conflict ||
+                                    (data.nullable
+                                        ? currentRoleIndex <= -1
+                                        : currentRoleIndex ===
+                                              data.track.length - 1 ||
+                                          currentRoleIndex <= -1) ||
+                                    !allowed[currentRoleIndex]
+                            )
+                    ])
                 ])
-            ])
-        }) as Message;
+        })) as Message;
         let component;
         try {
-            component = await m.awaitMessageComponent({time: 300000});
+            component = await m.awaitMessageComponent({ time: 300000 });
         } catch (e) {
             return;
         }
         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 (
-                currentRoleIndex === -1 ? allowed[data.track.length - 1] :
-                    allowed[currentRoleIndex - 1] && allowed[currentRoleIndex]
+                currentRoleIndex === -1
+                    ? allowed[data.track.length - 1]
+                    : allowed[currentRoleIndex - 1] && allowed[currentRoleIndex]
             ) {
                 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 (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]);
@@ -162,22 +272,32 @@
     }
 };
 
-const check = async (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
-    const tracks = (await client.database.guilds.read(interaction.guild.id)).tracks;
+const check = async (
+    interaction: CommandInteraction,
+    _defaultCheck: WrappedCheck
+) => {
+    const tracks = (await client.database.guilds.read(interaction.guild.id))
+        .tracks;
     if (tracks.length === 0) throw "This server does not have any tracks";
-    const member = (interaction.member as GuildMember);
+    const member = interaction.member as GuildMember;
     // Allow the owner to promote anyone
     if (member.id === interaction.guild.ownerId) return true;
     // Check if the user can manage any of the tracks
     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;
     }
     // Check if the user has manage_roles permission
-    if (!managed && ! member.permissions.has("MANAGE_ROLES")) throw "You do not have the *Manage Roles* permission";
+    if (!managed && !member.permissions.has("MANAGE_ROLES"))
+        throw "You do not have the *Manage Roles* permission";
     // Allow track
     return true;
 };
@@ -185,4 +305,3 @@
 export { command };
 export { callback };
 export { check };
-
diff --git a/src/commands/verify.ts b/src/commands/verify.ts
index f7e66b8..d1a0659 100644
--- a/src/commands/verify.ts
+++ b/src/commands/verify.ts
@@ -1,7 +1,7 @@
 import type { CommandInteraction } from "discord.js";
 import { SlashCommandBuilder } from "@discordjs/builders";
 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-ignore
+// @ts-expect-error
 import { WrappedCheck } from "jshaiku";
 import verify from "../reflex/verify.js";
 
@@ -13,7 +13,10 @@
     verify(interaction);
 };
 
-const check = (_interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
+const check = (
+    _interaction: CommandInteraction,
+    _defaultCheck: WrappedCheck
+) => {
     return true;
 };
 
diff --git a/src/config/default.json b/src/config/default.json
index 3976812..7f2fdbd 100644
--- a/src/config/default.json
+++ b/src/config/default.json
@@ -92,4 +92,4 @@
     "tracks": [],
     "roleMenu": [],
     "tags": {}
-}
\ No newline at end of file
+}
diff --git a/src/config/emojis.json b/src/config/emojis.json
index 49c2b27..fc90ce4 100644
--- a/src/config/emojis.json
+++ b/src/config/emojis.json
@@ -368,4 +368,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}
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);
 
diff --git a/src/events/channelCreate.ts b/src/events/channelCreate.ts
index c4c1347..7350ebd 100644
--- a/src/events/channelCreate.ts
+++ b/src/events/channelCreate.ts
@@ -1,49 +1,59 @@
 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;
     let displayName;
     switch (channel.type) {
-    case "GUILD_TEXT": {
-        emoji = "CHANNEL.TEXT.CREATE";
-        readableType = "Text";
-        displayName = "Text Channel";
-        break;
-    }
-    case "GUILD_NEWS": {
-        emoji = "CHANNEL.TEXT.CREATE";
-        readableType = "Announcement";
-        displayName = "Announcement Channel";
-        break;
-    }
-    case "GUILD_VOICE": {
-        emoji = "CHANNEL.VOICE.CREATE";
-        readableType = "Voice";
-        displayName = "Voice Channel";
-        break;
-    }
-    case "GUILD_STAGE": {
-        emoji = "CHANNEL.VOICE.CREATE";
-        readableType = "Stage";
-        displayName = "Stage Channel";
-        break;
-    }
-    case "GUILD_CATEGORY": {
-        emoji = "CHANNEL.CATEGORY.CREATE";
-        readableType = "Category";
-        displayName = "Category";
-        break;
-    }
-    default: {
-        emoji = "CHANNEL.TEXT.CREATE";
-        readableType = "Channel";
-        displayName = "Channel";
-    }
+        case "GUILD_TEXT": {
+            emoji = "CHANNEL.TEXT.CREATE";
+            readableType = "Text";
+            displayName = "Text Channel";
+            break;
+        }
+        case "GUILD_NEWS": {
+            emoji = "CHANNEL.TEXT.CREATE";
+            readableType = "Announcement";
+            displayName = "Announcement Channel";
+            break;
+        }
+        case "GUILD_VOICE": {
+            emoji = "CHANNEL.VOICE.CREATE";
+            readableType = "Voice";
+            displayName = "Voice Channel";
+            break;
+        }
+        case "GUILD_STAGE": {
+            emoji = "CHANNEL.VOICE.CREATE";
+            readableType = "Stage";
+            displayName = "Stage Channel";
+            break;
+        }
+        case "GUILD_CATEGORY": {
+            emoji = "CHANNEL.CATEGORY.CREATE";
+            readableType = "Category";
+            displayName = "Category";
+            break;
+        }
+        default: {
+            emoji = "CHANNEL.TEXT.CREATE";
+            readableType = "Channel";
+            displayName = "Channel";
+        }
     }
     const data = {
         meta: {
@@ -58,9 +68,15 @@
             channelId: entry(channel.id, `\`${channel.id}\``),
             name: entry(channel.name, renderChannel(channel)),
             type: entry(channel.type, readableType),
-            category: entry(channel.parent ? channel.parent.id : null, channel.parent ? channel.parent.name : "Uncategorised"),
+            category: entry(
+                channel.parent ? channel.parent.id : null,
+                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 c8a72a4..af55205 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -3,58 +3,77 @@
 export const event = "channelDelete";
 
 export async function callback(client, channel) {
-    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = channel.client.logger;
+    const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } =
+        channel.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;
     let readableType;
     let displayName;
     switch (channel.type) {
-    case "GUILD_TEXT": {
-        emoji = "CHANNEL.TEXT.DELETE";
-        readableType = "Text";
-        displayName = "Text Channel";
-        break;
-    }
-    case "GUILD_VOICE": {
-        emoji = "CHANNEL.VOICE.DELETE";
-        readableType = "Voice";
-        displayName = "Voice Channel";
-        break;
-    }
-    case "GUILD_CATEGORY": {
-        emoji = "CHANNEL.CATEGORY.DELETE";
-        readableType = "Category";
-        displayName = "Category";
-        break;
-    }
-    default: {
-        emoji = "CHANNEL.TEXT.DELETE";
-        readableType = "Channel";
-        displayName = "Channel";
-    }
+        case "GUILD_TEXT": {
+            emoji = "CHANNEL.TEXT.DELETE";
+            readableType = "Text";
+            displayName = "Text Channel";
+            break;
+        }
+        case "GUILD_VOICE": {
+            emoji = "CHANNEL.VOICE.DELETE";
+            readableType = "Voice";
+            displayName = "Voice Channel";
+            break;
+        }
+        case "GUILD_CATEGORY": {
+            emoji = "CHANNEL.CATEGORY.DELETE";
+            readableType = "Category";
+            displayName = "Category";
+            break;
+        }
+        default: {
+            emoji = "CHANNEL.TEXT.DELETE";
+            readableType = "Channel";
+            displayName = "Channel";
+        }
     }
     const list = {
         channelId: entry(channel.id, `\`${channel.id}\``),
         name: entry(channel.id, `${channel.name}`),
         topic: null,
         type: entry(channel.type, readableType),
-        category: entry(channel.parent ? channel.parent.id : null, channel.parent ? channel.parent.name : "Uncategorised"),
+        category: entry(
+            channel.parent ? channel.parent.id : null,
+            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.topic !== null ?? false)
+        list.topic = entry(
+            channel.topic,
+            `\`\`\`\n${channel.topic.replace("`", "'")}\n\`\`\``
+        );
     else delete list.topic;
-    if (channel.nsfw !== null ?? false) list.nsfw = entry(channel.nsfw, channel.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`);
+    if (channel.nsfw !== null ?? false)
+        list.nsfw = entry(
+            channel.nsfw,
+            channel.nsfw
+                ? `${getEmojiByName("CONTROL.TICK")} Yes`
+                : `${getEmojiByName("CONTROL.CROSS")} No`
+        );
     else delete list.nsfw;
 
     const data = {
-        meta:{
+        meta: {
             type: "channelDelete",
             displayName: displayName + " Deleted",
             calculateType: "channelUpdate",
diff --git a/src/events/channelUpdate.ts b/src/events/channelUpdate.ts
index 89692e8..6717661 100644
--- a/src/events/channelUpdate.ts
+++ b/src/events/channelUpdate.ts
@@ -5,118 +5,218 @@
 
 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;
+    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;
-    let readableType:string;
-    let displayName:string ;
+    let emoji: string;
+    let readableType: string;
+    let displayName: string;
     const changes = {
         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.position !== nc.position) changes["position"] = entry([oc.position, nc.position], `${oc.position} -> ${nc.position}`);
+    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}`
+        );
 
     switch (nc.type) {
-    case "GUILD_TEXT": {
-        emoji = "CHANNEL.TEXT.EDIT";
-        readableType = "Text";
-        displayName = "Text Channel";
-        let oldTopic = oc.topic, newTopic = nc.topic;
-        if (oldTopic) {
-            if (oldTopic.length > 256) 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\`\`\``;
-            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`;
-        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]}`);
-        if (oc.rateLimitPerUser !== nc.rateLimitPerUser) changes["rateLimitPerUser"] = entry(
-            [oc.rateLimitPerUser, nc.rateLimitPerUser],
-            `${humanizeDuration(oc.rateLimitPerUser * 1000)} -> ${humanizeDuration(nc.rateLimitPerUser * 1000)}`
-        );
+        case "GUILD_TEXT": {
+            emoji = "CHANNEL.TEXT.EDIT";
+            readableType = "Text";
+            displayName = "Text Channel";
+            let oldTopic = oc.topic,
+                newTopic = nc.topic;
+            if (oldTopic) {
+                if (oldTopic.length > 256)
+                    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\`\`\``;
+                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`;
+            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]}`
+                );
+            if (oc.rateLimitPerUser !== nc.rateLimitPerUser)
+                changes.rateLimitPerUser = entry(
+                    [oc.rateLimitPerUser, nc.rateLimitPerUser],
+                    `${humanizeDuration(
+                        oc.rateLimitPerUser * 1000
+                    )} -> ${humanizeDuration(nc.rateLimitPerUser * 1000)}`
+                );
 
-        break;
-    }
-    case "GUILD_NEWS": {
-        emoji = "CHANNEL.TEXT.EDIT";
-        readableType = "News";
-        displayName = "News Channel";
-        let oldTopic = oc.topic, newTopic = nc.topic;
-        if (oldTopic) {
-            if (oldTopic.length > 256) 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\`\`\``;
-            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"}`);
-        break;
-    }
-    case "GUILD_VOICE": {
-        emoji = "CHANNEL.VOICE.EDIT";
-        readableType = "Voice";
-        displayName = "Voice Channel";
-        if (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}`);
-        if (oc.rtcRegion !== nc.rtcRegion) changes["region"] = entry(
-            [oc.rtcRegion, nc.rtcRegion],
-            `${oc.rtcRegion || "Automatic"} -> ${nc.rtcRegion || "Automatic"}`
-        );
-        break;
-    }
-    case "GUILD_STAGE": {
-        emoji = "CHANNEL.VOICE.EDIT";
-        readableType = "Stage";
-        displayName = "Stage Channel";
-        let oldTopic = oc.topic, newTopic = nc.topic;
-        if (oldTopic) {
-            if (oldTopic.length > 256) 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\`\`\``;
-            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}`);
-        if (oc.userLimit !== nc.userLimit) changes["maxUsers"] = entry([oc.userLimit, 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"}`
-        );
-        break;
-    }
-    case "GUILD_CATEGORY": {
-        emoji = "CHANNEL.CATEGORY.EDIT";
-        readableType = "Category";
-        displayName = "Category";
-        break;
-    }
-    default: {
-        emoji = "CHANNEL.TEXT.EDIT";
-        readableType = "Channel";
-        displayName = "Channel";
-    }
+            break;
+        }
+        case "GUILD_NEWS": {
+            emoji = "CHANNEL.TEXT.EDIT";
+            readableType = "News";
+            displayName = "News Channel";
+            let oldTopic = oc.topic,
+                newTopic = nc.topic;
+            if (oldTopic) {
+                if (oldTopic.length > 256)
+                    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\`\`\``;
+                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"}`
+                );
+            break;
+        }
+        case "GUILD_VOICE": {
+            emoji = "CHANNEL.VOICE.EDIT";
+            readableType = "Voice";
+            displayName = "Voice Channel";
+            if (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
+                    }`
+                );
+            if (oc.rtcRegion !== nc.rtcRegion)
+                changes.region = entry(
+                    [oc.rtcRegion, nc.rtcRegion],
+                    `${oc.rtcRegion || "Automatic"} -> ${
+                        nc.rtcRegion || "Automatic"
+                    }`
+                );
+            break;
+        }
+        case "GUILD_STAGE": {
+            emoji = "CHANNEL.VOICE.EDIT";
+            readableType = "Stage";
+            displayName = "Stage Channel";
+            let oldTopic = oc.topic,
+                newTopic = nc.topic;
+            if (oldTopic) {
+                if (oldTopic.length > 256)
+                    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\`\`\``;
+                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}`
+                );
+            if (oc.userLimit !== nc.userLimit)
+                changes.maxUsers = entry(
+                    [oc.userLimit, 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"
+                    }`
+                );
+            break;
+        }
+        case "GUILD_CATEGORY": {
+            emoji = "CHANNEL.CATEGORY.EDIT";
+            readableType = "Category";
+            displayName = "Category";
+            break;
+        }
+        default: {
+            emoji = "CHANNEL.TEXT.EDIT";
+            readableType = "Channel";
+            displayName = "Channel";
+        }
     }
     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}`);
+    if (oc.type !== nc.type)
+        changes.type = entry(
+            [oc.type, nc.type],
+            `${t[0] + t.splice(1).toLowerCase()} -> ${readableType}`
+        );
     if (!(Object.values(changes).length - 4)) return;
     const data = {
-        meta:{
+        meta: {
             type: "channelUpdate",
             displayName: displayName + " Edited",
             calculateType: "channelUpdate",
@@ -130,4 +230,4 @@
         }
     };
     log(data);
-}
\ No newline at end of file
+}
diff --git a/src/events/commandError.ts b/src/events/commandError.ts
index 2ec6a5d..ce50122 100644
--- a/src/events/commandError.ts
+++ b/src/events/commandError.ts
@@ -4,18 +4,26 @@
 
 export async function callback(client, interaction, error) {
     if (interaction.replied || interaction.deferred) {
-        await interaction.followUp({embeds: [new EmojiEmbed()
-            .setTitle("Something went wrong")
-            .setDescription(error.message ?? error.toString())
-            .setStatus("Danger")
-            .setEmoji("CONTROL.BLOCKCROSS")
-        ], ephemeral: true});
+        await interaction.followUp({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Something went wrong")
+                    .setDescription(error.message ?? error.toString())
+                    .setStatus("Danger")
+                    .setEmoji("CONTROL.BLOCKCROSS")
+            ],
+            ephemeral: true
+        });
     } else {
-        await interaction.reply({embeds: [new EmojiEmbed()
-            .setTitle("Something went wrong")
-            .setDescription(error.message ?? error.toString())
-            .setStatus("Danger")
-            .setEmoji("CONTROL.BLOCKCROSS")
-        ], ephemeral: true});
+        await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Something went wrong")
+                    .setDescription(error.message ?? error.toString())
+                    .setStatus("Danger")
+                    .setEmoji("CONTROL.BLOCKCROSS")
+            ],
+            ephemeral: true
+        });
     }
 }
diff --git a/src/events/emojiCreate.ts b/src/events/emojiCreate.ts
index 83a30e2..53f564c 100644
--- a/src/events/emojiCreate.ts
+++ b/src/events/emojiCreate.ts
@@ -1,9 +1,19 @@
 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: {
@@ -18,7 +28,10 @@
             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 5ed7a87..041b432 100644
--- a/src/events/emojiDelete.ts
+++ b/src/events/emojiDelete.ts
@@ -1,9 +1,19 @@
 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: {
@@ -18,8 +28,14 @@
             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 d04c6c8..34b16de 100644
--- a/src/events/emojiUpdate.ts
+++ b/src/events/emojiUpdate.ts
@@ -1,7 +1,15 @@
 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");
@@ -12,11 +20,14 @@
         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 = {
-        meta:{
+        meta: {
             type: "emojiUpdate",
             displayName: "Emoji Edited",
             calculateType: "emojiUpdate",
@@ -30,4 +41,4 @@
         }
     };
     log(data);
-}
\ No newline at end of file
+}
diff --git a/src/events/guildBanAdd.ts b/src/events/guildBanAdd.ts
index c5d269b..dd723d3 100644
--- a/src/events/guildBanAdd.ts
+++ b/src/events/guildBanAdd.ts
@@ -6,11 +6,20 @@
 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",
@@ -23,10 +32,19 @@
         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 352265f..4c2263d 100644
--- a/src/events/guildBanRemove.ts
+++ b/src/events/guildBanRemove.ts
@@ -6,11 +6,20 @@
 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",
@@ -23,9 +32,15 @@
         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/guildCreate.ts b/src/events/guildCreate.ts
index 8f8d0f5..5ae4248 100644
--- a/src/events/guildCreate.ts
+++ b/src/events/guildCreate.ts
@@ -1,6 +1,6 @@
 import type { Guild } from "discord.js";
 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-ignore
+// @ts-expect-error
 import type { HaikuClient } from "jshaiku";
 import guide from "../reflex/guide.js";
 
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index a7f8c47..4cffe69 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -2,14 +2,29 @@
 
 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(
-                "nickname", after.guild.id, after.user, audit.executor,
-                null, before.nickname || before.user.username, after.nickname || after.user.username);
+                "nickname",
+                after.guild.id,
+                after.user,
+                audit.executor,
+                null,
+                before.nickname || before.user.username,
+                after.nickname || after.user.username
+            );
             const data = {
                 meta: {
                     type: "memberUpdate",
@@ -22,19 +37,41 @@
                 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
                 }
             };
             log(data);
-        } else if (before.communicationDisabledUntilTimestamp < new Date().getTime() && after.communicationDisabledUntil > new Date().getTime()) {
+        } else if (
+            before.communicationDisabledUntilTimestamp < new Date().getTime() &&
+            after.communicationDisabledUntil > new Date().getTime()
+        ) {
             await client.database.history.create(
-                "mute", after.guild.id, after.user, audit.executor, audit.reason, null, null, null
+                "mute",
+                after.guild.id,
+                after.user,
+                audit.executor,
+                audit.reason,
+                null,
+                null,
+                null
             );
             const data = {
                 meta: {
@@ -48,25 +85,51 @@
                 list: {
                     memberId: entry(after.id, `\`${after.id}\``),
                     name: entry(after.user.id, renderUser(after.user)),
-                    mutedUntil: entry(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*")
+                    mutedUntil: entry(
+                        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*"
+                    )
                 },
                 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 &&
+            after.communicationDisabledUntil === null &&
+            before.communicationDisabledUntilTimestamp !== null &&
             new Date().getTime() >= audit.createdTimestamp
         ) {
             await client.database.history.create(
-                "unmute", after.guild.id, after.user, audit.executor, null, null, null, null
+                "unmute",
+                after.guild.id,
+                after.user,
+                audit.executor,
+                null,
+                null,
+                null,
+                null
             );
             const data = {
                 meta: {
@@ -80,15 +143,27 @@
                 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
                 }
             };
             log(data);
-            client.database.eventScheduler.cancel("naturalUnmute", {guild: after.guild.id, user: after.id, expires: before.communicationDisabledUntilTimestamp});
+            client.database.eventScheduler.cancel("naturalUnmute", {
+                guild: after.guild.id,
+                user: after.id,
+                expires: before.communicationDisabledUntilTimestamp
+            });
         }
-    } catch (e) { console.log(e); }
+    } catch (e) {
+        console.log(e);
+    }
 }
diff --git a/src/events/guildUpdate.ts b/src/events/guildUpdate.ts
index 2cb1de8..2c87807 100644
--- a/src/events/guildUpdate.ts
+++ b/src/events/guildUpdate.ts
@@ -4,9 +4,12 @@
 
 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 = {};
 
@@ -29,18 +32,65 @@
         ELEVATED: "Enabled"
     };
 
-    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()})`);
-    if (before.splash !== after.splash) list["splash"] = entry([before.splash, after.splash], `[Before](${before.splashURL()}) -> [After](${after.splashURL()})`);
-    if (before.banner !== after.banner) list["banner"] = entry([before.banner, after.banner], `[Before](${before.bannerURL()}) -> [After](${after.bannerURL()})`);
-    if (before.owner !== after.owner) list["owner"] = entry([before.owner, after.owner], `${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]}`);
-    if (before.explicitContentFilter !== after.explicitContentFilter) list["explicitContentFilter"] = entry([explicitContentFilterLevels[before.explicitContentFilter], explicitContentFilterLevels[after.explicitContentFilter]], `${explicitContentFilterLevels[before.explicitContentFilter]} -> ${explicitContentFilterLevels[after.explicitContentFilter]}`);
-    if (before.mfaLevel !== after.mfaLevel) list["2 factor authentication"] = entry([MFALevels[before.mfaLevel], MFALevels[after.mfaLevel]], `${MFALevels[before.mfaLevel]} -> ${MFALevels[after.mfaLevel]}`);
+    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()})`
+        );
+    if (before.splash !== after.splash)
+        list.splash = entry(
+            [before.splash, after.splash],
+            `[Before](${before.splashURL()}) -> [After](${after.splashURL()})`
+        );
+    if (before.banner !== after.banner)
+        list.banner = entry(
+            [before.banner, after.banner],
+            `[Before](${before.bannerURL()}) -> [After](${after.bannerURL()})`
+        );
+    if (before.owner !== after.owner)
+        list.owner = entry(
+            [before.owner, after.owner],
+            `${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]
+            }`
+        );
+    if (before.explicitContentFilter !== after.explicitContentFilter)
+        list.explicitContentFilter = entry(
+            [
+                explicitContentFilterLevels[before.explicitContentFilter],
+                explicitContentFilterLevels[after.explicitContentFilter]
+            ],
+            `${explicitContentFilterLevels[before.explicitContentFilter]} -> ${
+                explicitContentFilterLevels[after.explicitContentFilter]
+            }`
+        );
+    if (before.mfaLevel !== after.mfaLevel)
+        list["2 factor authentication"] = entry(
+            [MFALevels[before.mfaLevel], MFALevels[after.mfaLevel]],
+            `${MFALevels[before.mfaLevel]} -> ${MFALevels[after.mfaLevel]}`
+        );
 
-    if (!(Object.keys(list).length)) return;
-    list["updated"] = entry(new Date().getTime(), renderDelta(new Date().getTime()));
-    list["updatedBy"] = entry(audit.executor.id, renderUser(audit.executor));
+    if (!Object.keys(list).length) return;
+    list.updated = entry(
+        new Date().getTime(),
+        renderDelta(new Date().getTime())
+    );
+    list.updatedBy = entry(audit.executor.id, renderUser(audit.executor));
     const data = {
         meta: {
             type: "guildUpdate",
diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts
index 08fcc77..60b90e3 100644
--- a/src/events/interactionCreate.ts
+++ b/src/events/interactionCreate.ts
@@ -8,49 +8,123 @@
 
 export const event = "interactionCreate";
 
-
 function getAutocomplete(typed: string, options: string[]): object[] {
-    options = options.filter(option => option.length <= 100); // thanks discord. 6000 character limit on slash command inputs but only 100 for autocomplete.
-    if (!typed) return options.slice(0, 25).sort().map(option => ({name: option, value: option}));
-    const fuse = new Fuse(options, {useExtendedSearch: true, findAllMatches: true, minMatchCharLength: 0}).search(typed);
-    return fuse.slice(0, 25).map(option => ({name: option.item, value: option.item}));
+    options = options.filter((option) => option.length <= 100); // thanks discord. 6000 character limit on slash command inputs but only 100 for autocomplete.
+    if (!typed)
+        return options
+            .slice(0, 25)
+            .sort()
+            .map((option) => ({ name: option, value: option }));
+    const fuse = new Fuse(options, {
+        useExtendedSearch: true,
+        findAllMatches: true,
+        minMatchCharLength: 0
+    }).search(typed);
+    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}}`); } }
-    else { for (const replacement of validReplacements) { autocompletions.push(`${typed} {${replacement}}`); } }
+    if (beforeLastOpenBracket !== null) {
+        for (const replacement of validReplacements) {
+            autocompletions.push(
+                `${beforeLastOpenBracket[1]} {${replacement}}`
+            );
+        }
+    } else {
+        for (const replacement of validReplacements) {
+            autocompletions.push(`${typed} {${replacement}}`);
+        }
+    }
     return getAutocomplete(typed, autocompletions);
 }
 function generateWelcomeMessageAutocomplete(typed) {
-    const validReplacements = ["serverName", "memberCount", "memberCount:bots", "memberCount:humans", "member:mention", "member:name"];
+    const validReplacements = [
+        "serverName",
+        "memberCount",
+        "memberCount:bots",
+        "memberCount:humans",
+        "member:mention",
+        "member:name"
+    ];
     const autocompletions = [];
     const beforeLastOpenBracket = typed.match(/(.*){[^{}]{0,15}$/);
-    if (beforeLastOpenBracket !== null) { for (const replacement of validReplacements) { autocompletions.push(`${beforeLastOpenBracket[1]} {${replacement}}`); } }
-    else { for (const replacement of validReplacements) { autocompletions.push(`${typed} {${replacement}}`); } }
+    if (beforeLastOpenBracket !== null) {
+        for (const replacement of validReplacements) {
+            autocompletions.push(
+                `${beforeLastOpenBracket[1]} {${replacement}}`
+            );
+        }
+    } else {
+        for (const replacement of validReplacements) {
+            autocompletions.push(`${typed} {${replacement}}`);
+        }
+    }
     return getAutocomplete(typed, autocompletions);
 }
 
 async function interactionCreate(interaction) {
     if (interaction.componentType === "BUTTON") {
         switch (interaction.customId) {
-        case "rolemenu": { return await roleMenu(interaction); }
-        case "verifybutton": { return verify(interaction); }
-        case "createticket": { return create(interaction); }
-        case "closeticket": { return close(interaction); }
-        case "createtranscript": { return createTranscript(interaction); }
+            case "rolemenu": {
+                return await roleMenu(interaction);
+            }
+            case "verifybutton": {
+                return verify(interaction);
+            }
+            case "createticket": {
+                return create(interaction);
+            }
+            case "closeticket": {
+                return close(interaction);
+            }
+            case "createtranscript": {
+                return createTranscript(interaction);
+            }
         }
     } else if (interaction.type === "APPLICATION_COMMAND_AUTOCOMPLETE") {
-        switch (`${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)))); }
-        case "settings null stats": { return interaction.respond(generateStatsChannelAutocomplete(interaction.options.getString("name"))); }
-        case "settings null welcome": { return interaction.respond(generateWelcomeMessageAutocomplete(interaction.options.getString("message"))); }
+        switch (
+            `${
+                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)
+                    )
+                );
+            }
+            case "settings null stats": {
+                return interaction.respond(
+                    generateStatsChannelAutocomplete(
+                        interaction.options.getString("name")
+                    )
+                );
+            }
+            case "settings null welcome": {
+                return interaction.respond(
+                    generateWelcomeMessageAutocomplete(
+                        interaction.options.getString("message")
+                    )
+                );
+            }
         }
     }
 }
 
 export async function callback(client, interaction) {
     await interactionCreate(interaction);
-}
\ No newline at end of file
+}
diff --git a/src/events/inviteCreate.ts b/src/events/inviteCreate.ts
index 1cbed02..5461307 100644
--- a/src/events/inviteCreate.ts
+++ b/src/events/inviteCreate.ts
@@ -2,9 +2,19 @@
 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: {
@@ -18,9 +28,15 @@
         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 cbe4d4b..e5bf241 100644
--- a/src/events/inviteDelete.ts
+++ b/src/events/inviteDelete.ts
@@ -2,9 +2,19 @@
 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: {
@@ -18,9 +28,15 @@
         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 34545fb..ea0b24d 100644
--- a/src/events/memberJoin.ts
+++ b/src/events/memberJoin.ts
@@ -6,9 +6,16 @@
 
 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);
+    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 data = {
         meta: {
             type: "memberJoin",
@@ -22,7 +29,10 @@
             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 842a48b..d170396 100644
--- a/src/events/memberLeave.ts
+++ b/src/events/memberLeave.ts
@@ -6,9 +6,12 @@
 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;
@@ -18,7 +21,13 @@
     }
     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",
@@ -32,10 +41,21 @@
                 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: {
@@ -43,7 +63,13 @@
             }
         };
     } 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",
@@ -56,9 +82,18 @@
             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 bbb6a32..53de4df 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -1,24 +1,42 @@
 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-ignore
+// @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";
 import client from "../utils/client.js";
-import {callback as a} from "../reflex/statsChannelUpdate.js";
+import { callback as a } from "../reflex/statsChannelUpdate.js";
 import type { Message } from "discord.js";
 
 export const event = "messageCreate";
 
 export async function callback(_client: HaikuClient, message: Message) {
-    if(!message) return;
-    if(!message.guild) return;
+    if (!message) return;
+    if (!message.guild) return;
     if (message.author.bot) return;
     if (message.channel.type === "DM") return;
-    try { await a(client, await message.guild.members.fetch(message.author.id)); } catch(e) { console.log(e);}
+    try {
+        await a(client, await message.guild.members.fetch(message.author.id));
+    } catch (e) {
+        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);
 
@@ -26,36 +44,61 @@
     const config = await client.memory.readGuildInfo(message.guild.id);
     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]})`; }
+    if (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}\``),
         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())),
         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 ? `[[Jump to message]](https://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.reference.messageId})` : "None"
+            message.reference
+                ? `[[Jump to message]](https://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.reference.messageId})`
+                : "None"
         )
     };
 
     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",
                         timestamp: new Date().getTime()
                     },
                     separate: {
-                        start: filter + " Contained invite\n\n" + (content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*")
+                        start:
+                            filter +
+                            " Contained invite\n\n" +
+                            (content
+                                ? `**Message:**\n\`\`\`${content}\`\`\``
+                                : "**Message:** *Message had no content*")
                     },
                     list: list,
                     hidden: {
@@ -69,15 +112,26 @@
 
     if (fileNames.files.length > 0) {
         for (const element of fileNames.files) {
-            if(!message) return;
+            if (!message) return;
             const url = element.url ? element.url : element.local;
             if (url !== undefined) {
-                if(/\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/.test(url)) {
-                    if (config.filters.images.NSFW && !(
-                        message.channel.type === "GUILD_PUBLIC_THREAD" ? false : message.channel.nsfw
-                    )) {
+                if (
+                    /\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/.test(
+                        url
+                    )
+                ) {
+                    if (
+                        config.filters.images.NSFW &&
+                        !(message.channel.type === "GUILD_PUBLIC_THREAD"
+                            ? false
+                            : 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: {
@@ -89,7 +143,12 @@
                                     timestamp: new Date().getTime()
                                 },
                                 separate: {
-                                    start: filter + " Image detected as NSFW\n\n" + (content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*")
+                                    start:
+                                        filter +
+                                        " Image detected as NSFW\n\n" +
+                                        (content
+                                            ? `**Message:**\n\`\`\`${content}\`\`\``
+                                            : "**Message:** *Message had no content*")
                                 },
                                 list: list,
                                 hidden: {
@@ -101,9 +160,17 @@
                     }
                     if (config.filters.wordFilter.enabled) {
                         const text = await TestImage(url);
-                        const check = TestString(text ?? "", config.filters.wordFilter.words.loose, config.filters.wordFilter.words.strict);
-                        if(check !== null) {
-                            createLogException(message.guild.id, message.channel.id, message.id);
+                        const check = TestString(
+                            text ?? "",
+                            config.filters.wordFilter.words.loose,
+                            config.filters.wordFilter.words.strict
+                        );
+                        if (check !== null) {
+                            createLogException(
+                                message.guild.id,
+                                message.channel.id,
+                                message.id
+                            );
                             await message.delete();
                             const data = {
                                 meta: {
@@ -115,7 +182,12 @@
                                     timestamp: new Date().getTime()
                                 },
                                 separate: {
-                                    start: filter + " Image contained filtered word\n\n" + (content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*")
+                                    start:
+                                        filter +
+                                        " Image contained filtered word\n\n" +
+                                        (content
+                                            ? `**Message:**\n\`\`\`${content}\`\`\``
+                                            : "**Message:** *Message had no content*")
                                 },
                                 list: list,
                                 hidden: {
@@ -126,9 +198,13 @@
                         }
                     }
                     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);
+                        if (url.match(/\.+(webp|png|jpg)$/gi)) {
+                            if (!(await SizeCheck(element))) {
+                                createLogException(
+                                    message.guild.id,
+                                    message.channel.id,
+                                    message.id
+                                );
                                 await message.delete();
                                 const data = {
                                     meta: {
@@ -140,7 +216,12 @@
                                         timestamp: new Date().getTime()
                                     },
                                     separate: {
-                                        start: filter + " Image was too small\n\n" + (content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*")
+                                        start:
+                                            filter +
+                                            " Image was too small\n\n" +
+                                            (content
+                                                ? `**Message:**\n\`\`\`${content}\`\`\``
+                                                : "**Message:** *Message had no content*")
                                     },
                                     list: list,
                                     hidden: {
@@ -154,7 +235,11 @@
                 }
                 if (config.filters.malware) {
                     if (!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: {
@@ -166,7 +251,12 @@
                                 timestamp: new Date().getTime()
                             },
                             separate: {
-                                start: filter + " File detected as malware\n\n" + (content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*")
+                                start:
+                                    filter +
+                                    " File detected as malware\n\n" +
+                                    (content
+                                        ? `**Message:**\n\`\`\`${content}\`\`\``
+                                        : "**Message:** *Message had no content*")
                             },
                             list: list,
                             hidden: {
@@ -179,7 +269,7 @@
             }
         }
     }
-    if(!message) return;
+    if (!message) return;
 
     const linkDetectionTypes = await LinkCheck(message);
     if (linkDetectionTypes.length > 0) {
@@ -195,7 +285,12 @@
                 timestamp: new Date().getTime()
             },
             separate: {
-                start: filter + ` Link filtered as ${linkDetectionTypes[0]?.toLowerCase()}\n\n` + (content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*")
+                start:
+                    filter +
+                    ` Link filtered as ${linkDetectionTypes[0]?.toLowerCase()}\n\n` +
+                    (content
+                        ? `**Message:**\n\`\`\`${content}\`\`\``
+                        : "**Message:** *Message had no content*")
             },
             list: list,
             hidden: {
@@ -206,9 +301,17 @@
     }
 
     if (config.filters.wordFilter.enabled) {
-        const check = TestString(content, config.filters.wordFilter.words.loose, config.filters.wordFilter.words.strict);
-        if(check !== null) {
-            createLogException(message.guild.id, message.channel.id, message.id);
+        const check = TestString(
+            content,
+            config.filters.wordFilter.words.loose,
+            config.filters.wordFilter.words.strict
+        );
+        if (check !== null) {
+            createLogException(
+                message.guild.id,
+                message.channel.id,
+                message.id
+            );
             await message.delete();
             const data = {
                 meta: {
@@ -220,7 +323,12 @@
                     timestamp: new Date().getTime()
                 },
                 separate: {
-                    start: filter + " Message contained filtered word\n\n" + (content ? `**Message:**\n\`\`\`${content}\`\`\`` : "**Message:** *Message had no content*")
+                    start:
+                        filter +
+                        " Message contained filtered word\n\n" +
+                        (content
+                            ? `**Message:**\n\`\`\`${content}\`\`\``
+                            : "**Message:** *Message had no content*")
                 },
                 list: list,
                 hidden: {
@@ -242,7 +350,9 @@
                 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: {
@@ -252,10 +362,14 @@
         return log(data);
     }
     if (config.filters.pings.roles) {
-        for(const roleId in message.mentions.roles) {
-            if(!message) return;
+        for (const roleId in message.mentions.roles) {
+            if (!message) return;
             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: {
@@ -267,7 +381,9 @@
                         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: {
@@ -278,7 +394,10 @@
             }
         }
     }
-    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 = {
@@ -291,7 +410,9 @@
                 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 473fa52..4cdbdb2 100644
--- a/src/events/messageDelete.ts
+++ b/src/events/messageDelete.ts
@@ -3,10 +3,25 @@
 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;
         }
@@ -14,10 +29,19 @@
         let content = message.cleanContent;
         content.replace("`", "\\`");
         if (content.length > 256) content = content.substring(0, 253) + "...";
-        const attachments = message.attachments.size + (message.content.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/gi) ?? []).length;
+        const attachments =
+            message.attachments.size +
+            (
+                message.content.match(
+                    /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/gi
+                ) ?? []
+            ).length;
         let attachmentJump = "";
-        const config = (await client.database.guilds.read(message.guild.id)).logging.attachments.saved[message.channel.id + message.id];
-        if (config) { attachmentJump = ` [[View attachments]](${config})`; }
+        const config = (await client.database.guilds.read(message.guild.id))
+            .logging.attachments.saved[message.channel.id + message.id];
+        if (config) {
+            attachmentJump = ` [[View attachments]](${config})`;
+        }
         const data = {
             meta: {
                 type: "messageDelete",
@@ -28,18 +52,28 @@
                 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(
                     message.reference.messageId || null,
-                    message.reference.messageId ? `[[Jump to message]](https://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.reference.messageId})` : "None"
+                    message.reference.messageId
+                        ? `[[Jump to message]](https://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.reference.messageId})`
+                        : "None"
                 )
             },
             hidden: {
@@ -47,5 +81,7 @@
             }
         };
         log(data);
-    } catch(e) { console.log(e); }
+    } catch (e) {
+        console.log(e);
+    }
 }
diff --git a/src/events/messageEdit.ts b/src/events/messageEdit.ts
index 148cdb7..c83512c 100644
--- a/src/events/messageEdit.ts
+++ b/src/events/messageEdit.ts
@@ -2,15 +2,29 @@
 
 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];
-    if (config) { attachmentJump = ` [[View attachments]](${config})`; }
+    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",
@@ -25,14 +39,35 @@
                 },
                 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))),
-                    published: entry(new Date(newMessage.editedTimestamp), renderDelta(new Date(newMessage.editedTimestamp))),
-                    mentions: renderNumberDelta(oldMessage.mentions.users.size, newMessage.mentions.users.size),
+                    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))
+                    ),
+                    published: 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
                     )
                 },
                 hidden: {
@@ -42,9 +77,13 @@
             return log(data);
         }
     }
-    if (!newMessage.editedTimestamp) { return; }
-    if (newContent.length > 256) newContent = newContent.substring(0, 253) + "...";
-    if (oldContent.length > 256) oldContent = oldContent.substring(0, 253) + "...";
+    if (!newMessage.editedTimestamp) {
+        return;
+    }
+    if (newContent.length > 256)
+        newContent = newContent.substring(0, 253) + "...";
+    if (oldContent.length > 256)
+        oldContent = oldContent.substring(0, 253) + "...";
     const data = {
         meta: {
             type: "messageUpdate",
@@ -55,24 +94,49 @@
             timestamp: newMessage.editedTimestamp
         },
         separate: {
-            start: (oldContent ? `**Before:**\n\`\`\`\n${oldContent}\n\`\`\`\n` : "**Before:** *Message had no content*\n") +
-                (newContent ? `**After:**\n\`\`\`\n${newContent}\n\`\`\`` : "**After:** *Message had no content*"),
+            start:
+                (oldContent
+                    ? `**Before:**\n\`\`\`\n${oldContent}\n\`\`\`\n`
+                    : "**Before:** *Message had no content*\n") +
+                (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,
-                newMessage.reference.messageId ? `[[Jump to message]](https://discord.com/channels/${newMessage.guild.id}/${newMessage.channel.id}/${newMessage.reference.messageId})` : "None"
+                newMessage.reference.messageId
+                    ? `[[Jump to message]](https://discord.com/channels/${newMessage.guild.id}/${newMessage.channel.id}/${newMessage.reference.messageId})`
+                    : "None"
             )
         },
         hidden: {
@@ -80,4 +144,4 @@
         }
     };
     log(data);
-}
\ No newline at end of file
+}
diff --git a/src/events/roleCreate.ts b/src/events/roleCreate.ts
index a717242..f0051a0 100644
--- a/src/events/roleCreate.ts
+++ b/src/events/roleCreate.ts
@@ -1,10 +1,20 @@
 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: {
@@ -19,7 +29,10 @@
             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 ad74584..185ea8e 100644
--- a/src/events/roleDelete.ts
+++ b/src/events/roleDelete.ts
@@ -3,10 +3,13 @@
 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: {
@@ -21,12 +24,28 @@
             roleId: entry(role.id, `\`${role.id}\``),
             role: entry(role.name, role.name),
             color: entry(role.hexColor, `\`${role.hexColor}\``),
-            showInMemberList: entry(role.hoist, role.hoist ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`),
-            mentionable: entry(role.mentionable, role.mentionable ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`),
+            showInMemberList: entry(
+                role.hoist,
+                role.hoist
+                    ? `${getEmojiByName("CONTROL.TICK")} Yes`
+                    : `${getEmojiByName("CONTROL.CROSS")} No`
+            ),
+            mentionable: entry(
+                role.mentionable,
+                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 c51a9b3..be276e5 100644
--- a/src/events/roleUpdate.ts
+++ b/src/events/roleUpdate.ts
@@ -3,7 +3,15 @@
 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();
@@ -13,24 +21,52 @@
         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}`);
-    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]}`);
-    if (or.mentionable !== nr.mentionable) 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}\``);
+    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]}`
+        );
+    if (or.mentionable !== nr.mentionable)
+        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}\``
+        );
 
     if (Object.keys(changes).length === 4) return;
 
     const data = {
-        meta:{
+        meta: {
             type: "roleUpdate",
             displayName: "Role Edited",
             calculateType: "guildRoleUpdate",
@@ -44,4 +80,4 @@
         }
     }; // TODO: show perms changed (webpage)
     log(data);
-}
\ No newline at end of file
+}
diff --git a/src/events/stickerCreate.ts b/src/events/stickerCreate.ts
index 43f2e9c..54de270 100644
--- a/src/events/stickerCreate.ts
+++ b/src/events/stickerCreate.ts
@@ -1,9 +1,12 @@
 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: {
@@ -18,7 +21,10 @@
             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 297e6b0..f390b5c 100644
--- a/src/events/stickerDelete.ts
+++ b/src/events/stickerDelete.ts
@@ -1,9 +1,12 @@
 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: {
@@ -15,11 +18,17 @@
             timestamp: audit.createdTimestamp
         },
         list: {
-            stickerId:entry(emoji.id, `\`${emoji.id}\``),
+            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 1bb0fe6..46c4d17 100644
--- a/src/events/stickerUpdate.ts
+++ b/src/events/stickerUpdate.ts
@@ -1,7 +1,8 @@
 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");
@@ -9,13 +10,16 @@
     if (audit.executor.id === client.user.id) return;
 
     const changes = {
-        stickerId:entry(ne.id, `\`${ne.id}\``),
+        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 = {
-        meta:{
+        meta: {
             type: "stickerUpdate",
             displayName: "Sticker Edited",
             calculateType: "stickerUpdate",
@@ -29,4 +33,4 @@
         }
     };
     log(data);
-}
\ No newline at end of file
+}
diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts
index d6b9e93..4fdedcb 100644
--- a/src/events/threadCreate.ts
+++ b/src/events/threadCreate.ts
@@ -2,9 +2,19 @@
 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: {
@@ -16,13 +26,26 @@
             timestamp: thread.createdTimestamp
         },
         list: {
-            threadId:entry(thread.id, `\`${thread.id}\``),
+            threadId: entry(thread.id, `\`${thread.id}\``),
             name: entry(thread.name, renderChannel(thread)),
             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"),
-            autoArchiveDuration: entry(thread.autoArchiveDuration, humanizeDuration(thread.autoArchiveDuration * 60 * 1000, { round: true })),
+            category: entry(
+                thread.parent.parent ? thread.parent.parent.name : "None",
+                thread.parent.parent
+                    ? renderChannel(thread.parent.parent)
+                    : "None"
+            ),
+            autoArchiveDuration: entry(
+                thread.autoArchiveDuration,
+                humanizeDuration(thread.autoArchiveDuration * 60 * 1000, {
+                    round: true
+                })
+            ),
             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 f3a59e7..0077eff 100644
--- a/src/events/threadDelete.ts
+++ b/src/events/threadDelete.ts
@@ -2,9 +2,19 @@
 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: {
@@ -16,15 +26,31 @@
             timestamp: new Date().getTime()
         },
         list: {
-            threadId:entry(thread.id, `\`${thread.id}\``),
+            threadId: entry(thread.id, `\`${thread.id}\``),
             name: entry(thread.name, thread.name),
             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"),
-            autoArchiveDuration: entry(thread.autoArchiveDuration, humanizeDuration(thread.autoArchiveDuration * 60 * 1000, { round: true })),
+            category: entry(
+                thread.parent.parent ? thread.parent.parent.name : "None",
+                thread.parent.parent
+                    ? renderChannel(thread.parent.parent)
+                    : "None"
+            ),
+            autoArchiveDuration: entry(
+                thread.autoArchiveDuration,
+                humanizeDuration(thread.autoArchiveDuration * 60 * 1000, {
+                    round: true
+                })
+            ),
             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 89a721c..ff36ce0 100644
--- a/src/events/threadUpdate.ts
+++ b/src/events/threadUpdate.ts
@@ -2,27 +2,55 @@
 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}\``),
+        threadId: entry(after.id, `\`${after.id}\``),
         thread: entry(after.name, renderChannel(after)),
         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([before.autoArchiveDuration, after.autoArchiveDuration], `${humanizeDuration(before.autoArchiveDuration * 60 * 1000, { round: true })} -> ${humanizeDuration(after.autoArchiveDuration * 60 * 1000, { round: true })}`);
+        list.autoArchiveDuration = entry(
+            [before.autoArchiveDuration, after.autoArchiveDuration],
+            `${humanizeDuration(before.autoArchiveDuration * 60 * 1000, {
+                round: true
+            })} -> ${humanizeDuration(after.autoArchiveDuration * 60 * 1000, {
+                round: true
+            })}`
+        );
     }
     if (before.rateLimitPerUser !== after.rateLimitPerUser) {
-        list["slowmode"] = entry([before.rateLimitPerUser, after.rateLimitPerUser], `${humanizeDuration(before.rateLimitPerUser * 1000)} -> ${humanizeDuration(after.rateLimitPerUser * 1000)}`);
+        list.slowmode = entry(
+            [before.rateLimitPerUser, after.rateLimitPerUser],
+            `${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["updatedBy"] = entry(audit.executor.id, renderUser(audit.executor));
+    list.updated = entry(
+        new Date().getTime(),
+        renderDelta(new Date().getTime())
+    );
+    list.updatedBy = entry(audit.executor.id, renderUser(audit.executor));
     const data = {
         meta: {
             type: "channelUpdate",
diff --git a/src/events/webhookUpdate.ts b/src/events/webhookUpdate.ts
index a11fa63..f600247 100644
--- a/src/events/webhookUpdate.ts
+++ b/src/events/webhookUpdate.ts
@@ -1,66 +1,169 @@
 import type Discord from "discord.js";
 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-ignore
+// @ts-expect-error
 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");
-        [auditLogCreate, auditLogUpdate, auditLogDelete] = await Promise.all([auditLogCreate, 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();
+        [auditLogCreate, auditLogUpdate, auditLogDelete] = await Promise.all([
+            auditLogCreate,
+            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();
         if (!auditCreate && !auditUpdate && !auditDelete) return;
         let audit = auditCreate;
         let action = "Create";
-        let list = {} as {created: { value: string, displayValue: string }, updated: { value: string, displayValue: string }, deleted: { value: string, displayValue: string }};
-        if (auditUpdate && auditUpdate.createdTimestamp > audit.createdTimestamp) {
-            const {before, after} = auditUpdate.changes.reduce(
-                (acc, change) => { acc.before[change.key] = change.old; acc.after[change.key] = change.new; return acc; },
-                {before: {}, after: {}}
+        let list = {} as {
+            created: { value: string; displayValue: string };
+            updated: { value: string; displayValue: string };
+            deleted: { value: string; displayValue: string };
+        };
+        if (
+            auditUpdate &&
+            auditUpdate.createdTimestamp > audit.createdTimestamp
+        ) {
+            const { before, after } = auditUpdate.changes.reduce(
+                (acc, change) => {
+                    acc.before[change.key] = change.old;
+                    acc.after[change.key] = change.new;
+                    return acc;
+                },
+                { before: {}, after: {} }
             );
-            if (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(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));
+            if (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(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)
+            );
             audit = auditUpdate;
             action = "Update";
-        } else if (auditDelete && auditDelete.createdTimestamp > audit.createdTimestamp) {
-            const {before} = auditDelete.changes.reduce(
-                (acc, change) => { acc.before[change.key] = change.old; acc.after[change.key] = change.new; return acc; },
-                {before: {}, after: {}}
+        } else if (
+            auditDelete &&
+            auditDelete.createdTimestamp > audit.createdTimestamp
+        ) {
+            const { before } = auditDelete.changes.reduce(
+                (acc, change) => {
+                    acc.before[change.key] = change.old;
+                    acc.after[change.key] = change.new;
+                    return acc;
+                },
+                { before: {}, after: {} }
             );
             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())),
-                deletedBy: entry(auditDelete.executor.id, renderUser((await channel.guild.members.fetch(auditDelete.executor.id)).user))
+                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
+                    )
+                )
             };
             audit = auditDelete;
             action = "Delete";
         } else {
-            const {before} = auditDelete.changes.reduce(
-                (acc, change) => { acc.before[change.key] = change.old; acc.after[change.key] = change.new; return acc; },
-                {before: {}, after: {}}
+            const { before } = auditDelete.changes.reduce(
+                (acc, change) => {
+                    acc.before[change.key] = change.old;
+                    acc.after[change.key] = change.new;
+                    return acc;
+                },
+                { before: {}, after: {} }
             );
             list = {
                 name: entry(before.name, `${before.name}`),
-                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)),
-                created: entry(new Date().getTime(), renderDelta(new Date().getTime()))
+                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
+                    )
+                ),
+                created: entry(
+                    new Date().getTime(),
+                    renderDelta(new Date().getTime())
+                )
             };
         }
         const cols = {
-            "Create": "green",
-            "Update": "yellow",
-            "Delete": "red"
+            Create: "green",
+            Update: "yellow",
+            Delete: "red"
         };
         const data = {
             meta: {
@@ -77,5 +180,7 @@
             }
         };
         log(data);
-    } catch(e) { console.log(e); }
+    } catch (e) {
+        console.log(e);
+    }
 }
diff --git a/src/index.ts b/src/index.ts
index 22436e2..e66dbb3 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,4 +1,3 @@
-
 import { Logger } from "./utils/log.js";
 import runServer from "./api/index.js";
 import Memory from "./utils/memory.js";
@@ -28,4 +27,4 @@
     eventScheduler: await new EventScheduler().start()
 };
 
-await client.login();
\ No newline at end of file
+await client.login();
diff --git a/src/premium/attachmentLogs.ts b/src/premium/attachmentLogs.ts
index 5a771bc..679627d 100644
--- a/src/premium/attachmentLogs.ts
+++ b/src/premium/attachmentLogs.ts
@@ -6,60 +6,98 @@
 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()) {
-        attachments.push({local: await saveAttachment(attachment.url), url: attachment.url, height: attachment.height, width: attachment.width, size: attachment.size});
+        attachments.push({
+            local: await saveAttachment(attachment.url),
+            url: attachment.url,
+            height: attachment.height,
+            width: attachment.width,
+            size: attachment.size
+        });
     }
     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)) {
-            attachments.push({local: await saveAttachment(link), url: link, height: null, width: null});
+        if (
+            link
+                .toLowerCase()
+                .match(/\.(jpg|jpeg|png|gif|gifv|webm|webp|mp4|wav|mp3|ogg)$/gi)
+        ) {
+            attachments.push({
+                local: await saveAttachment(link),
+                url: link,
+                height: null,
+                width: null
+            });
         }
     }
-    if (attachments.length === 0) return {files: []};
+    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", message.guild.id, "No channel set for attachment logging", "Warning");
-            return {files: attachments};
+            singleNotify(
+                "noAttachmentLogChannel",
+                message.guild.id,
+                "No channel set for attachment logging",
+                "Warning"
+            );
+            return { files: attachments };
         }
         const channelObj = await client.channels.fetch(channel);
         if (!channelObj) {
-            singleNotify("attachmentLogChannelDeleted", message.guild.id, "Attachment history channel was deleted", "Warning");
-            return {files: attachments};
+            singleNotify(
+                "attachmentLogChannelDeleted",
+                message.guild.id,
+                "Attachment history channel was deleted",
+                "Warning"
+            );
+            return { files: attachments };
         }
-        const m = await channelObj.send({embeds: [new EmojiEmbed()
-            .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))
-            }) + `\n[[Jump to message]](${message.url})`)
-            .setEmoji("ICONS.ATTACHMENT")
-            .setStatus("Success")
-        ], files: attachments.map(file => file.local)});
+        const m = await channelObj.send({
+            embeds: [
+                new EmojiEmbed()
+                    .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)
+                            )
+                        }) + `\n[[Jump to message]](${message.url})`
+                    )
+                    .setEmoji("ICONS.ATTACHMENT")
+                    .setStatus("Success")
+            ],
+            files: attachments.map((file) => file.local)
+        });
         // 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}
-        );
-        return {files: attachments, jump: m.url};
+        client.database.guilds.write(message.guild.id, {
+            [`logging.attachments.saved.${message.channel.id}${message.id}`]:
+                m.url
+        });
+        return { files: attachments, jump: m.url };
     } else {
-        return {files: attachments};
+        return { files: attachments };
     }
 }
 
 export interface AttachmentLogSchema {
     files: {
-        url: string,
-        local: string,
-        height: number | null,
-        width: number | null
-    }[],
+        url: string;
+        local: string;
+        height: number | null;
+        width: number | null;
+    }[];
     jump?: string;
-}
\ No newline at end of file
+}
diff --git a/src/premium/createTranscript.ts b/src/premium/createTranscript.ts
index d5d7bb8..3d7f4c6 100644
--- a/src/premium/createTranscript.ts
+++ b/src/premium/createTranscript.ts
@@ -2,86 +2,125 @@
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../utils/getEmojiByName.js";
 import { PasteClient, Publicity, ExpireDate } from "pastebin-api";
-import config from "../config/main.json" assert {type: "json"};
+import config from "../config/main.json" assert { type: "json" };
 import client from "../utils/client.js";
 
 const pbClient = new PasteClient(config.pastebinApiKey);
 
 export default async function (interaction) {
-    const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
+    const { log, NucleusColors, entry, renderUser, renderDelta } =
+        client.logger;
 
     let messages = [];
     let deleted = 100;
 
     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);
-        });
+        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));
+            messages = messages.concat(fetched.map((m) => m));
         }
     }
     let out = "";
-    messages.reverse().forEach(message => {
+    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`;});
+            lines.forEach((line) => {
+                out += `> ${line}\n`;
+            });
             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(interaction.channel.createdTimestamp).toDateString()})`,
+            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);
-        m = await interaction.reply({embeds: [new EmojiEmbed()
-            .setTitle("Transcript")
-            .setDescription("You can view the transcript using the link below. You can save the link for later" + (guildConfig.logging.logs.channel ?
-                ` or find it in <#${guildConfig.logging.logs.channel}> once you press delete below. After this the channel will be deleted.`
-                : "."))
-            .setStatus("Success")
-            .setEmoji("CONTROL.DOWNLOAD")
-        ], components: [new MessageActionRow().addComponents([
-            new MessageButton()
-                .setLabel("View")
-                .setStyle("LINK")
-                .setURL(url),
-            new MessageButton()
-                .setLabel("Delete")
-                .setStyle("DANGER")
-                .setCustomId("close")
-                .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-        ])], fetchReply: true});
+        const guildConfig = await client.database.guilds.read(
+            interaction.guild.id
+        );
+        m = await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Transcript")
+                    .setDescription(
+                        "You can view the transcript using the link below. You can save the link for later" +
+                            (guildConfig.logging.logs.channel
+                                ? ` or find it in <#${guildConfig.logging.logs.channel}> once you press delete below. After this the channel will be deleted.`
+                                : ".")
+                    )
+                    .setStatus("Success")
+                    .setEmoji("CONTROL.DOWNLOAD")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setLabel("View")
+                        .setStyle("LINK")
+                        .setURL(url),
+                    new MessageButton()
+                        .setLabel("Delete")
+                        .setStyle("DANGER")
+                        .setCustomId("close")
+                        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                ])
+            ],
+            fetchReply: true
+        });
     } else {
-        m = await interaction.reply({embeds: [new EmojiEmbed()
-            .setTitle("Transcript")
-            .setDescription("The transcript was empty, so no changes were made. To delete this ticket, press the delete button below.")
-            .setStatus("Success")
-            .setEmoji("CONTROL.DOWNLOAD")
-        ], components: [new MessageActionRow().addComponents([
-            new MessageButton()
-                .setLabel("Delete")
-                .setStyle("DANGER")
-                .setCustomId("close")
-                .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
-        ])], fetchReply: true});
+        m = await interaction.reply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Transcript")
+                    .setDescription(
+                        "The transcript was empty, so no changes were made. To delete this ticket, press the delete button below."
+                    )
+                    .setStatus("Success")
+                    .setEmoji("CONTROL.DOWNLOAD")
+            ],
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setLabel("Delete")
+                        .setStyle("DANGER")
+                        .setCustomId("close")
+                        .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+                ])
+            ],
+            fetchReply: true
+        });
     }
     let i;
     try {
         i = await m.awaitMessageComponent({ time: 300000 });
         i.deferUpdate();
-    } catch { return; }
+    } catch {
+        return;
+    }
     const data = {
-        meta:{
+        meta: {
             type: "ticketDeleted",
             displayName: "Ticket Deleted",
             calculateType: "ticketUpdate",
@@ -90,9 +129,24 @@
             timestamp: new Date().getTime()
         },
         list: {
-            ticketFor: entry(interaction.channel.topic.split(" ")[0], 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()))
+            ticketFor: entry(
+                interaction.channel.topic.split(" ")[0],
+                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())
+            )
         },
         hidden: {
             guild: interaction.guild.id
@@ -101,4 +155,4 @@
     log(data);
     await interaction.channel.delete();
     return;
-}
\ No newline at end of file
+}
diff --git a/src/reflex/guide.ts b/src/reflex/guide.ts
index 640ec13..0b09f69 100644
--- a/src/reflex/guide.ts
+++ b/src/reflex/guide.ts
@@ -10,128 +10,208 @@
     title: string;
     description = "";
     pageId = 0;
-    setEmbed(embed: Discord.MessageEmbed) { this.embed = embed; return this; }
-    setTitle(title: string) { this.title = title; return this; }
-    setDescription(description: string) { this.description = description; return this; }
-    setPageId(pageId: number) { this.pageId = pageId; return this; }
+    setEmbed(embed: Discord.MessageEmbed) {
+        this.embed = embed;
+        return this;
+    }
+    setTitle(title: string) {
+        this.title = title;
+        return this;
+    }
+    setDescription(description: string) {
+        this.description = description;
+        return this;
+    }
+    setPageId(pageId: number) {
+        this.pageId = pageId;
+        return this;
+    }
 }
 
 export default async (guild, interaction?) => {
-    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.me).has("EMBED_LINKS"));
+    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.me).has("EMBED_LINKS")
+          );
     const pages = [
         new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Welcome to Nucleus")
-                .setDescription(
-                    "Thanks for adding Nucleus to your server\n\n" +
-                    "On the next few pages you can find instructions on getting started, and commands you may want to set up\n\n" +
-                    "If you need support, have questions or want features, you can let us know in [Clicks](https://discord.gg/bPaNnxe)"
-                )
-                .setEmoji("NUCLEUS.LOGO")
-                .setStatus("Danger")
-            ).setTitle("Welcome").setDescription("About Nucleus").setPageId(0),
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Welcome to Nucleus")
+                    .setDescription(
+                        "Thanks for adding Nucleus to your server\n\n" +
+                            "On the next few pages you can find instructions on getting started, and commands you may want to set up\n\n" +
+                            "If you need support, have questions or want features, you can let us know in [Clicks](https://discord.gg/bPaNnxe)"
+                    )
+                    .setEmoji("NUCLEUS.LOGO")
+                    .setStatus("Danger")
+            )
+            .setTitle("Welcome")
+            .setDescription("About Nucleus")
+            .setPageId(0),
         new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Logging")
-                .setDescription(
-                    "Nucleus can log server events and keep you informed with what content is being posted to your server.\n" +
-                    "We have 2 different types of logs, which each can be configured to send to a channel of your choice:\n" +
-                    "**General Logs:** These are events like kicks and channel changes etc.\n" +
-                    "**Warning Logs:** Warnings like NSFW avatars and spam etc. that may require action by a server staff member. " +
-                    "These go to to a separate staff notifications channel.\n\n" +
-                    "A general log channel can be set with `/settings log`\n" +
-                    "A warning log channel can be set with `/settings warnings channel`"
-                )
-                .setEmoji("ICONS.LOGGING")
-                .setStatus("Danger")
-            ).setTitle("Logging").setDescription("Logging, staff warning logs etc.").setPageId(1),
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Logging")
+                    .setDescription(
+                        "Nucleus can log server events and keep you informed with what content is being posted to your server.\n" +
+                            "We have 2 different types of logs, which each can be configured to send to a channel of your choice:\n" +
+                            "**General Logs:** These are events like kicks and channel changes etc.\n" +
+                            "**Warning Logs:** Warnings like NSFW avatars and spam etc. that may require action by a server staff member. " +
+                            "These go to to a separate staff notifications channel.\n\n" +
+                            "A general log channel can be set with `/settings log`\n" +
+                            "A warning log channel can be set with `/settings warnings channel`"
+                    )
+                    .setEmoji("ICONS.LOGGING")
+                    .setStatus("Danger")
+            )
+            .setTitle("Logging")
+            .setDescription("Logging, staff warning logs etc.")
+            .setPageId(1),
         new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Moderation")
-                .setDescription(
-                    "Nucleus has a number of commands that can be used to moderate your server.\n" +
-                    "These commands are all found under `/mod`, and they include:\n" +
-                    `**${getEmojiByName("PUNISH.WARN.YELLOW")} Warn:** The user is warned (via DM) that they violated server rules.\n` +
-                    `**${getEmojiByName("PUNISH.CLEARHISTORY")} Clear:** Some messages from a user are deleted in a channel.\n` +
-                    `**${getEmojiByName("PUNISH.MUTE.YELLOW")} Mute:** The user is unable to send messages or join voice chats.\n` +
-                    `**${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.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.`
-                )
-                .setEmoji("PUNISH.BAN.RED")
-                .setStatus("Danger")
-            ).setTitle("Moderation").setDescription("Basic moderation commands").setPageId(2),
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Moderation")
+                    .setDescription(
+                        "Nucleus has a number of commands that can be used to moderate your server.\n" +
+                            "These commands are all found under `/mod`, and they include:\n" +
+                            `**${getEmojiByName(
+                                "PUNISH.WARN.YELLOW"
+                            )} Warn:** The user is warned (via DM) that they violated server rules.\n` +
+                            `**${getEmojiByName(
+                                "PUNISH.CLEARHISTORY"
+                            )} Clear:** Some messages from a user are deleted in a channel.\n` +
+                            `**${getEmojiByName(
+                                "PUNISH.MUTE.YELLOW"
+                            )} Mute:** The user is unable to send messages or join voice chats.\n` +
+                            `**${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.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.`
+                    )
+                    .setEmoji("PUNISH.BAN.RED")
+                    .setStatus("Danger")
+            )
+            .setTitle("Moderation")
+            .setDescription("Basic moderation commands")
+            .setPageId(2),
         new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Verify")
-                .setDescription(
-                    "Nucleus has a verification system that allows users to prove they aren't bots.\n" +
-                    "This is done by running `/verify` which sends a message only the user can see, giving them a link to a CAPTCHA to verify.\n" +
-                    "After the user complete's the CAPTCHA, they are given a role and can use the permissions accordingly.\n" +
-                    "You can set the role given with `/settings verify`"
-                )
-                .setEmoji("CONTROL.REDTICK")
-                .setStatus("Danger")
-            ).setTitle("Verify").setDescription("Captcha verification system").setPageId(3),
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Verify")
+                    .setDescription(
+                        "Nucleus has a verification system that allows users to prove they aren't bots.\n" +
+                            "This is done by running `/verify` which sends a message only the user can see, giving them a link to a CAPTCHA to verify.\n" +
+                            "After the user complete's the CAPTCHA, they are given a role and can use the permissions accordingly.\n" +
+                            "You can set the role given with `/settings verify`"
+                    )
+                    .setEmoji("CONTROL.REDTICK")
+                    .setStatus("Danger")
+            )
+            .setTitle("Verify")
+            .setDescription("Captcha verification system")
+            .setPageId(3),
         new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Content Scanning")
-                .setDescription(
-                    "Nucleus has a content scanning system that automatically scans links and images sent by users.\n" +
-                    "Nucleus can detect, delete, and punish users for sending NSFW content, or links to scam or adult sites.\n" +
-                    "You can set the threshold for this in `/settings automation`" // TODO
-                )
-                .setEmoji("MOD.IMAGES.TOOSMALL")
-                .setStatus("Danger")
-            ).setTitle("Content Scanning").setDescription("Content (NSFW, malware, scams) scanning").setPageId(4),
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Content Scanning")
+                    .setDescription(
+                        "Nucleus has a content scanning system that automatically scans links and images sent by users.\n" +
+                            "Nucleus can detect, delete, and punish users for sending NSFW content, or links to scam or adult sites.\n" +
+                            "You can set the threshold for this in `/settings automation`" // TODO
+                    )
+                    .setEmoji("MOD.IMAGES.TOOSMALL")
+                    .setStatus("Danger")
+            )
+            .setTitle("Content Scanning")
+            .setDescription("Content (NSFW, malware, scams) scanning")
+            .setPageId(4),
         new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Tickets")
-                .setDescription(
-                    "Nucleus has a ticket system that allows users to create tickets and have a support team respond to them.\n" +
-                    "Tickets can be created with `/ticket create` and a channel is created, pinging the user and support role.\n" +
-                    "When the ticket is resolved, anyone can run `/ticket close` (or click the button) to close it.\n" +
-                    "Running `/ticket close` again will delete the ticket."
-                )
-                .setEmoji("GUILD.TICKET.CLOSE")
-                .setStatus("Danger")
-            ).setTitle("Tickets").setDescription("Ticket system").setPageId(5),
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Tickets")
+                    .setDescription(
+                        "Nucleus has a ticket system that allows users to create tickets and have a support team respond to them.\n" +
+                            "Tickets can be created with `/ticket create` and a channel is created, pinging the user and support role.\n" +
+                            "When the ticket is resolved, anyone can run `/ticket close` (or click the button) to close it.\n" +
+                            "Running `/ticket close` again will delete the ticket."
+                    )
+                    .setEmoji("GUILD.TICKET.CLOSE")
+                    .setStatus("Danger")
+            )
+            .setTitle("Tickets")
+            .setDescription("Ticket system")
+            .setPageId(5),
         new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Tags")
-                .setDescription(
-                    "Add a tag system to your server with the `/tag` and `/tags` commands.\n" +
-                    "To create a tag, type `/tags create <tag name> <tag content>`.\n" +
-                    "Tag names and content can be edited with `/tags edit`.\n" +
-                    "To delete a tag, type `/tags delete <tag name>`.\n" +
-                    "To view all tags, type `/tags list`.\n"
-                )
-                .setEmoji("PUNISH.NICKNAME.RED")
-                .setStatus("Danger")
-            ).setTitle("Tags").setDescription("Tag system").setPageId(6),
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Tags")
+                    .setDescription(
+                        "Add a tag system to your server with the `/tag` and `/tags` commands.\n" +
+                            "To create a tag, type `/tags create <tag name> <tag content>`.\n" +
+                            "Tag names and content can be edited with `/tags edit`.\n" +
+                            "To delete a tag, type `/tags delete <tag name>`.\n" +
+                            "To view all tags, type `/tags list`.\n"
+                    )
+                    .setEmoji("PUNISH.NICKNAME.RED")
+                    .setStatus("Danger")
+            )
+            .setTitle("Tags")
+            .setDescription("Tag system")
+            .setPageId(6),
         new Embed()
-            .setEmbed(new EmojiEmbed()
-                .setTitle("Premium")
-                .setDescription(
-                    "In the near future, we will be releasing extra premium only features.\n" +
-                    "These features will include:\n\n" +
-                    "**Attachment logs**\n> When a message with attachments is edited or deleted, the logs will also include the images sent.\n" +
-                    "\nPremium is not yet available. Check `/nucleus premium` for updates on features and pricing"
-                )
-                .setEmoji("NUCLEUS.COMMANDS.LOCK")
-                .setStatus("Danger")
-            ).setTitle("Premium").setDescription("Premium features").setPageId(7)
+            .setEmbed(
+                new EmojiEmbed()
+                    .setTitle("Premium")
+                    .setDescription(
+                        "In the near future, we will be releasing extra premium only features.\n" +
+                            "These features will include:\n\n" +
+                            "**Attachment logs**\n> When a message with attachments is edited or deleted, the logs will also include the images sent.\n" +
+                            "\nPremium is not yet available. Check `/nucleus premium` for updates on features and pricing"
+                    )
+                    .setEmoji("NUCLEUS.COMMANDS.LOCK")
+                    .setStatus("Danger")
+            )
+            .setTitle("Premium")
+            .setDescription("Premium features")
+            .setPageId(7)
     ];
     let m;
-    if (interaction) { m = await interaction.reply({embeds: LoadingEmbed, fetchReply: true, ephemeral: true}); }
-    else { m = await c.send({embeds: LoadingEmbed }); }
+    if (interaction) {
+        m = await interaction.reply({
+            embeds: LoadingEmbed,
+            fetchReply: true,
+            ephemeral: true
+        });
+    } else {
+        m = await c.send({ embeds: LoadingEmbed });
+    }
     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;
@@ -141,36 +221,62 @@
 
         if (selectPaneOpen) {
             const options = [];
-            pages.forEach(embed => {
-                options.push(new SelectMenuOption({
-                    label: embed.title,
-                    value: embed.pageId.toString(),
-                    description: embed.description || ""
-                }));
+            pages.forEach((embed) => {
+                options.push(
+                    new SelectMenuOption({
+                        label: embed.title,
+                        value: embed.pageId.toString(),
+                        description: embed.description || ""
+                    })
+                );
             });
-            selectPane = [new MessageActionRow().addComponents([
-                new Discord.MessageSelectMenu()
-                    .addOptions(options)
-                    .setCustomId("page")
-                    .setMaxValues(1)
-                    .setPlaceholder("Choose a page...")
-            ])];
+            selectPane = [
+                new MessageActionRow().addComponents([
+                    new Discord.MessageSelectMenu()
+                        .addOptions(options)
+                        .setCustomId("page")
+                        .setMaxValues(1)
+                        .setPlaceholder("Choose a page...")
+                ])
+            ];
         }
-        const components = selectPane.concat([new MessageActionRow().addComponents([
-            new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(page === 0),
-            new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY").setDisabled(false),
-            new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(page === pages.length - 1)
-        ])]);
+        const components = selectPane.concat([
+            new MessageActionRow().addComponents([
+                new MessageButton()
+                    .setCustomId("left")
+                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                    .setStyle("SECONDARY")
+                    .setDisabled(page === 0),
+                new MessageButton()
+                    .setCustomId("select")
+                    .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
+                    .setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY")
+                    .setDisabled(false),
+                new MessageButton()
+                    .setCustomId("right")
+                    .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                    .setStyle("SECONDARY")
+                    .setDisabled(page === pages.length - 1)
+            ])
+        ]);
         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,
@@ -179,8 +285,17 @@
         }
         let i;
         try {
-            i = await m.awaitMessageComponent({filter: interaction ? () => { return true; } : f, time: 300000});
-        } catch(e) { break; }
+            i = await m.awaitMessageComponent({
+                filter: interaction
+                    ? () => {
+                          return true;
+                      }
+                    : f,
+                time: 300000
+            });
+        } catch (e) {
+            break;
+        }
         i.deferUpdate();
         if (i.component.customId === "left") {
             if (page > 0) page--;
@@ -196,13 +311,36 @@
         } else {
             if (interaction) {
                 const em = new Discord.MessageEmbed(pages[page].embed);
-                em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
-                em.setFooter({text: "Message closed"});
-                interaction.editReply({embeds: [em], components: [new MessageActionRow().addComponents([
-                    new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(true),
-                    new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY").setDisabled(true),
-                    new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(true)
-                ])]});
+                em.setDescription(
+                    em.description +
+                        "\n\n" +
+                        createPageIndicator(pages.length, page)
+                );
+                em.setFooter({ text: "Message closed" });
+                interaction.editReply({
+                    embeds: [em],
+                    components: [
+                        new MessageActionRow().addComponents([
+                            new MessageButton()
+                                .setCustomId("left")
+                                .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                                .setStyle("SECONDARY")
+                                .setDisabled(true),
+                            new MessageButton()
+                                .setCustomId("select")
+                                .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
+                                .setStyle(
+                                    selectPaneOpen ? "PRIMARY" : "SECONDARY"
+                                )
+                                .setDisabled(true),
+                            new MessageButton()
+                                .setCustomId("right")
+                                .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                                .setStyle("SECONDARY")
+                                .setDisabled(true)
+                        ])
+                    ]
+                });
             } else {
                 m.delete();
             }
@@ -211,25 +349,57 @@
     }
     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: [new MessageActionRow().addComponents([
-                new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(true),
-                new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle("SECONDARY").setDisabled(true),
-                new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(true)
-            ])]
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setCustomId("left")
+                        .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                        .setStyle("SECONDARY")
+                        .setDisabled(true),
+                    new MessageButton()
+                        .setCustomId("select")
+                        .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
+                        .setStyle("SECONDARY")
+                        .setDisabled(true),
+                    new MessageButton()
+                        .setCustomId("right")
+                        .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                        .setStyle("SECONDARY")
+                        .setDisabled(true)
+                ])
+            ]
         });
     } 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: [new MessageActionRow().addComponents([
-                new MessageButton().setCustomId("left").setEmoji(getEmojiByName("CONTROL.LEFT", "id")).setStyle("SECONDARY").setDisabled(true),
-                new MessageButton().setCustomId("select").setEmoji(getEmojiByName("CONTROL.MENU", "id")).setStyle("SECONDARY").setDisabled(true),
-                new MessageButton().setCustomId("right").setEmoji(getEmojiByName("CONTROL.RIGHT", "id")).setStyle("SECONDARY").setDisabled(true)
-            ])]
+            components: [
+                new MessageActionRow().addComponents([
+                    new MessageButton()
+                        .setCustomId("left")
+                        .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                        .setStyle("SECONDARY")
+                        .setDisabled(true),
+                    new MessageButton()
+                        .setCustomId("select")
+                        .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
+                        .setStyle("SECONDARY")
+                        .setDisabled(true),
+                    new MessageButton()
+                        .setCustomId("right")
+                        .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                        .setStyle("SECONDARY")
+                        .setDisabled(true)
+                ])
+            ]
         });
     }
 };
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index 435ce4c..162b85a 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -1,5 +1,5 @@
 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-ignore
+// @ts-expect-error
 import * as us from "unscan";
 import fetch from "node-fetch";
 import { writeFileSync } from "fs";
@@ -7,8 +7,12 @@
 import Tesseract from "node-tesseract-ocr";
 import type Discord from "discord.js";
 
-interface NSFWSchema { nsfw: boolean }
-interface MalwareSchema { safe: boolean }
+interface NSFWSchema {
+    nsfw: boolean;
+}
+interface MalwareSchema {
+    safe: boolean;
+}
 
 export async function testNSFW(link: string): Promise<NSFWSchema> {
     const p = await saveAttachment(link);
@@ -24,74 +28,102 @@
 
 export async function saveAttachment(link: string): Promise<string> {
     const image = (await (await fetch(link)).buffer()).toString("base64");
-    const fileName = generateFileName((link.split("/").pop() as string).split(".").pop() as string);
+    const fileName = generateFileName(link.split("/").pop()!.split(".").pop()!);
     writeFileSync(fileName, image, "base64");
     return fileName;
 }
 
-export async function testLink(link: string): Promise<{safe: boolean, tags: string[]}> {
-    return await us.link.scan(link);
+const defaultLinkTestResult: { safe: boolean; tags: string[] } = {
+    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);
+    if (scanned === undefined) return defaultLinkTestResult;
+    return {
+        safe: scanned.safe ?? defaultLinkTestResult.safe,
+        tags: scanned.tags ?? defaultLinkTestResult.tags
+    };
 }
 
-
 const linkTypes = {
-    "PHISHING": "Links designed to trick users into clicking on them.",
-    "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)",
-    "AMP": "AMP pages. (AMP is a technology that allows websites to be served by Google. Read more on /privacy)",
+    PHISHING: "Links designed to trick users into clicking on them.",
+    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)",
+    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.",
-    "PORN": "Websites that include pornography.",
-    "GAMBLING": "Gambling sites, often scams.",
-    "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.",
-    "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.",
-    "HATE": "Websites that spread hate towards groups or individuals.",
-    "JUNK": "Websites that are designed to make you waste time."
+    "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.",
+    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.",
+    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.",
+    HATE: "Websites that spread hate towards groups or individuals.",
+    JUNK: "Websites that are designed to make you waste time."
 };
 export { linkTypes };
 
-
 export async function LinkCheck(message: Discord.Message): Promise<string[]> {
-    const links = message.content.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/gi) ?? [];
-    const detections: {tags: string[], safe: boolean}[] = [];
-    const promises: Promise<void>[] = links.map(async element => {
+    const links =
+        message.content.match(
+            /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/gi
+        ) ?? [];
+    const detections: { tags: string[]; safe: boolean }[] = [];
+    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});
+            detections.push({ tags: [], safe: true });
             return;
         }
-        if (returned) { detections.push({tags: returned.tags || [], safe: returned.safe}); }
-        else { detections.push({tags: [], safe: true}); }
+        detections.push({ tags: returned.tags, safe: returned.safe });
     });
     await Promise.all(promises);
-    const detectionsTypes = detections.map(element => {
-        const type = Object.keys(linkTypes).find(type => element.tags.includes(type));
-        if (type) return type;
-        // if (!element.safe) return "UNSAFE"
-        return undefined;
-    }).filter(element => element !== undefined);
+    const detectionsTypes = detections
+        .map((element) => {
+            const type = Object.keys(linkTypes).find((type) =>
+                element.tags.includes(type)
+            );
+            if (type) return type;
+            // if (!element.safe) return "UNSAFE"
+            return undefined;
+        })
+        .filter((element) => element !== undefined);
     return detectionsTypes as string[];
 }
 
 export async function NSFWCheck(element: string): Promise<boolean> {
     try {
-        const test = (await testNSFW(element));
+        const test = await testNSFW(element);
         return test.nsfw;
     } catch {
         return false;
     }
 }
 
-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;
@@ -105,16 +137,20 @@
     }
 }
 
-export function TestString(string: string, soft: string[], strict: string[]): object | null {
-    for(const word of strict || []) {
+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"};
+            return { word: word, type: "strict" };
         }
     }
-    for(const word of soft) {
-        for(const word2 of string.match(/[a-z]+/gi) || []) {
+    for (const word of soft) {
+        for (const word2 of string.match(/[a-z]+/gi) ?? []) {
             if (word2 === word) {
-                return {word: word, type: "strict"};
+                return { word: word, type: "strict" };
             }
         }
     }
@@ -122,6 +158,10 @@
 }
 
 export async function TestImage(url: string): Promise<string | null> {
-    const text = await Tesseract.recognize(url, {lang: "eng", oem: 1, psm: 3});
+    const text = await Tesseract.recognize(url, {
+        lang: "eng",
+        oem: 1,
+        psm: 3
+    });
     return text;
 }
diff --git a/src/reflex/statsChannelUpdate.ts b/src/reflex/statsChannelUpdate.ts
index 7301a60..2dee385 100644
--- a/src/reflex/statsChannelUpdate.ts
+++ b/src/reflex/statsChannelUpdate.ts
@@ -2,7 +2,10 @@
 import singleNotify from "../utils/singleNotify.js";
 import client from "../utils/client.js";
 
-interface PropSchema { enabled: boolean, name: string }
+interface PropSchema {
+    enabled: boolean;
+    name: string;
+}
 
 export async function callback(_, member) {
     const guild = await client.guilds.fetch(member.guild.id);
@@ -11,21 +14,33 @@
         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);
-            } catch (e) { fetchedChannel = null; }
+            } catch (e) {
+                fetchedChannel = null;
+            }
             if (!fetchedChannel) {
                 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,
                     "One or more of your stats channels have been deleted. Please use `/settings stats` if you wish to add the channel again.\n" +
-                    `The channels name was: ${deleted.name}`,
+                        `The channels name was: ${deleted.name}`,
                     "Critical"
                 );
             }
diff --git a/src/reflex/verify.ts b/src/reflex/verify.ts
index d9fab66..1737387 100644
--- a/src/reflex/verify.ts
+++ b/src/reflex/verify.ts
@@ -1,113 +1,193 @@
 import { LoadingEmbed } from "./../utils/defaultEmbeds.js";
-import Discord, { GuildMember } from "discord.js";
+import Discord, { CommandInteraction, GuildMember } 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";
 
-function step(i) {
+function step(i: number) {
     return "\n\n" + createPageIndicator(5, i);
 }
 
-export default async function(interaction) {
+export default async function (interaction: CommandInteraction) {
     const verify = client.verify;
-    await interaction.reply({embeds: LoadingEmbed, ephemeral: true, fetchReply: true});
+    await interaction.reply({
+        embeds: LoadingEmbed,
+        ephemeral: true,
+        fetchReply: true
+    });
     const config = await client.database.guilds.read(interaction.guild.id);
-    if ((!config.verify.enabled ) || (!config.verify.role)) return interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Verify")
-        .setDescription("Verify is not enabled on this server")
-        .setFooter({text: interaction.member.permissions.has("MANAGE_GUILD") ? "You can enable it by running /settings verify" : ""})
-        .setStatus("Danger")
-        .setEmoji("CONTROL.BLOCKCROSS")
-    ], ephemeral: true, fetchReply: true});
-    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))
-            .setStatus("Danger")
-            .setEmoji("CONTROL.BLOCKCROSS")
-        ]});
+    if (!config.verify.enabled || !config.verify.role)
+        return interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Verify")
+                    .setDescription("Verify is not enabled on this server")
+                    .setFooter({
+                        text: interaction.member.permissions.has("MANAGE_GUILD")
+                            ? "You can enable it by running /settings verify"
+                            : ""
+                    })
+                    .setStatus("Danger")
+                    .setEmoji("CONTROL.BLOCKCROSS")
+            ],
+            ephemeral: true,
+            fetchReply: true
+        });
+    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)
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("CONTROL.BLOCKCROSS")
+            ]
+        });
     }
-    await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Verify")
-        .setDescription("Checking our servers are up" + step(0))
-        .setStatus("Warning")
-        .setEmoji("NUCLEUS.LOADING")
-    ]});
-    try {
-        const status = await fetch(client.config.baseUrl).then(res => res.status);
-        if (status !== 200) {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
+    await interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
                 .setTitle("Verify")
-                .setDescription("Our servers appear to be down, please try again later" + step(0))
-                .setStatus("Danger")
-                .setEmoji("CONTROL.BLOCKCROSS")
-            ]});
+                .setDescription("Checking our servers are up" + step(0))
+                .setStatus("Warning")
+                .setEmoji("NUCLEUS.LOADING")
+        ]
+    });
+    try {
+        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)
+                        )
+                        .setStatus("Danger")
+                        .setEmoji("CONTROL.BLOCKCROSS")
+                ]
+            });
         }
     } catch {
-        return await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Verify")
-            .setDescription("Our servers appear to be down, please try again later" + step(0))
-            .setStatus("Danger")
-            .setEmoji("CONTROL.BLOCKCROSS")
-        ], components: [new Discord.MessageActionRow().addComponents([
-            new Discord.MessageButton()
-                .setLabel("Check webpage")
-                .setStyle("LINK")
-                .setURL(client.config.baseUrl),
-            new Discord.MessageButton()
-                .setLabel("Support")
-                .setStyle("LINK")
-                .setURL("https://discord.gg/bPaNnxe")
-        ])]});
+        return await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Verify")
+                    .setDescription(
+                        "Our servers appear to be down, please try again later" +
+                            step(0)
+                    )
+                    .setStatus("Danger")
+                    .setEmoji("CONTROL.BLOCKCROSS")
+            ],
+            components: [
+                new Discord.MessageActionRow().addComponents([
+                    new Discord.MessageButton()
+                        .setLabel("Check webpage")
+                        .setStyle("LINK")
+                        .setURL(client.config.baseUrl),
+                    new Discord.MessageButton()
+                        .setLabel("Support")
+                        .setStyle("LINK")
+                        .setURL("https://discord.gg/bPaNnxe")
+                ])
+            ]
+        });
     }
     if (config.filters.images.NSFW) {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Verify")
-            .setDescription("Checking your avatar is safe for work" + step(1))
-            .setStatus("Warning")
-            .setEmoji("NUCLEUS.LOADING")
-        ]});
-        if (await NSFWCheck((interaction.member as GuildMember).user.avatarURL({format: "png"}))) {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Verify")
-                .setDescription("Your avatar was detected as NSFW, which we do not allow in this server.\nPlease contact one of our staff members if you believe this is a mistake" + step(1))
-                .setStatus("Danger")
-                .setEmoji("CONTROL.BLOCKCROSS")
-            ]});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Verify")
+                    .setDescription(
+                        "Checking your avatar is safe for work" + step(1)
+                    )
+                    .setStatus("Warning")
+                    .setEmoji("NUCLEUS.LOADING")
+            ]
+        });
+        if (
+            await NSFWCheck(
+                (interaction.member as GuildMember).user.avatarURL({
+                    format: "png"
+                })
+            )
+        ) {
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Verify")
+                        .setDescription(
+                            "Your avatar was detected as NSFW, which we do not allow in this server.\nPlease contact one of our staff members if you believe this is a mistake" +
+                                step(1)
+                        )
+                        .setStatus("Danger")
+                        .setEmoji("CONTROL.BLOCKCROSS")
+                ]
+            });
         }
     }
     if (config.filters.wordFilter) {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setTitle("Verify")
-            .setDescription("Checking your name is allowed" + step(2))
-            .setStatus("Warning")
-            .setEmoji("NUCLEUS.LOADING")
-        ]});
-        if (TestString((interaction.member as Discord.GuildMember).displayName, config.filters.wordFilter.words.loose, config.filters.wordFilter.words.strict) !== null) {
-            return await interaction.editReply({embeds: [new EmojiEmbed()
-                .setTitle("Verify")
-                .setDescription("Your name contained a word we do not allow in this server.\nPlease contact one of our staff members if you believe this is a mistake" + step(2))
-                .setStatus("Danger")
-                .setEmoji("CONTROL.BLOCKCROSS")
-            ]});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle("Verify")
+                    .setDescription("Checking your name is allowed" + step(2))
+                    .setStatus("Warning")
+                    .setEmoji("NUCLEUS.LOADING")
+            ]
+        });
+        if (
+            TestString(
+                (interaction.member as Discord.GuildMember).displayName,
+                config.filters.wordFilter.words.loose,
+                config.filters.wordFilter.words.strict
+            ) !== null
+        ) {
+            return await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setTitle("Verify")
+                        .setDescription(
+                            "Your name contained a word we do not allow in this server.\nPlease contact one of our staff members if you believe this is a mistake" +
+                                step(2)
+                        )
+                        .setStatus("Danger")
+                        .setEmoji("CONTROL.BLOCKCROSS")
+                ]
+            });
         }
     }
-    await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Verify")
-        .setDescription("One moment..." + step(3))
-        .setStatus("Warning")
-        .setEmoji("NUCLEUS.LOADING")
-    ]});
+    await interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Verify")
+                .setDescription("One moment..." + step(3))
+                .setStatus("Warning")
+                .setEmoji("NUCLEUS.LOADING")
+        ]
+    });
     let code = "";
     let length = 5;
     let itt = 0;
-    const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+    const chars =
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
     while (true) {
         itt += 1;
         code = "";
-        for (let i = 0; i < length; i++) { code += chars.charAt(Math.floor(Math.random() * chars.length)); }
+        for (let i = 0; i < length; i++) {
+            code += chars.charAt(Math.floor(Math.random() * chars.length));
+        }
         if (code in verify) continue;
         if (itt > 1000) {
             itt = 0;
@@ -123,17 +203,29 @@
         rName: (await interaction.guild.roles.fetch(config.verify.role)).name,
         uName: interaction.member.user.username,
         gName: interaction.guild.name,
-        gIcon: interaction.guild.iconURL({format: "png"}),
+        gIcon: interaction.guild.iconURL({ format: "png" }),
         interaction: interaction
     };
-    await interaction.editReply({embeds: [new EmojiEmbed()
-        .setTitle("Verify")
-        .setDescription("Looking good!\nClick the button below to get verified" + step(4))
-        .setStatus("Success")
-        .setEmoji("MEMBER.JOIN")
-    ], components: [new Discord.MessageActionRow().addComponents([new Discord.MessageButton()
-        .setLabel("Verify")
-        .setStyle("LINK")
-        .setURL(`${client.config.baseUrl}nucleus/verify?code=${code}`)
-    ])]});
+    await interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
+                .setTitle("Verify")
+                .setDescription(
+                    "Looking good!\nClick the button below to get verified" +
+                        step(4)
+                )
+                .setStatus("Success")
+                .setEmoji("MEMBER.JOIN")
+        ],
+        components: [
+            new Discord.MessageActionRow().addComponents([
+                new Discord.MessageButton()
+                    .setLabel("Verify")
+                    .setStyle("LINK")
+                    .setURL(
+                        `${client.config.baseUrl}nucleus/verify?code=${code}`
+                    )
+            ])
+        ]
+    });
 }
diff --git a/src/reflex/welcome.ts b/src/reflex/welcome.ts
index b4bc374..4971cc9 100644
--- a/src/reflex/welcome.ts
+++ b/src/reflex/welcome.ts
@@ -10,25 +10,38 @@
     if (config.welcome.channel) {
         let string = config.welcome.message;
         if (string) {
-            string = await convertCurlyBracketString(string, member.id, member.displayName, member.guild.name, member.guild.members);
+            string = await convertCurlyBracketString(
+                string,
+                member.id,
+                member.displayName,
+                member.guild.name,
+                member.guild.members
+            );
             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")
+                        embeds: [
+                            new EmojiEmbed()
+                                .setDescription(string)
+                                .setStatus("Success")
                         ],
-                        content: (config.welcome.ping ? `<@${config.welcome.ping}>` : "") + `<@${member.id}>`
+                        content:
+                            (config.welcome.ping
+                                ? `<@${config.welcome.ping}>`
+                                : "") + `<@${member.id}>`
                     });
                 } catch (err) {
                     console.error(err); // TODO: SEN
@@ -36,4 +49,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/utils/calculate.ts b/src/utils/calculate.ts
index 9bdef3b..6d0c55f 100644
--- a/src/utils/calculate.ts
+++ b/src/utils/calculate.ts
@@ -36,7 +36,7 @@
     }
     let int = 0n;
 
-    for(const perm of permissions) {
+    for (const perm of permissions) {
         int += BigInt(2 ** array.indexOf(perm));
     }
     return int.toString(16);
@@ -47,7 +47,10 @@
         array = logs;
     }
     const permissions = [];
-    const int = (BigInt("0x" + permissionsHex)).toString(2).split("").reverse();
+    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]);
@@ -56,9 +59,4 @@
     return permissions;
 };
 
-export {
-    toHexInteger,
-    toHexArray,
-    tickets,
-    logs
-};
\ No newline at end of file
+export { toHexInteger, toHexArray, tickets, logs };
diff --git a/src/utils/client.ts b/src/utils/client.ts
index a343bcb..0ce61f1 100644
--- a/src/utils/client.ts
+++ b/src/utils/client.ts
@@ -1,9 +1,12 @@
 import { HaikuClient } from "jshaiku";
 import { Intents } from "discord.js";
-import config from "../config/main.json" assert {type: "json"};
+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
-}, config);
+const client = new HaikuClient(
+    {
+        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
+export default client;
diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index fd58d12..728cc52 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -1,9 +1,14 @@
-import Discord, { CommandInteraction, MessageActionRow, MessageButton, TextInputComponent } from "discord.js";
+import Discord, {
+    CommandInteraction,
+    Message,
+    MessageActionRow,
+    MessageButton,
+    TextInputComponent
+} from "discord.js";
 import { modalInteractionCollector } from "./dualCollector.js";
 import EmojiEmbed from "./generateEmojiEmbed.js";
 import getEmojiByName from "./getEmojiByName.js";
 
-
 interface CustomBoolean<T> {
     title: string;
     disabled: boolean;
@@ -19,8 +24,8 @@
     title = "";
     emoji = "";
     description = "";
-    color = "";
-    customButtons: {[index:string]: CustomBoolean<unknown>} = {};
+    color: "Danger" | "Warning" | "Success" = "Success";
+    customButtons: Record<string, CustomBoolean<unknown>> = {};
     inverted = false;
     reason: string | null = null;
 
@@ -28,21 +33,45 @@
         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; }
-    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;
+    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: "Danger" | "Warning" | "Success") {
+        this.color = color;
+        return this;
+    }
+    setInverted(inverted: boolean) {
+        this.inverted = inverted;
+        return this;
+    }
+    addCustomBoolean(
+        customId: string,
+        title: string,
+        disabled: boolean,
+        callback: () => Promise<unknown> = async () => null,
+        callbackClicked: string | null,
+        emoji?: string,
+        initial?: boolean
+    ) {
+        this.customButtons[customId] = {
+            title: title,
+            disabled: disabled,
+            value: callbackClicked,
+            emoji: emoji,
+            active: initial ?? false,
+            onClick: callback,
+            response: null
+        };
+        return this;
     }
     addReasonButton(reason: string) {
         this.reason = reason;
@@ -63,50 +92,71 @@
                     .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
             ];
             Object.entries(this.customButtons).forEach(([k, v]) => {
-                fullComponents.push(new Discord.MessageButton()
+                const button = 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 (v.emoji !== undefined)
+                    button.setEmoji(getEmojiByName(v.emoji, "id"));
+                fullComponents.push(button);
             });
-            if (this.reason !== null) fullComponents.push(new Discord.MessageButton()
-                .setCustomId("reason")
-                .setLabel("Edit Reason")
-                .setStyle("PRIMARY")
-                .setEmoji(getEmojiByName("ICONS.EDIT", "id"))
-                .setDisabled(false)
-            );
+            if (this.reason !== null)
+                fullComponents.push(
+                    new Discord.MessageButton()
+                        .setCustomId("reason")
+                        .setLabel("Edit Reason")
+                        .setStyle("PRIMARY")
+                        .setEmoji(getEmojiByName("ICONS.EDIT", "id"))
+                        .setDisabled(false)
+                );
             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: [
                     new EmojiEmbed()
                         .setEmoji(this.emoji)
                         .setTitle(this.title)
-                        .setDescription(this.description + "\n\n" + Object.values(this.customButtons).map(v => {
-                            if (v.value === null) return "";
-                            return v.active ? `*${v.value}*\n` : "";
-                        }).join(""))
+                        .setDescription(
+                            this.description +
+                                "\n\n" +
+                                Object.values(this.customButtons)
+                                    .map((v) => {
+                                        if (v.value === null) return "";
+                                        return v.active ? `*${v.value}*\n` : "";
+                                    })
+                                    .join("")
+                        )
                         .setStatus(this.color)
                 ],
                 components: components,
                 ephemeral: true,
                 fetchReply: true
             };
-            let m;
+            let m: Message;
             try {
-                if ( editOnly ) {
-                    m = await this.interaction.editReply(object);
+                if (editOnly) {
+                    m = (await this.interaction.editReply(object)) as Message;
                 } else {
-                    m = await this.interaction.reply(object);
+                    m = (await this.interaction.reply(
+                        object
+                    )) as unknown as Message;
                 }
-            } catch { return { cancelled: true }; }
+            } catch {
+                return { cancelled: true };
+            }
             let component;
             try {
-                component = await m.awaitMessageComponent({filter: (m) => m.user.id === this.interaction.user.id, time: 300000});
+                component = await m.awaitMessageComponent({
+                    filter: (m) => m.user.id === this.interaction.user.id,
+                    time: 300000
+                });
             } catch (e) {
                 return { success: false, components: this.customButtons };
             }
@@ -114,47 +164,75 @@
                 component.deferUpdate();
                 for (const v of Object.values(this.customButtons)) {
                     if (!v.active) continue;
-                    try { v.response = await v.onClick(); }
-                    catch (e) { console.log(e); }
+                    try {
+                        v.response = await v.onClick();
+                    } 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(
-                    new MessageActionRow<TextInputComponent>().addComponents(new TextInputComponent()
-                        .setCustomId("reason")
-                        .setLabel("Reason")
-                        .setMaxLength(2000)
-                        .setRequired(false)
-                        .setStyle("PARAGRAPH")
-                        .setPlaceholder("Spammed in #general")
-                        .setValue(this.reason ? this.reason : "")
-                    )
-                ));
+                await component.showModal(
+                    new Discord.Modal()
+                        .setCustomId("modal")
+                        .setTitle("Editing reason")
+                        .addComponents(
+                            new MessageActionRow<TextInputComponent>().addComponents(
+                                new TextInputComponent()
+                                    .setCustomId("reason")
+                                    .setLabel("Reason")
+                                    .setMaxLength(2000)
+                                    .setRequired(false)
+                                    .setStyle("PARAGRAPH")
+                                    .setPlaceholder("Spammed in #general")
+                                    .setValue(this.reason ? this.reason : "")
+                            )
+                        )
+                );
                 await this.interaction.editReply({
-                    embeds: [new EmojiEmbed()
-                        .setTitle(this.title)
-                        .setDescription("Modal opened. If you can't see it, click back and try again.")
-                        .setStatus(this.color)
-                        .setEmoji(this.emoji)
-                    ], components: [new MessageActionRow().addComponents([new MessageButton()
-                        .setLabel("Back")
-                        .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
-                        .setStyle("PRIMARY")
-                        .setCustomId("back")
-                    ])]
+                    embeds: [
+                        new EmojiEmbed()
+                            .setTitle(this.title)
+                            .setDescription(
+                                "Modal opened. If you can't see it, click back and try again."
+                            )
+                            .setStatus(this.color)
+                            .setEmoji(this.emoji)
+                    ],
+                    components: [
+                        new MessageActionRow().addComponents([
+                            new MessageButton()
+                                .setLabel("Back")
+                                .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                                .setStyle("PRIMARY")
+                                .setCustomId("back")
+                        ])
+                    ]
                 });
                 let out;
                 try {
-                    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 }; }
+                    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 {
                 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 f05076e..49a4418 100644
--- a/src/utils/convertCurlyBracketString.ts
+++ b/src/utils/convertCurlyBracketString.ts
@@ -1,13 +1,33 @@
-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;
+    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/createLogException.ts b/src/utils/createLogException.ts
index c62a824..7a6c492 100644
--- a/src/utils/createLogException.ts
+++ b/src/utils/createLogException.ts
@@ -3,6 +3,8 @@
 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/createPageIndicator.ts b/src/utils/createPageIndicator.ts
index fa203dc..ccf18e2 100644
--- a/src/utils/createPageIndicator.ts
+++ b/src/utils/createPageIndicator.ts
@@ -1,15 +1,23 @@
 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("TRACKS.HORIZONTAL." +
-                (i === 0 ? "LEFT" : (i === amount - 1 ? "RIGHT" : "MIDDLE")) + "." +
-                (i === selected ? "ACTIVE" : "INACTIVE")
+            out += getEmojiByName(
+                "TRACKS.HORIZONTAL." +
+                    (i === 0 ? "LEFT" : i === amount - 1 ? "RIGHT" : "MIDDLE") +
+                    "." +
+                    (i === selected ? "ACTIVE" : "INACTIVE")
             );
         }
     }
@@ -19,4 +27,4 @@
     return out;
 }
 
-export default pageIndicator;
\ No newline at end of file
+export default pageIndicator;
diff --git a/src/utils/database.ts b/src/utils/database.ts
index cffdf04..3592c95 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -1,10 +1,9 @@
 import type Discord from "discord.js";
 import { Collection, MongoClient } from "mongodb";
 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-// @ts-ignore
+// @ts-expect-error
 import structuredClone from "@ungap/structured-clone";
-import config from "../config/main.json" assert {type: "json"};
-
+import config from "../config/main.json" assert { type: "json" };
 
 const mongoClient = new MongoClient(config.mongoUrl);
 await mongoClient.connect();
@@ -19,17 +18,21 @@
         // 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);
         }
     };
 };
 
-
 export class Guilds {
     guilds: Collection<GuildConfig>;
     defaultData: GuildConfig | null;
@@ -41,55 +44,89 @@
     }
 
     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;
     }
 
     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];
         for (const key of unset) {
             uo[key] = null;
         }
-        const out = {$set: {}, $unset: {}};
-        if (set) out["$set"] = set;
-        if (unset.length) out["$unset"] = uo;
+        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 }, {
-                $addToSet: { [key]: { $each: value } }
-            }, { upsert: true });
+            await this.guilds.updateOne(
+                { id: guild },
+                {
+                    $addToSet: { [key]: { $each: value } }
+                },
+                { upsert: true }
+            );
         } else {
-            await this.guilds.updateOne({ id: guild }, {
-                $addToSet: { [key]: value }
-            }, { upsert: true });
+            await this.guilds.updateOne(
+                { id: guild },
+                {
+                    $addToSet: { [key]: value }
+                },
+                { upsert: true }
+            );
         }
     }
 
     // eslint-disable-next-line @typescript-eslint/no-explicit-any
-    async remove(guild: string, key: string, value: any, innerKey?: string | null) {
+    async remove(
+        guild: string,
+        key: string,
+        value: any,
+        innerKey?: string | null
+    ) {
         console.log(Array.isArray(value));
         if (innerKey) {
-            await this.guilds.updateOne({ id: guild }, {
-                $pull: { [key]: { [innerKey]: { $eq: value } } }
-            }, { upsert: true });
+            await this.guilds.updateOne(
+                { id: guild },
+                {
+                    $pull: { [key]: { [innerKey]: { $eq: value } } }
+                },
+                { upsert: true }
+            );
         } else if (Array.isArray(value)) {
-            await this.guilds.updateOne({ id: guild }, {
-                $pullAll: { [key]: value }
-            }, { upsert: true });
+            await this.guilds.updateOne(
+                { id: guild },
+                {
+                    $pullAll: { [key]: value }
+                },
+                { upsert: true }
+            );
         } else {
-            await this.guilds.updateOne({ id: guild }, {
-                $pullAll: { [key]: [value] }
-            }, { upsert: true });
+            await this.guilds.updateOne(
+                { id: guild },
+                {
+                    $pullAll: { [key]: [value] }
+                },
+                { upsert: true }
+            );
         }
     }
 
@@ -98,7 +135,6 @@
     }
 }
 
-
 export class History {
     histories: Collection<HistorySchema>;
     defaultData: GuildConfig;
@@ -108,7 +144,16 @@
         return this;
     }
 
-    async create(type: string, guild: string, user: Discord.User, moderator: Discord.User | null, reason: string | null, before?: null, after?: null, amount?: null) {
+    async create(
+        type: string,
+        guild: string,
+        user: Discord.User,
+        moderator: Discord.User | null,
+        reason: string | null,
+        before?: null,
+        after?: null,
+        amount?: null
+    ) {
         await this.histories.insertOne({
             type: type,
             guild: guild,
@@ -123,14 +168,16 @@
     }
 
     async read(guild: string, user: string, year: number) {
-        const entry = (await this.histories.find({
-            guild: guild,
-            user: user,
-            occurredAt: {
-                $gte: new Date(year - 1, 11, 31, 23, 59, 59),
-                $lt: new Date(year + 1, 0, 1, 0, 0, 0)
-            }
-        }).toArray()) as HistorySchema[];
+        const entry = (await this.histories
+            .find({
+                guild: guild,
+                user: user,
+                occurredAt: {
+                    $gte: new Date(year - 1, 11, 31, 23, 59, 59),
+                    $lt: new Date(year + 1, 0, 1, 0, 0, 0)
+                }
+            })
+            .toArray()) as HistorySchema[];
         return entry;
     }
 
@@ -149,7 +196,11 @@
     }
 
     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) {
@@ -167,163 +218,165 @@
     }
 
     async hasPremium(guild: string) {
-        const entry = await this.premium.findOne({ appliesTo: { $in: [guild] } });
+        const entry = await this.premium.findOne({
+            appliesTo: { $in: [guild] }
+        });
         return entry !== null;
     }
 }
 
 export interface GuildConfig {
-    id: string,
-    version: number,
+    id: string;
+    version: number;
     singleEventNotifications: {
-        statsChannelDeleted: boolean
-    }
+        statsChannelDeleted: boolean;
+    };
     filters: {
         images: {
-            NSFW: boolean,
-            size: boolean
-        },
-        malware: boolean,
+            NSFW: boolean;
+            size: boolean;
+        };
+        malware: boolean;
         wordFilter: {
-            enabled: boolean,
+            enabled: boolean;
             words: {
-                strict: string[],
-                loose: string[]
-            },
+                strict: string[];
+                loose: string[];
+            };
             allowed: {
-                users: string[],
-                roles: string[],
-                channels: string[]
-            }
-        },
+                users: string[];
+                roles: string[];
+                channels: string[];
+            };
+        };
         invite: {
-            enabled: boolean,
-            channels: string[]
-        },
+            enabled: boolean;
+            channels: string[];
+        };
         pings: {
-            mass: number,
-            everyone: boolean,
-            roles: boolean,
+            mass: number;
+            everyone: boolean;
+            roles: boolean;
             allowed: {
-                roles: string[],
-                rolesToMention: string[],
-                users: string[],
-                channels: string[]
-            }
-        }
-    }
+                roles: string[];
+                rolesToMention: string[];
+                users: string[];
+                channels: string[];
+            };
+        };
+    };
     welcome: {
-        enabled: boolean,
+        enabled: boolean;
         verificationRequired: {
-            message: boolean,
-            role: string | null
-        },
-        role: string | null,
-        ping: string | null,
-        channel: string | null,
-        message: string | null,
-    }
-    stats: Record<string, {name: string, enabled: boolean}>
+            message: boolean;
+            role: string | null;
+        };
+        role: string | null;
+        ping: string | null;
+        channel: string | null;
+        message: string | null;
+    };
+    stats: Record<string, { name: string; enabled: boolean }>;
     logging: {
         logs: {
-            enabled: boolean,
-            channel: string | null,
-            toLog: string | null,
-        },
+            enabled: boolean;
+            channel: string | null;
+            toLog: string | null;
+        };
         staff: {
-            channel: string | null,
-        },
+            channel: string | null;
+        };
         attachments: {
-            channel: string | null,
-            saved: Record<string, string>
-        }
-    }
+            channel: string | null;
+            saved: Record<string, string>;
+        };
+    };
     verify: {
-        enabled: boolean,
-        role: string | null,
-    }
+        enabled: boolean;
+        role: string | null;
+    };
     tickets: {
-        enabled: boolean,
-        category: string | null,
-        types: string | null,
-        customTypes: string[],
-        useCustom: boolean,
-        supportRole: string | null,
-        maxTickets: number
-    }
+        enabled: boolean;
+        category: string | null;
+        types: string | null;
+        customTypes: string[];
+        useCustom: boolean;
+        supportRole: string | null;
+        maxTickets: number;
+    };
     moderation: {
         mute: {
-            timeout: boolean,
-            role: string | null,
-            text: string | null,
-            link: string | null
-        },
+            timeout: boolean;
+            role: string | null;
+            text: string | null;
+            link: string | null;
+        };
         kick: {
-            text: string | null,
-            link: string | null
-        },
+            text: string | null;
+            link: string | null;
+        };
         ban: {
-            text: string | null,
-            link: string | null
-        },
+            text: string | null;
+            link: string | null;
+        };
         softban: {
-            text: string | null,
-            link: string | null
-        },
+            text: string | null;
+            link: string | null;
+        };
         warn: {
-            text: string | null,
-            link: string | null
-        },
+            text: string | null;
+            link: string | null;
+        };
         role: {
-            role: string | null,
-        }
-    }
+            role: string | null;
+        };
+    };
     tracks: {
-        name: string,
-        retainPrevious: boolean,
-        nullable: boolean,
-        track: string[],
-        manageableBy: string[]
-    }[]
+        name: string;
+        retainPrevious: boolean;
+        nullable: boolean;
+        track: string[];
+        manageableBy: string[];
+    }[];
     roleMenu: {
-        enabled: boolean,
-        allowWebUI: boolean,
+        enabled: boolean;
+        allowWebUI: boolean;
         options: {
-            name: string,
-            description: string,
-            min: number,
-            max: number,
+            name: string;
+            description: string;
+            min: number;
+            max: number;
             options: {
-                name: string,
-                description: string | null,
-                role: string
-            }[]
-        }[]
-    }
-    tags: Record<string, string>
+                name: string;
+                description: string | null;
+                role: string;
+            }[];
+        }[];
+    };
+    tags: Record<string, string>;
 }
 
 export interface HistorySchema {
-    type: string,
-    guild: string,
-    user: string,
-    moderator: string | null,
-    reason: string,
-    occurredAt: Date,
-    before: string | null,
-    after: string | null,
-    amount: string | null
+    type: string;
+    guild: string;
+    user: string;
+    moderator: string | null;
+    reason: string;
+    occurredAt: Date;
+    before: string | null;
+    after: string | null;
+    amount: string | null;
 }
 
 export interface ModNoteSchema {
-    guild: string,
-    user: string,
-    note: string
+    guild: string;
+    user: string;
+    note: string;
 }
 
 export interface PremiumSchema {
-    user: string,
-    level: number,
-    expires: Date,
-    appliesTo: string[]
-}
\ No newline at end of file
+    user: string;
+    level: number;
+    expires: Date;
+    appliesTo: string[];
+}
diff --git a/src/utils/defaultEmbeds.ts b/src/utils/defaultEmbeds.ts
index ce6edc1..68d8013 100644
--- a/src/utils/defaultEmbeds.ts
+++ b/src/utils/defaultEmbeds.ts
@@ -1,9 +1,9 @@
 import EmojiEmbed from "./generateEmojiEmbed.js";
 
-export const LoadingEmbed = [new EmojiEmbed()
-    .setTitle("Loading")
-    .setDescription("One moment...")
-    .setStatus("Danger")
-    .setEmoji("NUCLEUS.LOADING")
+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 11df0ce..8c6e55c 100644
--- a/src/utils/dualCollector.ts
+++ b/src/utils/dualCollector.ts
@@ -1,18 +1,49 @@
-import Discord, { Interaction } from "discord.js";
+import Discord, {
+    Interaction,
+    Message,
+    MessageComponentInteraction
+} from "discord.js";
 import client from "./client.js";
 
-export default async function (m, interactionFilter, messageFilter) {
+export default async function (
+    m: Message,
+    interactionFilter: (
+        i: MessageComponentInteraction
+    ) => boolean | Promise<boolean>,
+    messageFilter: (m: Message) => boolean | Promise<boolean>
+) {
     let out;
     try {
         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(); });
+            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
+                })
+                .on("collect", (m) => {
+                    try {
+                        m.delete();
+                    } catch (e) {
+                        client._error(e);
+                    }
+                    resolve(m);
+                });
+            mes.on("end", () => {
+                int.stop();
+            });
+            int.on("end", () => {
+                mes.stop();
+            });
         });
-    } catch(e) {
+    } catch (e) {
         console.log(e);
         return null;
     }
@@ -20,27 +51,43 @@
     return out;
 }
 
-export async function modalInteractionCollector(m, modalFilter, interactionFilter) {
+export async function modalInteractionCollector(
+    m: Message,
+    modalFilter: (i: Interaction) => boolean | Promise<boolean>,
+    interactionFilter: (
+        i: MessageComponentInteraction
+    ) => boolean | Promise<boolean>
+) {
     let out;
     try {
         out = await new Promise((resolve, _reject) => {
-            const int = m.createMessageComponentCollector({filter: (m: Interaction) => interactionFilter(m), time: 300000})
-                .on("collect", (m: Interaction) => { resolve(m); });
-            const mod = new Discord.InteractionCollector(
-                client, {
-                    filter: (m: Interaction) => modalFilter(m),
+            const int = m
+                .createMessageComponentCollector({
+                    filter: (i: MessageComponentInteraction) =>
+                        interactionFilter(i),
                     time: 300000
                 })
-                .on("collect", async (m: Interaction) => {
-                    int.stop();
-                    (m as Discord.ModalSubmitInteraction).deferUpdate();
-                    resolve((m as Discord.ModalSubmitInteraction)); });
-            int.on("end", () => { mod.stop(); });
-            mod.on("end", () => { int.stop(); });
+                .on("collect", (i: Interaction) => {
+                    resolve(i);
+                });
+            const mod = new Discord.InteractionCollector(client, {
+                filter: (i: Interaction) => modalFilter(i),
+                time: 300000
+            }).on("collect", async (i: Interaction) => {
+                int.stop();
+                (i as Discord.ModalSubmitInteraction).deferUpdate();
+                resolve(i as Discord.ModalSubmitInteraction);
+            });
+            int.on("end", () => {
+                mod.stop();
+            });
+            mod.on("end", () => {
+                int.stop();
+            });
         });
-    } catch(e) {
+    } catch (e) {
         console.log(e);
         return null;
     }
     return out;
-}
\ No newline at end of file
+}
diff --git a/src/utils/eventScheduler.ts b/src/utils/eventScheduler.ts
index df46ca8..6923ede 100644
--- a/src/utils/eventScheduler.ts
+++ b/src/utils/eventScheduler.ts
@@ -2,13 +2,18 @@
 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 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) => {
             const guild = await client.guilds.fetch(job.attrs.data.guild);
@@ -18,17 +23,31 @@
             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
-            );} catch (e) { client._error(e); }
+            try {
+                await client.database.history.create(
+                    "unmute",
+                    user.guild.id,
+                    user.user,
+                    null,
+                    null,
+                    null,
+                    null
+                );
+            } catch (e) {
+                client._error(e);
+            }
             const data = {
                 meta: {
                     type: "memberUnmute",
@@ -41,7 +60,10 @@
                 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: {
@@ -53,7 +75,7 @@
     }
 
     async start() {
-        await new Promise(resolve => this.agenda.once("ready", resolve));
+        await new Promise((resolve) => this.agenda.once("ready", resolve));
         this.agenda.start();
         return this;
     }
@@ -65,8 +87,8 @@
 
     // eslint-disable-next-line @typescript-eslint/no-explicit-any
     cancel(name: string, data: any) {
-        this.agenda.cancel({name, data});
+        this.agenda.cancel({ name, data });
     }
 }
 
-export default EventScheduler;
\ No newline at end of file
+export default EventScheduler;
diff --git a/src/utils/generateEmojiEmbed.ts b/src/utils/generateEmojiEmbed.ts
index 65e11fa..c1de60f 100644
--- a/src/utils/generateEmojiEmbed.ts
+++ b/src/utils/generateEmojiEmbed.ts
@@ -2,9 +2,9 @@
 import getEmojiByName from "./getEmojiByName.js";
 
 const colors = {
-    "Danger": 0xF27878,
-    "Warning": 0xF2D478,
-    "Success": 0x68D49E
+    Danger: 0xf27878,
+    Warning: 0xf2d478,
+    Success: 0x68d49e
 };
 
 class EmojiEmbed extends MessageEmbed {
@@ -12,7 +12,7 @@
     _emoji: string | null = null;
 
     // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-    // @ts-ignore
+    // @ts-expect-error
     // This *is* meant to be an accessor rather than a property
     override get title() {
         if (!this._emoji) return this._title;
@@ -23,9 +23,18 @@
         this._title = title;
     }
 
-    override setTitle(title: string) { this._title = title; return this; }
-    setEmoji(emoji: string) { this._emoji = emoji; return this; }
-    setStatus(color: "Danger" | "Warning" | "Success") { this.setColor(colors[color]); return this; }
+    override setTitle(title: string) {
+        this._title = title;
+        return this;
+    }
+    setEmoji(emoji: string) {
+        this._emoji = emoji;
+        return this;
+    }
+    setStatus(color: "Danger" | "Warning" | "Success") {
+        this.setColor(colors[color]);
+        return this;
+    }
 }
 
-export default EmojiEmbed;
\ No newline at end of file
+export default EmojiEmbed;
diff --git a/src/utils/generateKeyValueList.ts b/src/utils/generateKeyValueList.ts
index a093ab7..a158391 100644
--- a/src/utils/generateKeyValueList.ts
+++ b/src/utils/generateKeyValueList.ts
@@ -1,22 +1,21 @@
-const forceCaps = [
-    "ID",
-    "NSFW",
-    "URL"
-];
+const forceCaps = ["ID", "NSFW", "URL"];
 
 export function capitalize(s: string) {
     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");
-    }).join(" ");
+    s = s
+        .split(" ")
+        .map((word) => {
+            return forceCaps.includes(word.toUpperCase())
+                ? word.toUpperCase()
+                : (word[0] ?? "").toUpperCase() +
+                      word.slice(1).toLowerCase().replace("discord", "Discord");
+        })
+        .join(" ");
     return s;
 }
 
 export function toCapitals(s: string) {
-    if (s[0] === undefined) return "";
+    if (s.startsWith(undefined)) return "";
     return s[0].toUpperCase() + s.slice(1).toLowerCase();
 }
 
@@ -28,4 +27,4 @@
     return out;
 }
 
-export default keyValueList;
\ No newline at end of file
+export default keyValueList;
diff --git a/src/utils/getEmojiByName.ts b/src/utils/getEmojiByName.ts
index c0a43cb..f953a4f 100644
--- a/src/utils/getEmojiByName.ts
+++ b/src/utils/getEmojiByName.ts
@@ -1,13 +1,13 @@
-import emojis from "../config/emojis.json" assert {type: "json"};
+import emojis from "../config/emojis.json" assert { type: "json" };
 
 interface EmojisIndex {
     [key: string]: string | EmojisIndex | EmojisIndex[];
 }
 
 function getEmojiByName(name: string, format?: string): string {
-    const split = name.split(".");
+    const parts = name.split(".");
     let id: string | EmojisIndex | EmojisIndex[] | undefined = emojis;
-    split.forEach(part => {
+    for (const part of parts) {
         if (typeof id === "string" || id === undefined) {
             throw new Error(`Emoji ${name} not found`);
         }
@@ -16,8 +16,11 @@
         } else {
             id = id[part];
         }
-    });
-    if ( format === "id" ) {
+    }
+    if (typeof id !== "string" && id !== undefined) {
+        throw new Error(`Emoji ${name} not found`);
+    }
+    if (format === "id") {
         if (id === undefined) return "0";
         return id.toString();
     }
diff --git a/src/utils/log.ts b/src/utils/log.ts
index f9f751e..6baa0a5 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -7,18 +7,17 @@
 
 const wait = promisify(setTimeout);
 
-
 export class Logger {
     renderUser(user: Discord.User | string) {
         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: number, num2: number) {
@@ -35,19 +34,23 @@
         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
-
+        red: 0xf27878,
+        yellow: 0xf2d478,
+        green: 0x68d49e
     };
 
-    async getAuditLog(guild: Discord.Guild, event: Discord.GuildAuditLogsResolvable): Promise<Discord.GuildAuditLogsEntry[]>{
+    async getAuditLog(
+        guild: Discord.Guild,
+        event: Discord.GuildAuditLogsResolvable
+    ): Promise<Discord.GuildAuditLogsEntry[]> {
         await wait(250);
-        const auditLog = await guild.fetchAuditLogs({type: event});
+        const auditLog = await guild.fetchAuditLogs({ type: event });
         return auditLog as unknown as Discord.GuildAuditLogsEntry[];
     }
 
@@ -56,16 +59,23 @@
         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) {
-            const channel = await client.channels.fetch(config.logging.logs.channel) as Discord.TextChannel;
+            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 => {
+            Object.entries(log.list).map((entry) => {
                 const key: string = entry[0];
                 // eslint-disable-next-line @typescript-eslint/no-explicit-any
                 const value: any = entry[1];
-                if(value.displayValue) {
+                if (value.displayValue) {
                     description[key] = value.displayValue;
                 } else {
                     description[key] = value;
@@ -74,19 +84,22 @@
             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) +
-                        (log.separate.end ? "\n" + log.separate.end : "")
+                            generateKeyValueList(description) +
+                            (log.separate.end ? "\n" + log.separate.end : "")
                     )
                     .setTimestamp(log.meta.timestamp)
                     .setColor(log.meta.color);
-                channel.send({embeds: [embed]});
+                channel.send({ embeds: [embed] });
             }
         }
     }
 }
 
-
 export default {};
diff --git a/src/utils/memory.ts b/src/utils/memory.ts
index 070bd7f..a397d09 100644
--- a/src/utils/memory.ts
+++ b/src/utils/memory.ts
@@ -1,31 +1,38 @@
 import client from "./client.js";
+import type { GuildConfig } from "./database.js";
+
+interface GuildData {
+    lastUpdated: number;
+    filters: GuildConfig["filters"];
+    logging: GuildConfig["logging"];
+    tickets: GuildConfig["tickets"];
+}
 
 class Memory {
-    // eslint-disable-next-line @typescript-eslint/no-explicit-any
-    memory: Record<string, any>;
+    memory: Map<string, GuildData>;
     constructor() {
-        this.memory = {};
+        this.memory = new Map<string, GuildData>();
 
         setInterval(() => {
-            for (const guild in this.memory) {
-                if (this.memory[guild].updated + 15 * 60 * 1000 < Date.now()) {
-                    delete this.memory[guild];
+            for (const [guild, guildData] of this.memory.entries()) {
+                if (guildData.lastUpdated + 15 * 60 * 1000 < Date.now()) {
+                    this.memory.delete(guild);
                 }
             }
         }, 1000 * 60 * 30);
     }
 
-    async readGuildInfo(guild: string): Promise<object> {
-        if (!this.memory[guild]) {
+    async readGuildInfo(guild: string): Promise<GuildData> {
+        if (!this.memory.has(guild)) {
             const guildData = await client.database.guilds.read(guild);
-            this.memory[guild] = {
+            this.memory.set(guild, {
                 lastUpdated: Date.now(),
                 filters: guildData.filters,
                 logging: guildData.logging,
                 tickets: guildData.tickets
-            };
+            });
         }
-        return this.memory[guild];
+        return this.memory.get(guild)!;
     }
 }
 
diff --git a/src/utils/plurals.ts b/src/utils/plurals.ts
index 619ced2..9cb16a0 100644
--- a/src/utils/plurals.ts
+++ b/src/utils/plurals.ts
@@ -4,4 +4,4 @@
     return `${amount} ${unit}s`;
 }
 
-export default addPlural;
\ No newline at end of file
+export default addPlural;
diff --git a/src/utils/singleNotify.ts b/src/utils/singleNotify.ts
index 7339129..8f011e3 100644
--- a/src/utils/singleNotify.ts
+++ b/src/utils/singleNotify.ts
@@ -3,28 +3,40 @@
 import { Record as ImmutableRecord } from "immutable";
 
 const severitiesType = ImmutableRecord({
-    "Critical": "Danger",
-    "Warning": "Warning",
-    "Info": "Success"
+    Critical: "Danger",
+    Warning: "Warning",
+    Info: "Success"
 } as Record<string, "Danger" | "Warning" | "Success">);
 const severities = severitiesType();
 
-export default async function(type: string, guild: string, message: string | true, severity: "Critical" | "Warning" | "Info" = "Info") {
+export default async function (
+    type: string,
+    guild: string,
+    message: string | true,
+    severity: "Critical" | "Warning" | "Info" = "Info"
+) {
     const data = await client.database.guilds.read(guild);
     if (message === true) {
-        return await client.database.guilds.write(guild, {[`singleEventNotifications.${type}`]: false});
+        return await client.database.guilds.write(guild, {
+            [`singleEventNotifications.${type}`]: false
+        });
     }
     if (data.singleEventNotifications[type]) return;
-    await client.database.guilds.write(guild, {[`singleEventNotifications.${type}`]: true});
+    await client.database.guilds.write(guild, {
+        [`singleEventNotifications.${type}`]: true
+    });
     try {
         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.get(severity))
-            .setEmoji("CONTROL.BLOCKCROSS")
-        ]});
+        await channel.send({
+            embeds: [
+                new EmojiEmbed()
+                    .setTitle(`${severity} notification`)
+                    .setDescription(message)
+                    .setStatus(severities.get(severity))
+                    .setEmoji("CONTROL.BLOCKCROSS")
+            ]
+        });
     } catch (err) {
         console.error(err);
     }
diff --git a/src/utils/temp/generateFileName.ts b/src/utils/temp/generateFileName.ts
index 8a219b7..956f1d7 100644
--- a/src/utils/temp/generateFileName.ts
+++ b/src/utils/temp/generateFileName.ts
@@ -2,7 +2,7 @@
 import * as crypto from "crypto";
 import client from "../client.js";
 import * as path from "path";
-import {fileURLToPath} from "url";
+import { fileURLToPath } from "url";
 const __filename = fileURLToPath(import.meta.url);
 const __dirname = path.dirname(__filename);
 
@@ -12,6 +12,10 @@
     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);
 }
