Estoy tratando de hacer un comando de barra inclinada alternable, si eligen la opción de disable , la desactiva, pero cuando elige la opción de enable , le pide que elija un canal, pero da este 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'Código:
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, }, ] }, ], }, ],Esos serían un ejemplo de un subcomando y deben indicarse como tales y necesitarán descripciones en un par de lugares.
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 }; } }