DiscordAPIError[50035]: Invalid Form Body

Viewed 28

It seems that their is no answer for such an issue that i encountered and every other person that posted this question in here. the solution i got was a tutorial vid that came to the same issue and was solved as follows:

const clientId = 'x';
const guildId = 'x';    

  try {
      await rest.put(
        Routes.applicationGuildCommands(clientId,guildId),
        { body: commands },); 
    } catch (error) {
      console.log(error)
    }

just add them as var and not the id as itself

DiscordAPIError[50035]: Invalid Form Body
    guild_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at async SequentialHandler.queueRequest (C:\discord\TIP-BOT\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:99:14)
        at async REST.request (C:\discord\TIP-BOT\node_modules\@discordjs\rest\dist\lib\REST.cjs:52:22)
        at async Client.<anonymous> (C:\discord\TIP-BOT\bot.js:51:7) {
      rawError: {
        code: 50035,
        errors: { guild_id: [Object] },
        message: 'Invalid Form Body'
      },
      code: 50035,
      status: 400,
      method: 'PUT',
      url: 'https://discord.com/api/v9/applications/999345819608158280/guilds/undefined/commands',
      requestBody: { files: undefined, json: [ [Object] ] }
0 Answers
Related