Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

718
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda