尝试构建嵌入时“未定义丰富”

时间:2019-04-20 15:34:16

标签: javascript node.js discord.js

我做了这样的代码来为我的Discord机器人建立一个嵌入,但似乎不起作用:

client.on('message', message => {
  // Ignore messages that aren't from a guild
  if (!message.guild) return;

  if (message.content.startsWith('$Commands')) {
    let Embed = new Rich.Embed;
    let Message = message.guild;
    let botEmbed = new Discord.RichEmbed()
      .setTitle("Commands From TTB")
      .setDescription("**Commands :**")
      .setColor("#4dff077")
      .setAuthorName("Galak$y#3038")
      .setAvatar("https://cdn.discordapp.com/avatars/563449221701959700/8386d5fe48d71898c40244e7a5a66d58.png")
      .addField("1. *Ban* = *Bans User Mentioned After Command* ``$ban <Mention User>``")
      .addField("2. Kick = Kicks User Mentioned After Command ``$kick <Mention User>``")
      .addField("3. what is myavatar = ``$what is my avatar``")
      .addFooter("New Commands Coming Soon...")
    return;
    message.channel.send(botEmbed)
  }
});

这是错误:
"Rich is not defined

1 个答案:

答案 0 :(得分:2)

嵌入是使用RichEmbed类构造函数创建的,如下所示:

let embed = new Discord.RichEmbed()

当您声明Embed时,您正在使用Rich.Embed,并且它说Rich是未定义的。