diff --git a/src/utils/commandRegistration/getFilesInFolder.ts b/src/utils/commandRegistration/getFilesInFolder.ts
new file mode 100644
index 0000000..a669065
--- /dev/null
+++ b/src/utils/commandRegistration/getFilesInFolder.ts
@@ -0,0 +1,23 @@
+import fs from "fs";
+
+export default async function getSubcommandsInFolder(path: string) {
+    const files = fs.readdirSync(path, { withFileTypes: true }).filter(
+        file => !file.name.endsWith(".ts") && !file.name.endsWith(".map")
+    );
+    const subcommands = [];
+    const subcommandGroups = [];
+    for (const file of files) {
+        if (file.name === "_meta.js") continue;
+        // If its a folder
+        if (file.isDirectory()) {
+            // Get the _meta.ts file
+            console.log(`│ ├─ Loading subcommand group ${file.name}}`)
+            subcommandGroups.push((await import(`../../../${path}/${file.name}/_meta.js`)).command);
+        } else if (file.name.endsWith(".js")) {
+            // If its a file
+            console.log(`│ ├─ Loading subcommand ${file.name}}`)
+            subcommands.push((await import(`../../../${path}/${file.name}`)).command);
+        }
+    }
+    return {subcommands, subcommandGroups};
+}
diff --git a/src/utils/commandRegistration/register.ts b/src/utils/commandRegistration/register.ts
new file mode 100644
index 0000000..af0b5fc
--- /dev/null
+++ b/src/utils/commandRegistration/register.ts
@@ -0,0 +1,61 @@
+import { SlashCommandBuilder } from 'discord.js';
+import config from "../../config/main.json" assert { type: "json" };
+import client from "../client.js";
+import fs from "fs";
+
+
+async function registerCommands() {
+    const developmentMode = config.enableDevelopment;
+    const commands = [];
+
+    const files = fs.readdirSync(config.commandsFolder, { withFileTypes: true }).filter(
+        file => !file.name.endsWith(".ts") && !file.name.endsWith(".map")
+    );
+    console.log(`Registering ${files.length} commands`)
+    let i = 0;
+    for (const file of files) {
+        // Box drawing characters: | └ ─ ┌ ┐ ┘ ┬ ┤ ├ ┴ ┼
+        console.log(`├─ ${file.name}`)
+        if (file.isDirectory()) {
+            commands.push((await import(`../../../${config.commandsFolder}/${file.name}/_meta.js`)).command);
+        } else if (file.name.endsWith(".js")) {
+            commands.push((await import(`../../../${config.commandsFolder}/${file.name}`)).command);
+        }
+        i++;
+        console.log(`├─ Loaded ${file.name} [${i} / ${files.length}]`)
+    }
+    console.log(`Loaded ${commands.length} commands, processing...`)
+    const processed = []
+
+    for (const subcommand of commands) {
+        if (subcommand instanceof Function) {
+            processed.push(subcommand(new SlashCommandBuilder()))
+        } else {
+            processed.push(subcommand)
+        }
+    }
+
+    console.log(`Processed ${commands.length} commands, registering...`)
+
+    if (developmentMode) {
+        const guild = await client.guilds.fetch(config.developmentGuildID);
+        guild.commands.set([])
+        guild.commands.set(processed);
+        console.log(`Commands registered in ${guild.name}`)
+    } else {
+        client.application!.commands.set([])
+        client.application!.commands.set(processed);
+        console.log(`Commands registered globally`)
+    }
+
+};
+
+async function registerEvents() {
+    // pass
+};
+
+export default async function register() {
+    console.log("> Registering commands")
+    await registerCommands();
+    await registerEvents();
+};
diff --git a/src/utils/commandRegistration/slashCommandBuilder.ts b/src/utils/commandRegistration/slashCommandBuilder.ts
new file mode 100644
index 0000000..719855f
--- /dev/null
+++ b/src/utils/commandRegistration/slashCommandBuilder.ts
@@ -0,0 +1,37 @@
+import type { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
+import type { SlashCommandBuilder } from "discord.js";
+import config from "../../config/main.json" assert { type: "json" };
+import getSubcommandsInFolder from "./getFilesInFolder.js";
+
+
+export async function group(name: string, description: string, path: string) {
+    const fetched = await getSubcommandsInFolder(config.commandsFolder + "/" + path)
+    return (subcommandGroup: SlashCommandSubcommandGroupBuilder) => {
+        subcommandGroup
+            .setName(name)
+            .setDescription(description)
+
+        for (const subcommand of fetched.subcommands) {
+            subcommandGroup.addSubcommand(subcommand);
+        };
+
+        return subcommandGroup;
+    };
+}
+
+export async function command(name: string, description: string, path: string) {
+    const fetched = await getSubcommandsInFolder(config.commandsFolder + "/" + path);
+    console.log(`│ ├─ Loaded ${fetched.subcommands.length} subcommands and ${fetched.subcommandGroups.length} subcommand groups for ${name}`)
+    return (command: SlashCommandBuilder) => {
+        command.setName(name)
+        command.setDescription(description)
+
+        for (const subcommand of fetched.subcommands) {
+            command.addSubcommand(subcommand);
+        }
+        for (const group of fetched.subcommandGroups) {
+            command.addSubcommandGroup(group);
+        };
+        return command;
+    };
+}
