[英]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.