Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

discord bot embed code DiscordAPIError problem

im nemson

i have a problem with my embed code
this is the code i have for the embed

  if (message.content === prefix + "help") {
    const embed = new MessageEmbed()
      .setTitle("Commandes")
      .setColor("#0099ff")
      .setDescription(
        "**-help** : Affiche les commandes du bot\n" +
        "**-ping** : Affiche le ping du bot\n" +
        "**-cat** : Affiche une image de chat\n" +
        "**-dog** : Affiche une image de chien\n" +
        "**-gif** : Affiche un gif random\n" +
        "**-anime** : Affiche un gif d'anime\n" 
      )
      .setFooter("Bot de test")
      .setTimestamp();
    message.channel.send(embed);
  }
});

but the problem is that wen i run the comand i get this error ant i dont know how to solv it
Uncaught DiscordAPIError DiscordAPIError: Cannot send an empty message
at DiscordAPIError (c:\Users\user\Documents\receptionist\node_modules\discord.js\src\rest\DiscordAPIError.js:9:5)
at execute (c:\Users\user\Documents\receptionist\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

thx for your help

>Solution :

When you use message.channel.send(embed), discord.js thinks that the embed variable is a string and when it finds out that it isn’t, it raises an error. To fix it, all you have to do is change it to:
message.channel.send({ embeds: })

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading