problem with BASE_TYPE_REQUIRED

Hello, here's my code :
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 required
There was an error: DiscordAPIError[50035]: Invalid Form Body
name[BASE_TYPE_REQUIRED]: This field is required
6 Replies
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
treble/luna
treble/luna11mo ago
show the full error
Edr0b0t
Edr0b0tOP11mo ago
this is already the full error
No description
treble/luna
treble/luna11mo ago
dont stringify your errors it makes them useless
Edr0b0t
Edr0b0tOP11mo ago
I'm sorry, but I can't remember when or in which file I restricted the error size, but despite that, have you miraculously found a solution?
treble/luna
treble/luna11mo ago
no cant tell without the full error
Want results from more Discord servers?
Add your server