javascript - 通过交互发送嵌入
问题描述
我在使用交互命令后尝试发送嵌入,但出现以下错误:
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);
}
我已经读过我需要将它作为一个数组发送,但是我该怎么做呢?提前致谢。
解决方案
快速阅读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] });
}
推荐阅读
- powershell - 杀死 PID 超过阈值
- python - 如何在 Dash 应用程序中按选项卡分隔 Google Analytics
- security - 使用 OMNET++ 在 Fanet 中进行 Sybil 攻击
- python - 不区分大小写的列表过滤器
- javascript - 在圆之间动态创建箭头 (D3)
- sum - 在 2 列上运行余额/总计
- werkzeug - 是否有像 werkzeug 的 ProxyFix 这样的库来修复 request.remote_addr 但适用于 Quart / Hypercorn ASGI 服务器?
- javascript - 如何使用 WebRequest 在 Firefox AddOn 中访问有关请求中每个已加载元素的信息
- ios - 将社交媒体帖子与其他数据类型集成
- java - 在 Java 中使用 Morphia 连接到 mongodb