类型错误:Discord.MessageEmbed.setDescription 不是构造函数

时间:2021-01-17 18:36:53

标签: node.js discord.js

我正在使用 discord.js 制作一个不和谐的机器人,但在使用该命令时出现错误“TypeError: Discord.MessageEmbed.setDescription is not a constructor”

const Discord = require('discord.js');

module.exports = {
    name: 'stats',
    description: 'Views the bot\'s stats',
    execute(message, args, client) {
        const embed = new Discord.MessageEmbed
        .setDescription(`In ${client.guilds.cache.size} servers`)
        .setTimestamp()
        .setFooter(message.member.user.tag, message.author.avatarURL());
        message.channel.send(embed)
    }
}

1 个答案:

答案 0 :(得分:1)

尝试将
const embed = new Discord.MessageEmbed
更改为
const embed = new Discord.MessageEmbed()