Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
discord.js-commando类型错误:RichEmbed不是构造函数_Discord.js - Fatal编程技术网

discord.js-commando类型错误:RichEmbed不是构造函数

discord.js-commando类型错误:RichEmbed不是构造函数,discord.js,Discord.js,我想用discord.js-commando发送embed,但当我发送命令时,它会告诉我: 运行命令时出错:TypeError:RichEmbed不是构造函数 你不应该收到这样的错误 这是我的密码 const { Command } = require('discord.js-commando'); const { RichEmbed } = require('discord.js'); module.exports = class EmbedCommand extends Command {

我想用discord.js-commando发送embed,但当我发送命令时,它会告诉我:

运行命令时出错:TypeError:RichEmbed不是构造函数 你不应该收到这样的错误

这是我的密码

const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');

module.exports = class EmbedCommand extends Command {
    constructor(client) {
        super(client, {
            name: 'embed',
            group: 'util',
            memberName: 'embed',
            description: 'Embeds the text you provide.',
            examples: ['embed Embeds are cool.'],
            args: [
                {
                    key: 'text',
                    prompt: 'What text would you like the bot to embed?',
                    type: 'string'
                }
            ]
        });    
    }

    run(msg, args) {
        const { text } = args;
        const embed = new RichEmbed()
            .setDescription(text)
            .setAuthor(msg.author.username, msg.author.displayAvatarURL)
            .setColor(0x00AE86)
            .setTimestamp();
        return msg.embed(embed);
    }
};

RichEmbed在最新版本中称为MessageEmbed。重命名它应该没问题。

如果您使用的是discord.js v12+它是
discord.MessageEmbed()