Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

498
Visualizações
Discord.JS DiscordAPIError[50035] Invalid Form Body when registering my commands

I am writing a suggest command using a basic command handler from the discord.js guide, whenever I deploy my commands I get the below error. I have tried to edit my embeds to see if that was my issue since I'm fairly new to DiscordJS.


    DiscordAPIError[50035]: Invalid Form Body
guild_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
    at SequentialHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:753:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:565:14)
    at async REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:999:22) {
  rawError: {
    code: 50035,
    errors: { guild_id: [Object] },
    message: 'Invalid Form Body'
  },
  code: 50035,
  status: 400,
  method: 'PUT',
  url: 'https://discord.com/api/v9/applications/991898175478714409/guilds/undefined/commands',
  requestBody: { files: undefined, json: [ [Object], [Object], [Object] ] }
}

Below is my suggestion command code:


    const { SlashCommandBuilder } = require('@discordjs/builders');
const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js');
const { suggestChannelID, suggestLogChannelID, suggestManageRoleID } = require('/home/container/config.json');

module.exports = {
  data : new SlashCommandBuilder()
    .setName('suggest')
    .addStringOption(option => option.setName('suggestion').setDescription('The feature you want to suggest').setRequired(true))
    .setDescription('Suggest a feature to be added to our platform(s)'),
  async execute(interaction) {
    var d = new Date();
    const suggestEmbed = new MessageEmbed()
      .setTitle('New Suggestion')
      .setDescription(interaction.options.getString('Suggestion'))
      .setFooter({ text: `Suggested by <@${interaction.member.id}> @ ` + d.toLocaleTimeString() + " GMT" })
    const row = new MessageActionRow()
      .addComponents(
        new MessageButton()
          .setCustomId('upvote')
          .setStyle('SUCCESS')
          .setLabel('Upvote'),
        new MessageButton()
          .setCustomId('downvote')
          .setStyle('DANGER')
          .setLabel('downvote'),
        new MessageButton()
          .setCustomId('accept')
          .setStyle('SUCCESS')
          .setLabel('Accept'),
        new MessageButton()
          .setCustomId('deny')
          .setStyle('DANGER')
          .setLabel('Deny'),
        new MessageButton()
          .setCustomId('remove')
          .setStyle('SECONDARY')
          .setLabel('Remove'),
      )
    interaction.member.guild.channels.cache.get(suggestChannelID).send({ embeds: [suggestEmbed], components: [row] });
    interaction.reply('Suggestion successfully sent!')
  }
}


about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda