#TypeError: (intermediate value).setColor(...).setTitle(...).setDescription(...).addField is not a fu

13 messages · Page 1 of 1 (latest)

wanton pastureBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • 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
gloomy tiger
#

addField is indeed not a function

#

its addFields

#

with an array of APIEmbedField

nova gobletBOT
candid flower
#

hmmm.... same error :/

candid flower
gloomy tiger
#

also, attachFiles doesnt exist

nova gobletBOT
#

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]
});
candid flower
#

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]});
  },
};```
gloomy tiger
#

yeah thats not how js works

#

I recommend learning js first, #rules 3

#

#resources