discord bot 嵌入代码 DiscordAPIError 问题

discord bot embed code DiscordAPIError problem

我是内姆森

我的嵌入代码有问题 这是我的嵌入代码

  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);
  }
});

但问题是我 运行 的命令我得到这个错误蚂蚁我不知道如何解决它 未捕获的 DiscordAPIError DiscordAPIError:无法发送空消息 在 DiscordAPIError (c:\Users\user\Documents\receptionist\node_modules\discord.js\src\rest\DiscordAPIError.js:9:5) 在执行时(c:\Users\user\Documents\receptionist\node_modules\discord.js\src\rest\RequestHandler.js:350:13) 在 processTicksAndRejections(节点:internal/process/task_queues:96:5)

谢谢你的帮助

当您使用 message.channel.send(embed) 时,discord.js 认为嵌入变量是一个字符串,当它发现它不是时,它会引发错误。要修复它,您所要做的就是将其更改为: message.channel.send({ embeds: [embed]})