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

145
Vistas
DiscordAPIError: cuerpo de formulario no válido 2.options[2].choices: las opciones no se pueden configurar para este tipo de opción

Así que acababa de terminar de codificar el comando de prohibición, y cuando quería ejecutar el bot, recibí un error gigante. Nunca tuve ni idea de lo que significa este error, así que si pudieras explicármelo mientras busco la solución, sería apreciado. Si no puedes, también está bien.

 DiscordAPIError: Invalid Form Body 2.options[2].choices: Choices cannot be configured for this type of option

Busqué el problema, pero parece que no puedo encontrar ninguno. ¿Puede alguien ayudarme con este?

Aquí está el código:

 const { Client, CommandInteraction, MessageEmbed } = require('discord.js'); module.exports = { name: 'ban', description: 'Bans the target member', permission: 'ADMINISTRATOR', options: [{ name: 'target', description: 'Select a target to ban.', type: 'USER', required: true, }, { name: 'reason', description: 'Provide a reason for this ban.', type: 'STRING', required: true, }, { name: 'messages', description: 'Choose one of the choices.', type: 'USER', required: true, choices: [{ name: 'Don\'t delete any', value: '0' }, { name: 'Previous 7 days.', value: '7' } ] }, ], /** * * @param {Client} client * @param {CommandInteraction} interaction */ async execute(client, interaction) { const { options, member } = interaction; const Target = options.getMember('target'); if (Target.id === member.id) return interaction.reply({ embeds: [new MessageEmbed().setColor('RED').setDescription(`⛔ | You can't ban yourself.`)] }) if (Target.permissions.has('ADMINISTRATOR')) return interaction.reply({ embeds: [new MessageEmbed().setColor('RED').setDescription(`⛔ | You can't an administrator.`)] }) const Reason = options.getString('reason'); if (Reason.length > 512) return interaction.reply({ embeds: [new MessageEmbed().setColor('RED').setDescription(`⛔ | The reason can't exceed 512 characters.`)] }) const Amount = options.getString('messages') Target.ban({ days: Amount, reason: Reason }) interaction.reply({ embeds: [new MessageEmbed().setColor('GREEN').setDescription(`✅ | **${target.user.username}** has been banned from the server.`)] }) } };
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

El tipo de USER no puede tener opciones. Parece que necesitas STRING en su lugar. Por ejemplo, su código se vería así:

 const { Client, CommandInteraction, MessageEmbed } = require('discord.js'); module.exports = { name: 'ban', description: 'Bans the target member', permission: 'ADMINISTRATOR', options: [{ name: 'target', description: 'Select a target to ban.', type: 'USER', required: true, }, { name: 'reason', description: 'Provide a reason for this ban.', type: 'STRING', required: true, }, { name: 'messages', description: 'Choose one of the choices.', type: 'STRING', required: true, choices: [{ name: 'Don\'t delete any', value: '0' }, { name: 'Previous 7 days.', value: '7' } ] }, ], /** * * @param {Client} client * @param {CommandInteraction} interaction */ async execute(client, interaction) { const { options, member } = interaction; const Target = options.getMember('target'); if (Target.id === member.id) return interaction.reply({ embeds: [new MessageEmbed().setColor('RED').setDescription(`⛔ | You can't ban yourself.`)] }) if (Target.permissions.has('ADMINISTRATOR')) return interaction.reply({ embeds: [new MessageEmbed().setColor('RED').setDescription(`⛔ | You can't an administrator.`)] }) const Reason = options.getString('reason'); if (Reason.length > 512) return interaction.reply({ embeds: [new MessageEmbed().setColor('RED').setDescription(`⛔ | The reason can't exceed 512 characters.`)] }) const Amount = options.getString('messages') Target.ban({ days: Amount, reason: Reason }) interaction.reply({ embeds: [new MessageEmbed().setColor('GREEN').setDescription(`✅ | **${target.user.username}** has been banned from the server.`)] }) } };

Ver aquí para la referencia.

¡Esperaba que esto ayudara!

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