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

720
Visualizações
DiscordJS v13 Invalid Form Body

I am trying to make a toggle able slash command, if they pick the disable option it turns it off but when if you pick the enable option it asks to pick a channel but it gives this error

Error:

DiscordAPIError[50035]: Invalid Form Body
23.name[BASE_TYPE_REQUIRED]: This field is required
  rawError: {
    code: 50035,
    errors: { '23': [Object] },
    message: 'Invalid Form Body'
  },
  code: 50035,
  status: 400,
  method: 'put',
  url: 'https://discord.com/api/v9/applications/971024098098569327/commands'

Code:

module.exports = {
    name: 'welcomer',
    permissions: 'MANAGE_CHANNELS',
    description: 'Set Where Welcome Messages Get Sent To.',
    options: [
        {
            name: 'toggle',
            description: 'Toggle On/Off The Welcomer',
            type: 3,
            required: true,
            choices: [
                {
                    name: 'disable',
                    value: 'off',
                },
                {
                    name: 'enable',
                    value: 'on',
                    choices: [
                        {
                            name: 'channel',
                            description: 'Select channel to send welcome messages to',
                            type: 7,
                            required: true,
                        },
                    ]
                },
            ],
        },
    ],
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Those would be an example of a subcommand and need to be indicated as such and will need descriptions in a couple places.

module.exports = {
    name: 'welcomer',
    permissions: 'MANAGE_CHANNELS',
    description: 'Set Where Welcome Messages Get Sent To.',
    options: [{
        name: 'disable',
        description: `'Disable welcomer`, // Added needed description
        type: 1, //converted to subcommmand
    }, {
        name: 'enable',
        description: `'Enable welcomer`, // Added needed description
        type: 1, //converted to subcommmand
        options: [{
            name: 'channel',
            description: 'Select channel to send welcome messages to',
            type: 7,
            required: true,
            channel_types: [0] // allows only text channels to be selected
        }]
    }],
    // run command pick only one of the below two
    // if command.execute()
    async execute(client, interaction, args)
    // if command.run()
    run: async (client, interaction, args) =>
    // command code below here assumes you have the code in your `interactionCreate` listener to set up args
    {
        if (args.disable) {
            // Code to turn off
        } else if (args.enable) {
            const channel = args.channel
            // Code to turn on
        };
    }
}
about 4 years ago · Juan Pablo Isaza Relatório
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