如何制作发送嵌入频道的命令

时间:2021-07-15 07:07:59

标签: node.js discord discord.js bots

我正在使用库 discord.js 开发私人不和谐机器人。我目前正在使用 replit.com 来编辑和托管机器人。我刚刚创建了一个新命令,它应该在特定频道中发送一个嵌入。我试图做到,但是当我运行它时,它给出了这个错误:

[FATAL] Possibly Unhandled Rejection at: Promise  Promise {
  <rejected> TypeError: Discord.MesageEmbed is not a constructor
      at Object.run (/home/runner/PrivateBo/Commands/Utility/welcome.js:8:17)
      at Client.<anonymous> (/home/runner/PrivateBot/welcome.js:107:13)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at runNextTicks (internal/process/task_queues.js:66:3)
      at processImmediate (internal/timers.js:434:9)
}  reason:  Discord.MesageEmbed is not a constructor

这是我的文件的样子:

const Discord = require('discord.js');
const client = new Discord.Client();

module.exports = {
    name: "welcome",
    description: "welcomes a user",
    run: async (client, message, args) => {
    const member = message.mentions.members.first();
    let embed = new Discord.MesageEmbed()
    .setAuthor("Welcome")
    .setColor("RANDOM")
    .setDescription("Welcome member to the server! Please read <#placeholder> and chill here!")
    .setFooter("Regards, Staff Team")
  messaeg.channel.send(embed)
  }
}

1 个答案:

答案 0 :(得分:2)

修正 new Discord.MesageEmbed() 中的拼写错误。

应该是Discord.MessageEmbed()