COMMAND REGISTRATION WORKS
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};
+}