简体   繁体   English

发送嵌入 discord.js 时的错误消息

[英]Error message when sending embed discord.js

here is my code:这是我的代码:

client.on('messageCreate', async(msg) => {
if (msg.content.startsWith('do avatar')) {
const user = msg.mentions.users.first() || msg.author;
const avatarEmbed = new discord_js_1.MessageEmbed()
  .setColor(0x333333)
  .setTitle(`${user.username}'s Avatar`)
  .setImage(`https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png?size=256`
  );
msg.channel.send({ embed: [avatarEmbed] });
}
  });

and here is my error:这是我的错误:

DiscordAPIError: Cannot send an empty message

what am i doing wrong?我究竟做错了什么?

you have are using embed property while sending the message, that doesn't exist.您在发送消息时使用了embed属性,该属性不存在。 It should be embed s应该是嵌入

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM