Err | Embed failure / Invalid body form

Hi all, I keep getting this error never seen this before.
TThere was an error: DiscordAPIError[50035]: Invalid Form Body
options[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (3, 7, 9, 11, 8, 10, 6, 1, 2, 4, 5).
options[1][UNION_TYPE_CHOICES]: Value of field "type" must be one of (3, 7, 9, 11, 8, 10, 6, 1, 2, 4, 5).
There was an error running this command: TypeError: MessageActionRow is not a constructor
TThere was an error: DiscordAPIError[50035]: Invalid Form Body
options[0][UNION_TYPE_CHOICES]: Value of field "type" must be one of (3, 7, 9, 11, 8, 10, 6, 1, 2, 4, 5).
options[1][UNION_TYPE_CHOICES]: Value of field "type" must be one of (3, 7, 9, 11, 8, 10, 6, 1, 2, 4, 5).
There was an error running this command: TypeError: MessageActionRow is not a constructor
12 Replies
d.js toolkit
d.js toolkit12mo 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! - Marked as resolved by OP
JoelHCraft
JoelHCraftOP12mo ago
Node -
v20.10.0
v20.10.0
Discord.js -
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
JoelHCraft
JoelHCraftOP12mo ago
const { MessageActionRow, MessageButton } = require('discord.js');

module.exports = {
name: 'loa',
description: 'Request LOA',
testOnly: true,
options: [
{
name: 'length',
type: 'STRING',
description: 'Length of the Leave of Absence (e.g., 2 weeks)',
required: true,
},
{
name: 'reason',
type: 'STRING',
description: 'Reason for the Leave of Absence',
required: true,
},
],

callback: async (client, interaction) => {
const length = interaction.options.getString('length');
const reason = interaction.options.getString('reason');

const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('confirm')
.setLabel('Confirm')
.setStyle('SUCCESS'),
new MessageButton()
.setCustomId('cancel')
.setLabel('Cancel')
.setStyle('DANGER'),
);

await interaction.reply({
content: `Are you sure you want to request a Leave of Absence for ${length} due to the following reason: "${reason}"?`,
components: [row],
});
},
};
const { MessageActionRow, MessageButton } = require('discord.js');

module.exports = {
name: 'loa',
description: 'Request LOA',
testOnly: true,
options: [
{
name: 'length',
type: 'STRING',
description: 'Length of the Leave of Absence (e.g., 2 weeks)',
required: true,
},
{
name: 'reason',
type: 'STRING',
description: 'Reason for the Leave of Absence',
required: true,
},
],

callback: async (client, interaction) => {
const length = interaction.options.getString('length');
const reason = interaction.options.getString('reason');

const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('confirm')
.setLabel('Confirm')
.setStyle('SUCCESS'),
new MessageButton()
.setCustomId('cancel')
.setLabel('Cancel')
.setStyle('DANGER'),
);

await interaction.reply({
content: `Are you sure you want to request a Leave of Absence for ${length} due to the following reason: "${reason}"?`,
components: [row],
});
},
};
d.js docs
d.js docs12mo ago
guide Additional Information: Updating from v13 to v14 - Breaking Changes read more
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
JoelHCraft
JoelHCraftOP12mo ago
Thank you (: so its getString not an option now ? when it comes to retrieving the contents from the option
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
JoelHCraft
JoelHCraftOP12mo ago
options: [
{
name: 'length',
type: ApplicationCommandOptionType.String,
description: 'Length of the Leave of Absence (e.g., 2 weeks)',
required: true,
},
{
name: 'reason',
type: ApplicationCommandOptionType.String,
description: 'Reason for the Leave of Absence',
required: true,
},
],
options: [
{
name: 'length',
type: ApplicationCommandOptionType.String,
description: 'Length of the Leave of Absence (e.g., 2 weeks)',
required: true,
},
{
name: 'reason',
type: ApplicationCommandOptionType.String,
description: 'Reason for the Leave of Absence',
required: true,
},
],
There was an error running this command: TypeError: interaction.options.getString is not a function
There was an error running this command: TypeError: interaction.options.getString is not a function
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
JoelHCraft
JoelHCraftOP12mo ago
I am afraid I am stuck on this one.
d.js docs
d.js docs12mo ago
The order of function parameters must match between definition and function call.
function execute(client, interaction) { ... };
execute(interaction, client);
function execute(client, interaction) { ... };
execute(interaction, client);
- mismatch! you pass an interaction where the client is expected - mismatch! you pass the client where an interaction is expected
Want results from more Discord servers?
Add your server