You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Discord.js开发Roblox验证Bot时出现Cannot send empty message报错求助

修复方案

核心错误原因

你遇到的Cannot send an empty message报错由两个代码问题共同导致:

  1. 你使用的discord.js v13及以上版本,不再支持直接将Embed实例作为channel.send()的参数传递,必须将Embed放入配置对象的embeds数组中
  2. sendVerificationMessage函数中存在拼写错误,new Discord.Message.Embed()多写了一个.,导致Embed实例创建失败,值为undefined

修复步骤

  • 第一步:修正sendVerificationMessage函数
function sendVerificationMessage(Title, Description, Color) {
  // 修正Embed构造函数的拼写错误
  const Embed = new Discord.MessageEmbed()
    .setAuthor('Exo Game Studios Verification')
    .setTitle(Title)
    .setDescription(Description)
    .setColor(Color)
    .setFooter('This prompt will cancel in 2 minutes.')
    .setTimestamp()
  // 按v13+规范传递embed参数
  message.channel.send({embeds: [Embed]});
}
  • 第二步:修正所有发送Embed的代码
    将你代码中message.channel.send(embed);改为:
message.channel.send({embeds: [embed]});
  • 第三步:修复弃用警告
    找到项目入口文件(通常为index.js)中监听message事件的代码:
client.on('message', ...)

将事件名改为messageCreate即可:

client.on('messageCreate', ...)

内容的提问来源于stack exchange,提问作者ItsCookie

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.03 08:39:03