简体   繁体   English

消息内容必须是非空字符串 MessageEmbed

[英]Message Content Must Be A Non-Empty String MessageEmbed

I've encountered this problem when working with discord.js.我在使用 discord.js 时遇到了这个问题。 It seems that when I try to send a MessageEmbed it throws an error at me saying:似乎当我尝试发送 MessageEmbed 时,它会向我抛出一个错误:

RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string

I've tried turning the MessageEmbed into a string but that doesn't work.我试过将 MessageEmbed 变成一个字符串,但这不起作用。 Im not sure how to tackle or solve this problem我不知道如何解决或解决这个问题

Here is the code that I have这是我的代码

client.on('messageCreate', (message) => {
  const testEmbed = new DiscordJS.MessageEmbed().setTitle('Topic')
  if (message.content === '%topic') {
    message.reply({
      content: testEmbed
    })
  }
})

It should be message.reply({embeds: [testEmbed]})应该是message.reply({embeds: [testEmbed]})

{content: ""} for regular messages only, so it should be: {content: ""}仅用于常规消息,因此应该是:

client.on('messageCreate', (message) => {
const testEmbed = new DiscordJS.MessageEmbed().setTitle('Topic')
if (message.content === '%topic') {
    message.reply({
        embeds: [testEmbed]
    })
   }
})

暂无
暂无

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

相关问题 MessageEmbed 字段值必须是非空字符串 - MessageEmbed field values must be non-empty strings MessageEmbed 字段值必须是非空字符串 gamedig 问题 - MessageEmbed field values must be non-empty strings gamedig problem 错误:RangeError [MESSAGE_CONTENT_TYPE]:消息内容必须是非空字符串 - Error : RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string [Discord.js]MessageEmbed 字段值必须是非空字符串 - [Discord.js]MessageEmbed field values must be non-empty strings Discord.js v13 错误:RangeError [EMBED_FIELD_VALUE]:MessageEmbed 字段值必须是非空字符串 - Discord.js v13 error: RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings Discord bot 无法创建嵌入 RangeError [EMBED_FIELD_VALUE]:MessageEmbed 字段值必须是非空字符串 - Discord bot not able to create the embed RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings ESLint 7.1.0 错误:“模式”必须是非空字符串或非空字符串数组 - ESLint 7.1.0 Error: 'patterns' must be a non-empty string or an array of non-empty strings Firebase错误:提供给sendToDevice()的注册令牌必须是非空字符串或非空数组 - Firebase Error: Registration token(s) provided to sendToDevice() must be a non-empty string or a non-empty array discord.js V.13 嵌入问题 - RangeError [EMBED_FIELD_NAME]:MessageEmbed 字段名称必须是非空字符串。 - 特别是“成员自:”字段 - discord.js V.13 Embed Issue - RangeError [EMBED_FIELD_NAME]: MessageEmbed field names must be non-empty strings. - Specifically "Member Since:" field Firebase Cloud Function错误:提供给sendToDevice()的注册令牌必须是非空字符串或非空数组 - Firebase Cloud Function error: Registration token(s) provided to sendToDevice() must be a non-empty string or a non-empty array
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM