diff --git a/src/utils/commandRegistration/register.ts b/src/utils/commandRegistration/register.ts
index a4c57c4..d96ca90 100644
--- a/src/utils/commandRegistration/register.ts
+++ b/src/utils/commandRegistration/register.ts
@@ -16,7 +16,7 @@
 async function registerCommands() {
     const commands = [];
 
-    const files = fs.readdirSync(config.commandsFolder, { withFileTypes: true }).filter(
+    const files: fs.Dirent[] = fs.readdirSync(config.commandsFolder, { withFileTypes: true }).filter(
         file => !file.name.endsWith(".ts") && !file.name.endsWith(".map")
     );
     console.log(`Registering ${files.length} commands`)
@@ -25,10 +25,15 @@
         const last = i === files.length - 1 ? "└" : "├";
         if (file.isDirectory()) {
             console.log(`${last}─ ${colours.yellow}Loading subcommands of ${file.name}${colours.none}`)
-            commands.push((await import(`../../../${config.commandsFolder}/${file.name}/_meta.js`)).command);
+            const fetched = (await import(`../../../${config.commandsFolder}/${file.name}/_meta.js`)).command;
+            commands.push(fetched);
         } else if (file.name.endsWith(".js")) {
             console.log(`${last}─ ${colours.yellow}Loading command ${file.name}${colours.none}`)
             const fetched = (await import(`../../../${config.commandsFolder}/${file.name}`));
+            fetched.command.setDMPermission(fetched.allowedInDMs ?? false)
+            fetched.command.setNameLocalizations(fetched.nameLocalizations ?? {})
+            fetched.command.setDescriptionLocalizations(fetched.descriptionLocalizations ?? {})
+            if (fetched.nameLocalizations || fetched.descriptionLocalizations) console.log("AAAAA")
             commands.push(fetched.command);
             client.commands["commands/" + fetched.command.name] = fetched;
         }
@@ -97,6 +102,8 @@
             console.log(`${last}─ ${colours.yellow}Loading message context menu ${file.name}${colours.none}`)
             const context = (await import(`../../../${config.messageContextFolder}/${file.name}`));
             context.command.setType(ApplicationCommandType.Message);
+            context.command.setDMPermission(context.allowedInDMs ?? false)
+            context.command.setNameLocalizations(context.nameLocalizations ?? {})
             commands.push(context.command);
 
             client.commands["contextCommands/message/" + context.command.name] = context;
@@ -182,6 +189,7 @@
     callback(data);
 }
 
+
 export default async function register() {
     let commandList: ( Discord.SlashCommandBuilder | Discord.ContextMenuCommandBuilder )[] = [];
     commandList = commandList.concat(await registerCommands());
diff --git a/src/utils/commandRegistration/slashCommandBuilder.ts b/src/utils/commandRegistration/slashCommandBuilder.ts
index 76ecabe..b2927d6 100644
--- a/src/utils/commandRegistration/slashCommandBuilder.ts
+++ b/src/utils/commandRegistration/slashCommandBuilder.ts
@@ -13,7 +13,13 @@
 }
 
 
-export async function group(name: string, description: string, path: string) {
+export async function group(
+    name: string,
+    description: string,
+    path: string,
+    nameLocalizations?: Record<string, string>,
+    descriptionLocalizations?: Record<string, string>
+) {
     // If the name of the command does not match the path (e.g. attachment.ts has /attachments), use commandString
     console.log(`│  ├─ Loading group ${name}`)
     const fetched = await getSubcommandsInFolder(config.commandsFolder + "/" + path, "│  ")
@@ -22,6 +28,8 @@
         subcommandGroup
             .setName(name)
             .setDescription(description)
+        if (nameLocalizations) { subcommandGroup.setNameLocalizations(nameLocalizations) }
+        if (descriptionLocalizations) { subcommandGroup.setDescriptionLocalizations(descriptionLocalizations) }
 
         for (const subcommand of fetched.subcommands) {
             subcommandGroup.addSubcommand(subcommand.command);
@@ -31,7 +39,16 @@
     };
 }
 
-export async function command(name: string, description: string, path: string, commandString: string | undefined = undefined) {
+export async function command(
+    name: string,
+    description: string,
+    path: string,
+    commandString: string | undefined = undefined,
+    nameLocalizations?: Record<string, string>,
+    descriptionLocalizations?: Record<string, string>,
+    userPermissions?: Discord.PermissionsString[],
+    allowedInDMs?: boolean
+) {
     // If the name of the command does not match the path (e.g. attachment.ts has /attachments), use commandString
     commandString = "commands/" + (commandString ?? path);
     const fetched = await getSubcommandsInFolder(config.commandsFolder + "/" + path);
@@ -39,6 +56,14 @@
     return (command: SlashCommandBuilder) => {
         command.setName(name)
         command.setDescription(description)
+        command.setNameLocalizations(nameLocalizations ?? {})
+        command.setDescriptionLocalizations(descriptionLocalizations ?? {})
+        command.setDMPermission(allowedInDMs ?? false)
+        if (userPermissions) {
+            const bitfield = new Discord.PermissionsBitField()
+                bitfield.add(userPermissions)
+            command.setDefaultMemberPermissions(bitfield.bitfield)
+        }
 
         for (const subcommand of fetched.subcommands) {
             let fetchedCommand;
