【问题标题】:Discord bot message is not embeddedDiscord 机器人消息未嵌入
【发布时间】:2021-09-29 13:31:47
【问题描述】:

使用以下代码:

        message.reply('some reply', { embed: {
            color: 3447003,
            description: "A very simple Embed!"
          }
        });
    }

我的机器人响应看起来像一条普通消息。我查了几个关于这个主题的教程。没人能帮上忙。我也试过message.sendmessage.channel.send。相同/相似的结果。 我的目标是像这里显示的那样: https://discordjs.guide/popular-topics/embeds.html#embed-preview

【问题讨论】:

  • 你在使用 Discord V13 吗?
  • 我使用 13.1.0。我的服务器设置会禁用它吗?
  • 对不起,我指的是 Discord.js 的版本,而不是 Discord 本身哈哈

标签: javascript node.js discord discord.js


【解决方案1】:

Message.replyTextChannel.sendMessage.edit 现在只接受一个参数。将其更改为此将起作用:

message.reply({
  content: 'some reply', 
  embeds: [{
    color: 3447003,
    description: "A very simple Embed!"
  }]
});

【讨论】:

  • 刚刚测试过,参数embed 似乎不起作用。如果你这样做 embeds (Array) 它可以工作。
  • 是的,我的错,我没注意到,我只是复制粘贴
  • 没问题,干杯! ^^.
  • 感谢您的回复。我仍然收到DiscordAPIError: Cannot send an empty message
  • 这很好,只是你的代码有问题
【解决方案2】:

Discord.js V13 开始,您必须像这样将嵌入传递给 .send()/ .reply() 等函数:

const embed = {
   color: 3447003,
   description: "A very simple Embed!"
}

message.reply({ content: "Your content", embeds: [embed] })

// Or ...

message.channel.send({ content: "Your content", embeds: [embed] })

【讨论】:

  • 你的意思是message.channel.send?
  • 哦,哎呀,是的..谢谢
  • message.channel.send 一起使用。最后!谢谢大家。
猜你喜欢
  • 2021-01-12
  • 2019-09-16
  • 2021-07-20
  • 2020-08-24
  • 2020-07-04
  • 2020-07-18
  • 2021-04-21
  • 2017-11-02
  • 2021-08-19
相关资源
最近更新 更多