#DiscordAPIError 50035 Invalid Form Body

1 messages · Page 1 of 1 (latest)

shy yew
#

Application Commands must have unique names

#

You have 2 or more commands with the same name

vital quarry
#

i dont

#

ones called

#

profile

#

and

#

link

shy yew
#

Can I see it?

vital quarry
shy yew
#

well there are 2 commands with the same name

#

Please check profile.js

vital quarry
shy yew
#

Are you including some other command as well

vital quarry
#

nope

#

there is no othjer

#

commands

#

just them 2 rn

shy yew
#

Because if the error says so then you must be using 2 commands with the same name

vital quarry
#

but im not?

#

which is whats confusing

#

could be my command handler

#

although this command handler is working with my other bot

shy yew
#

Send the handler code

vital quarry
#

const { REST } = require("@discordjs/rest");
const { Routes } = require('discord-api-types/v9');
const fs = require('fs');
const config = require('../config.json')

const clientId = '939900690153742346';

module.exports = (client) => {
client.handleCommands = async (commandFolders, path) => {
client.commandArray = [];
for (folder of commandFolders) {
const commandFiles = fs.readdirSync(${path}).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(../slash/${file});
client.commands.set(command.data.name, command);
client.commandArray.push(command.data.toJSON());
}
}

    const rest = new REST({
        version: '9'
    }).setToken(config.token);

    (async () => {
        try {
            console.log('Started refreshing application (/) commands.');

            await rest.put(
                Routes.applicationCommands(clientId), {
                    body: client.commandArray
                },
            );

            console.log('Successfully reloaded application (/) commands.');
        } catch (error) {
            console.error(error);
        }
    })();
};

};

#

module.exports = (client) => {
client.handleEvents = async (eventFiles, path) => {
for (const file of eventFiles) {
const event = require(../events/${file});
if (event.once) {
client.once(event.name, (...args) => event.execute(...args, client));
} else {
client.on(event.name, (...args) => event.execute(...args, client));
}
}
};
}

#

const { Client, ActionRowBuilder,ButtonStyle, ActivityType, GatewayIntentBits, EmbedBuilder, StringSelectMenuBuilder,PermissionsBitField, Permissions, MessageManager, Embed, Collection, Events, ModalBuilder, TextInputBuilder, TextInputStyle, ButtonBuilder, SelectMenuOptionBuilder } = require(discord.js);
const fs = require('fs');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });
const config = require('./config.json')

client.commands = new Collection();

const functions = fs.readdirSync("./functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./slash");

(async () => {
for (file of functions) {
require(./functions/${file})(client);
}
client.handleEvents(eventFiles, "./events");
client.handleCommands(commandFolders, "./slash");
client.login(config.token)
})();

client.on(Events.ClientReady, async () => {

const activities = [`BluePod ${client.guilds.cache.size} Servers`, `https://bluepod.tk`];
setInterval(() => {
  let activity = activities[Math.floor(Math.random() * activities.length)];
  client.user.setActivity(activity, { type: ActivityType.Watching });
}, 2000);

}) // dont touch

#

module.exports = {
name: 'ready',
once: true,
async execute(client) {
console.log('Ready!');

    async function pickPresence () {
        const option = Math.floor(Math.random() * statusArray.length);

        try {
            await client.user.setPresence({
                activities: [
                    {
                        name: statusArray[option].content,
                        type: statusArray[option].type,

                    },
                
                ],

                status: statusArray[option].status
            })
        } catch (error) {
            console.error(error);
        }
    }
},

};

#

const { Interaction } = require("discord.js");

module.exports = {
name: 'interactionCreate',
async execute(interaction, client) {
if (!interaction.isCommand()) return;

    const command = client.commands.get(interaction.commandName);

    if (!command) return
    
    try{


        await command.execute(interaction, client);
    } catch (error) {
        console.log(error);
        await interaction.reply({
            content: 'There was an error while executing this command!', 
            ephemeral: true
        });
    } 

},

};

#

there

#

all the code

shy yew
#

Well I am not able to identify the error

#

Can you run the bot again

vital quarry
#

ok

#

yup

#

still same

#

error

shy yew
#

v10 is the latest version although not related to the error

vital quarry
#

how do i do that then

#

nvm

shy yew
#

Were you able to fix it?

vital quarry
#

no

#

i replaced v9 with v10

#

but

#

it didnt change it

#

still: Started refreshing application (/) commands.
DiscordAPIError[50035]: Invalid Form Body
2[APPLICATION_COMMANDS_DUPLICATE_NAME]: Application command names must be unique
at SequentialHandler.runRequest (C:\Users\xbox3\Downloads\node_modules@discordjs\rest\dist\index.js:933:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.queueRequest (C:\Users\xbox3\Downloads\node_modules@discordjs\rest\dist\index.js:712:14)
at async REST.request (C:\Users\xbox3\Downloads\node_modules@discordjs\rest\dist\index.js:1321:22)
at async C:\Users\xbox3\Downloads\BluePodV2.0\functions\handelCommands.js:29:17 {
rawError: {
code: 50035,
errors: { '2': [Object] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/939900690153742346/commands',
requestBody: {
files: undefined,
json: [ [Object], [Object], [Object], [Object] ]
}
}

neat juniper
#

you have duplicating command names. there's really not much more we can say besides making sure your command names are different

vital quarry
#

i sent ss

neat juniper
#

discord says otherwise

vital quarry
#

BUT I SENT SCREENSHOTS

neat juniper
#

chill out

vital quarry
#

SO U CAN SEE THAT THEY DIFFERENT

shy yew
#

Then it must be discord's fault

neat juniper
#

no

shy yew
#

Discord is wrong

#

You are right

#

A billion dollar company couldn't fix it

vital quarry
#

im not in the mood for this bs

shy yew
#

We are not too

neat juniper
#

good luck

shy yew
#

But still we are trying to figure your problem

#

Ungrateful brat Take that back

vital quarry
neat juniper
#

thats too far...completely unnecessary

shy yew
#

Well from what I see

#

There is def some error in the code

#

That we are not able to see

vital quarry
#

i used in my old bot

shy yew
#

So this might take some time

vital quarry
#

discord.js v13 bot

shy yew
#

I see

vital quarry
#

i just wanted to upgrade to more stable version

shy yew
#

v13 is stable

vital quarry
#

and keep it updated

#

ik

#

but

#

i want a new version

#

i want to stay updated

#

so im recode bot

shy yew
#

Well can I see the file structure

vital quarry
#

yea

#

i tried adding community and it doesnt error but it still doesnt register commands

#

so we kinda stuck

#

in between a barrier

#

but it doesnt register commands

vital quarry
#

fixed it

#

its fine

shy yew
#

What was the issue?