【问题标题】:Sending an embed through an interaction通过交互发送嵌入
【发布时间】:2021-08-12 01:43:47
【问题描述】:

我在使用交互命令后尝试发送嵌入,但出现以下错误:

throw new DiscordAPIError(data, res.status, request);
          
DiscordAPIError: Cannot send an empty message
if (interaction.commandName == "ping") {
    const exampleEmbed = new MessageEmbed()
        .setColor("#0099ff")
        .setTitle("Pong")
        .setDescription("Some description here");
    interaction.reply(exampleEmbed);
}

我已经读到我需要将它作为一个数组发送,但是我该如何在这里执行呢? 提前致谢。

【问题讨论】:

    标签: javascript node.js discord discord.js


    【解决方案1】:

    在快速阅读Sending messages, embeds, files, etc. 之后,你必须这样做:

    if (interaction.commandName == "ping") {
        const exampleEmbed = new MessageEmbed()
            .setColor("#0099ff")
            .setTitle("Pong")
            .setDescription("Some description here");
        interaction.reply({ embeds: [exampleEmbed] });
    }
    

    【讨论】:

      猜你喜欢
      • 2020-05-31
      • 2021-12-01
      • 2020-04-11
      • 2023-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多