简体   繁体   中英

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. It should be embed s

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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