简体   繁体   English

当我尝试发送RichEmbed时,Bot发送空消息

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

I'm trying to make a discord bot on discord.js. 我正在尝试在discord.js上创建一个discord机器人。 I'm having some trouble with RichEmbed. 我在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 UPD
Every RichEmbed I try to send is empty. 我尝试发送的每个RichEmbed都是空的。 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. 因此,请选择:预览所有链接或禁用嵌入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当机器人在 Teams 中发送消息时,我如何获得通知? - How do I get notifications when a bot sends a message in Teams? Discord-RichEmbed-空消息-音乐的播放命令 - Discord - RichEmbed - Empty Message - Play command for Music Bot 发送嵌入消息但不发送 mp4 附件 - Bot sends embed message but doesn't send mp4 attachment “无法发送空消息”尝试发送表情符号时,我的机器人可以访问 - “Cannot send empty message” When trying to send emojis my bot has access to Discord.js 尝试发送嵌入,但只发送空消息 - Discord.js Trying to send embed, but just sends empty message Discord Bot 发送多条消息,但我只希望它发送一条 - Discord Bot sends multiple messages but I only want it to send one richembed字段可能不是空的错误 - 我该如何解决这个问题? - richembed fields may not be empty error — How would I fix this? 机器人准备就绪后如何在频道中发送消息? - How to a send message in a channel when the bot is ready? 我如何做到这一点,以便如果成员重复我的机器人发送的文本,我的机器人会发回一条消息? - How can I make it so that if a member repeats text sent by my bot, my bot sends a message back? NodeJS discord bot命令出现错误无法发送空消息 - NodeJS discord bot commands getting error Cannot send an empty message
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM