embed don't display in the bot message

Hi everybody, [email protected] node v22.7.0
const { EmbedBuilder, SlashCommandBuilder } = require('discord.js');

const d = new SlashCommandBuilder()
.setName('embed')
.setDescription('tests embed');

module.exports = {
data: d,
async execute(message){
const embed = new EmbedBuilder()
.setTitle("Roll")
.setDescription("un lancer : 4")
.setColor("#00b0f4")
.setTimestamp();
const now = new Date().toISOString().replace('T', ' ');

await message.reply({ content:now, embeds: [embed] })
.then(msg => setTimeout(()=>msg.delete(), 5000));
}
};
const { EmbedBuilder, SlashCommandBuilder } = require('discord.js');

const d = new SlashCommandBuilder()
.setName('embed')
.setDescription('tests embed');

module.exports = {
data: d,
async execute(message){
const embed = new EmbedBuilder()
.setTitle("Roll")
.setDescription("un lancer : 4")
.setColor("#00b0f4")
.setTimestamp();
const now = new Date().toISOString().replace('T', ' ');

await message.reply({ content:now, embeds: [embed] })
.then(msg => setTimeout(()=>msg.delete(), 5000));
}
};
This command dispalys the content but not the embed... No error in log file nor display, just the ignored embed Any idea ?
12 Replies
d.js toolkit
d.js toolkit4mo 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
seishin
seishinOP4mo ago
message is a ChatInputCommandInteraction and it's a slashcommand Bot and Everyone have EmbedLinks permission on guild/category/channel
const { Events } = require('discord.js');

module.exports = {
name: Events.InteractionCreate,
async execute(interaction){
if(!interaction.isChatInputCommand())
return;

const command = interaction.client.commands.get(interaction.commandName);

if(!command){
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}

try{
await command.execute(interaction);
}
catch(error){
console.error(error);
if(interaction.replied || interaction.deferred)
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
else
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
},
};
const { Events } = require('discord.js');

module.exports = {
name: Events.InteractionCreate,
async execute(interaction){
if(!interaction.isChatInputCommand())
return;

const command = interaction.client.commands.get(interaction.commandName);

if(!command){
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}

try{
await command.execute(interaction);
}
catch(error){
console.error(error);
if(interaction.replied || interaction.deferred)
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
else
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
},
};
seishin
seishinOP4mo ago
No description
seishin
seishinOP4mo ago
No description
seishin
seishinOP4mo ago
seishin
seishinOP4mo ago
delete works I can test without delete
console.log(await message.fetchReply({ content:now, embeds: [embed] }));
console.log(await message.fetchReply({ content:now, embeds: [embed] }));
DiscordAPIError[50035]: Invalid Form Body
message_id[NUMBER_TYPE_COERCE]: Value "[object Object]" is not snowflake.
[..]
url: 'https://discord.com/api/v10/webhooks/.../messages/[object Object]'
DiscordAPIError[50035]: Invalid Form Body
message_id[NUMBER_TYPE_COERCE]: Value "[object Object]" is not snowflake.
[..]
url: 'https://discord.com/api/v10/webhooks/.../messages/[object Object]'
JSON.stringify ?
NyR
NyR4mo ago
No... just log it as Qjuh said, don't pass anything to it, preferably in your .then() block
seishin
seishinOP4mo ago
DiscordAPIError[50035]: Invalid Form Body
message_id[NUMBER_TYPE_COERCE]: Value "[object Object]" is not snowflake.
at handleErrors (/app/node_modules/@discordjs/rest/dist/index.js:727:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async SequentialHandler.runRequest (/app/node_modules/@discordjs/rest/dist/index.js:1128:23)
at async SequentialHandler.queueRequest (/app/node_modules/@discordjs/rest/dist/index.js:959:14)
at async _REST.request (/app/node_modules/@discordjs/rest/dist/index.js:1272:22)
at async InteractionWebhook.fetchMessage (/app/node_modules/discord.js/src/structures/Webhook.js:313:18)
at async Object.execute (/app/src/commands/tests/embed.js:17:5)
at async Object.execute (/app/src/events/interactionCreate.js:17:7) {
requestBody: { files: undefined, json: undefined },
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { message_id: [Object] }
},
code: 50035,
status: 400,
method: 'GET',
url: 'https://discord.com/api/v10/webhooks/.../messages/[object Object]'
}
DiscordAPIError[50035]: Invalid Form Body
message_id[NUMBER_TYPE_COERCE]: Value "[object Object]" is not snowflake.
at handleErrors (/app/node_modules/@discordjs/rest/dist/index.js:727:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async SequentialHandler.runRequest (/app/node_modules/@discordjs/rest/dist/index.js:1128:23)
at async SequentialHandler.queueRequest (/app/node_modules/@discordjs/rest/dist/index.js:959:14)
at async _REST.request (/app/node_modules/@discordjs/rest/dist/index.js:1272:22)
at async InteractionWebhook.fetchMessage (/app/node_modules/discord.js/src/structures/Webhook.js:313:18)
at async Object.execute (/app/src/commands/tests/embed.js:17:5)
at async Object.execute (/app/src/events/interactionCreate.js:17:7) {
requestBody: { files: undefined, json: undefined },
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { message_id: [Object] }
},
code: 50035,
status: 400,
method: 'GET',
url: 'https://discord.com/api/v10/webhooks/.../messages/[object Object]'
}
seishin
seishinOP4mo ago
seishin
seishinOP4mo ago
but it don't display
seishin
seishinOP4mo ago
Yes
No description
seishin
seishinOP4mo ago
Last test Discord Stable 329244 It's been at least a year since I had an embed Yes, that was it cool Thanks
Want results from more Discord servers?
Add your server