斜杠命令出错50035 | Discord.js



DiscordAPIError[50035]: Invalid Form Body0.选择[0]。type[NUMBER_TYPE_COERCE]: Value "STRING">

不知道怎么回事

const Command = require('../../structures/Command') //../ Sinaliza quantas pastas pular
const { MessageEmbed } = require('discord.js')
module.exports = class extends Command {
constructor(client) {
super(client, {
name: 'wildcat',
description: 'Insira o código do Bundle indicado.',
options:[
{
name: 'codigowildcat' ,
type: 'STRING' ,
description: 'Código do bundle.' ,
required: true
}
]
})
}
run = (interaction) => {
const wildcat = interaction.options.getString('codigowildcat')
let apostos = "```"
const embed = new MessageEmbed()
//.setTitle(`Seu código.`)
.setThumbnail("https://cdn.discordapp.com/attachments/694959159199793236/987371688444428309/Wildcat.png")
.setDescription(`<:confetes:985241046197882950>** ・__ Parabéns, você acabou de comprar: <:Wildcat:910010235505233981> WILDCAT!__**
**Segue abaixo o seu `CÓDIGO` exclusivo:**
${apostos}${wildcat}${apostos}
:100:  | Lembre-se de deixar uma PRINT em <#909845324858798131> para nos ajudar.`)
.setColor('#0eb2ee')
.setFooter('💙 ・ TB STORE Agradece a preferência e confiança.')
//.setTimestamp()
return interaction.reply({ embeds: [embed] })
.catch(() => interaction.reply({content: `Erro | Erro ao tentar enviar a mensagem.`, ephemeral: true }))
}
}

您没有提供太多上下文,但是您可以创建一个斜杠命令来查找整数输入,如下所示

const { SlashCommandBuilder } = require('@discordjs/builders');

/** Defining a command */
let command = new SlashCommandBuilder()
.setName('command name')
.setDescription('command description')
.addIntegerOption(option =>
option.setName('optionName')
.setDescription('option description')
.setRequired(true))

/** Handling the interaction */
client.on('interactionCreate', interaction => {
if (!interaction.isCommand()) return;
let input = interaction.options.getInteger('optionName');
/** Rest of code */
})

最新更新