简体   繁体   中英

Bot sends an empty message when I try to send a RichEmbed

I'm trying to make a discord bot on discord.js. I'm having some trouble with RichEmbed. Here is the code:

if (command === "q") {
  const messageID = args[0];
  console.log("MSG id " + messageID);
  message.channel.fetchMessage(messageID).then(messagea => {
    const reportEmbed = new Discord.RichEmbed()
      .setTitle("Reports")
      .setColor("#F7E533")
      .addField("Message", messagea.content)
      .addField("Reported User", `@${messagea.author}`)
      .addField("Reported By", `${message.author} with ID: ${message.author.id}`)
      .addField("Time", message.createdAt);

    message.channel.send({
      embed: reportEmbed
    });
    console.log(reportEmbed);
    return;
  })
}

The result is this:

机器人发送空消息

Console logs contain the embed requested, but it is not in the message it sends.
What I'm missing?

UPD
Every RichEmbed I try to send is empty. Could it be that my guild requires additional setup?

The issue was in account preferences: discord require links preview to be enabled to show the embed. So choose: preview all links or disable embed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM