简体   繁体   中英

Discord.RichEmbed is not a constructor

When I replace Discord.RichEmbed() to MessageEmbed it is always an error...

When I write MessageEmbed, VSC sends me: MessageEmbed is not defined .

When I write Discord.RichEmbed(), VSC sends me: Discord.RichEmbed() is not a constructor .

message.guild.channels.create(channelName, { parent: SupportCategory.id, topic: `Ticket Owner :${message.author.id}` }).then(c => {
        const sr = message.guild.roles.cache.get(supportrole)
        const everyone = message.guild.roles.cache.find(role => role.name === "@everyone")
        c.updateOverwrite(sr, {
            SEND_MESSAGES: true,
            VIEW_CHANNEL: true,
        });
        c.updateOverwrite(everyone, {
            SEND_MESSAGES: false,
            VIEW_CHANNEL: false,
        });
        c.updateOverwrite(message.author, {
            SEND_MESSAGES: true,
            VIEW_CHANNEL: true,
        });
        let CreateTicketEmbed = new Discord.RichEmbed()
            .setColor('#303136')
            .setTitle('Nouveau ticket !')
            .setDescription(`<@${message.author.id}> ton ticket est <#${c.id}> ! Merci de patienter le temps que le staf te prenne en charge.`)
            .setTimestamp()
            .setFooter("par ❝ Ɔ 𝔞𝔪𝔦𝔩𝔩𝔢 🍭.#7124")
            message.channel.send(CreatedTicketEmbed)
            let GreetEmbed = new Discord.RichEmbed()
            .setColor('#303136')
            .addField(`New Support Ticket`, `<@${message.author.id}> ton ticket est <#${c.id}> ! Merci de patienter le temps que le staf te prenne en charge.`)
            .setTimestamp()
            .setFooter("par ❝ Ɔ 𝔞𝔪𝔦𝔩𝔩𝔢 🍭.#7124")
            c.send(GreetEmbed)
    }).catch(console.error);
}),

In the not-so-new discord.js version 12, RichEmbed has been merged with MessageEmbed. You should use the MessageEmbed constructor instead.

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