- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- 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
#TypeError: (intermediate value).setColor(...).setTitle(...).setDescription(...).addField is not a fu
13 messages · Page 1 of 1 (latest)
hmmm.... same error :/
Ah ok, I'm looking this..
also, attachFiles doesnt exist
Files in embeds should be attached via the message option object and referenced in the embed:
const attachment = new AttachmentBuilder('./image.png', { name: 'image1.png' });
const embed = new EmbedBuilder()
.setTitle('Attachments')
.setImage(`attachment://${attachment.name}`);
channel.send({
embeds: [embed],
files: [attachment]
});
I'm sorry, I'm having trouble understanding the issue because I'm new to coding and I don't really speak English...
Now I'm getting an error saying 'ReferenceError: color is not defined'.
name: 'recette',
description: 'Propose une recette antillaise ou d\'autres département d\'outre-mer.',
execute(message, args) {
const randomRecette = recettes[Math.floor(Math.random() * recettes.length)];
const embed = new EmbedBuilder()
color("#FFFFFF")
title(randomRecette.nom)
description(randomRecette.description)
fields(
{ name: 'Ingrédients', value: randomRecette.ingredients.join('\n') },
{ name: 'Instructions', value: randomRecette.instructions.join('\n') }
)
files([path.resolve(__dirname, 'images', randomRecette.image)])
image(`attachment://${randomRecette.image}`);
message.channel.send({embeds: [embed]});
},
};```
v10: APIEmbedField