problem with BASE_TYPE_REQUIRED
Hello, here's my code :
and when i launched the bot the console reply with this error:
const { ApplicationCommandOptionType, ChatInputCommandInteraction, EmbedBuilder, ButtonBuilder, ActionRowBuilder, ButtonStyle } = require('discord.js')
const choices = [
{ name: 'Pierre', emoji: '🪨', beats: 'ciseaux' },
{ name: 'Papier', emoji: '📄', beats: 'Pierre' },
{ name: 'Ciseaux', emoji: '✂️', beats: 'Papier' },
];
module.exports = {
/**
*
* @param {Object} param0
* @param {ChatInputCommandInteraction} param0.interaction
*/
callback: async (interaction) => {
try {
const targetUser = interaction.options.getUser('user');
if (interaction.user.id === targetUser.id) {
interaction.reply({
content: 'Tu peux pas jouer au chifoumi tout seul.',
ephemeral: true,
});
return;
}
if (targetUser.bot) {
interaction.reply({
content: 'Tu peux pas jouer au chifoumi avec un bot.',
ephemeral: true,
})
return;
}
const embed = new EmbedBuilder()
.setTitle('Pierre Feuille Ciseaux')
.setDescription(`C'est actuellement le tour de ${targetUser}.`)
.setColor('Yellow')
.setTimestamp(new Date())
const buttons = choices.map((choice) => {
return new ButtonBuilder()
.setCustomId(choice.name)
.setLabel(choice.name)
.setStyle(ButtonStyle.Primary)
.setEmoji(choice.emoji)
});
const row = new ActionRowBuilder().addComponents(buttons)
const reply = await interaction.reply({
content: `${targetUser},vous avez été mis au défi de jouer au chifoumi, par ${interaction.user}. Pour commencer a jouer, cliquez sur un des bouttons en dessous.`,
embeds: [embed],
components: [row],
});
} catch (error) {
console.log(`Erreur avec /chifoumi`);
console.error(error);
}
},
data: {
name: 'chifoumi',
description: "Faire un pierre, feuille, ciseaux avec quelqu'un.",
dm_permission: false,
options: [
{
name: 'user',
description: "La personne avec qui tu veux jouer.",
type: ApplicationCommandOptionType.User,
required: true,
}
]
}
}const { ApplicationCommandOptionType, ChatInputCommandInteraction, EmbedBuilder, ButtonBuilder, ActionRowBuilder, ButtonStyle } = require('discord.js')
const choices = [
{ name: 'Pierre', emoji: '🪨', beats: 'ciseaux' },
{ name: 'Papier', emoji: '📄', beats: 'Pierre' },
{ name: 'Ciseaux', emoji: '✂️', beats: 'Papier' },
];
module.exports = {
/**
*
* @param {Object} param0
* @param {ChatInputCommandInteraction} param0.interaction
*/
callback: async (interaction) => {
try {
const targetUser = interaction.options.getUser('user');
if (interaction.user.id === targetUser.id) {
interaction.reply({
content: 'Tu peux pas jouer au chifoumi tout seul.',
ephemeral: true,
});
return;
}
if (targetUser.bot) {
interaction.reply({
content: 'Tu peux pas jouer au chifoumi avec un bot.',
ephemeral: true,
})
return;
}
const embed = new EmbedBuilder()
.setTitle('Pierre Feuille Ciseaux')
.setDescription(`C'est actuellement le tour de ${targetUser}.`)
.setColor('Yellow')
.setTimestamp(new Date())
const buttons = choices.map((choice) => {
return new ButtonBuilder()
.setCustomId(choice.name)
.setLabel(choice.name)
.setStyle(ButtonStyle.Primary)
.setEmoji(choice.emoji)
});
const row = new ActionRowBuilder().addComponents(buttons)
const reply = await interaction.reply({
content: `${targetUser},vous avez été mis au défi de jouer au chifoumi, par ${interaction.user}. Pour commencer a jouer, cliquez sur un des bouttons en dessous.`,
embeds: [embed],
components: [row],
});
} catch (error) {
console.log(`Erreur avec /chifoumi`);
console.error(error);
}
},
data: {
name: 'chifoumi',
description: "Faire un pierre, feuille, ciseaux avec quelqu'un.",
dm_permission: false,
options: [
{
name: 'user',
description: "La personne avec qui tu veux jouer.",
type: ApplicationCommandOptionType.User,
required: true,
}
]
}
}and when i launched the bot the console reply with this error:
There was an error: DiscordAPIError[50035]: Invalid Form Body
name[BASE_TYPE_REQUIRED]: This field is requiredThere was an error: DiscordAPIError[50035]: Invalid Form Body
name[BASE_TYPE_REQUIRED]: This field is required