10 Replies
- 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 OPDiscordAPIError[50035]: Invalid Form Body
data.embeds[0].color[NUMBER_TYPE_COERCE]: Value "RANDOM" is not int.
at handleErrors (C:\Users\OE104655\Videos\Eendsmp bot\node_modules@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\OE104655\Videos\Eendsmp bot\node_modules@discordjs\rest\dist\index.js:826:23)
at async _REST.request (C:\Users\OE104655\Videos\Eendsmp bot\node_modules@discordjs\rest\dist\index.js:1266:22)
at async ChatInputCommandInteraction.reply (C:\Users\OE104655\Videos\Eendsmp bot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5)
at async Object.execute (C:\Users\OE104655\Videos\Eendsmp bot\commands\utility\embed.js:31:9)
at async Client.<anonymous> (C:\Users\OE104655\Videos\Eendsmp bot\index.js:69:3) {
requestBody: { files: [], json: { type: 4, data: [Object] } },
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { data: [Object] }
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1214542160976945224/aW50ZXJhY3Rpb246MTIxNDU0MjE2MDk3Njk0NTIyNDptdWhsMkxLNWlYR3NDR2FCNVk3bEpLSnJydzZyNGt0SkVSVHV1cWd2clFjM0FOcTBNS3BQcTB2aWM0NGppdFlPU1A3cHN6eUxpNzZFNWpCSW90SWxHT0ZhTk1XTkxldGhvYU43eFNLZEQyRnZCVGJzbkZndUNSdHRuVEVCOWVhUw/callback'
}
you can only use random if you use the embed builder from djs, and then its Random not RANDOM
I also tried this:
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('embed')
.setDescription('Create an embed')
.addStringOption(option =>
option.setName('title')
.setDescription('Title of the embed')
.setRequired(true))
.addStringOption(option =>
option.setName('description')
.setDescription('Description of the embed')
.setRequired(true))
.addStringOption(option =>
option.setName('color')
.setDescription('Color of the embed in HEX format (e.g., #FF0000)')
.setRequired(false)),
async execute(interaction) {
const { options } = interaction;
const title = options.getString('title');
const description = options.getString('description');
const color = options.getString('color');
const embed = {
title: title,
description: description,
color: color ? color.replace('#', '') : '#00FF00' // If color is not provided, use random color
};
await interaction.reply({ embeds: [embed] });
},
};
also didn't work
again, use the embed builder from djs
Tag suggestion for @JustTheDev:
Structures from the API cannot be edited directly. To do so, you can create a new structure (a builder) using the
.from()
method
lol no
tried this (probaly wrong):
const { SlashCommandBuilder } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('embed')
.setDescription('Create an embed')
.addStringOption(option =>
option.setName('title')
.setDescription('Title of the embed')
.setRequired(true))
.addStringOption(option =>
option.setName('description')
.setDescription('Description of the embed')
.setRequired(true))
.addStringOption(option =>
option.setName('color')
.setDescription('Color of the embed in HEX format (e.g., #FF0000)')
.setRequired(false)),
async execute(interaction) {
const { options } = interaction;
const title = options.getString('title');
const description = options.getString('description');
const color = options.getString('color');
const embed = new EmbedBuilder().setTitle('embed');
const embed = {
embed.from(embed).setTitle(title)
embed.from(embed).setDescription(description)
color: color ? color.replace('#', '') : '#00FF00' // If color is not provided, use random color
};
await interaction.reply({ embeds: [embed] });
},
};
Please stop guessing, the guide you linked yourself already answers you how to use the EmbedBuilder.