Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  2] [ 1]  / answers: 1 / hits: 17274  / 4 Years ago, sat, march 14, 2020, 12:00:00

I am trying to print get embed message in discord, but this happens:




TypeError: Discord.RichEmbed is not a constructor




Here is my code:



const Discord = require('discord.js');
const bot = new Discord.Client();
const token = 'mytokenhere';
const prefix = '!';

bot.on('ready', () => {
console.log('This bot is online!');
});

bot.on('message', message => {
let args = message.content.substring(prefix.length).split( );

switch(args[0]) {
case 'pomoc':
message.channel.send('.')
break;
case 'cc':
if(!args[1]) return message.reply('Podaj 2 argument! (liczbe wiadomosci do skasowania)')
message.channel.bulkDelete(args[1]);
break;
case 'embed':
var embed = new Discord.RichEmbed()
.setAuthor(message.author.username)
.setDescription(Usuario rikolino.)
.setColor(#3535353)
.addField(Usuario, '${message.author.username}#${message.author.discriminator}')
.addField(ID, message.author.id)
.addField(Creación, message.author.createdAt);

message.channel.send({embed});
break;
}
});

bot.login(token);


I tried many other solutions, but the result is always the same, I really don't know where the problem is.


More From » discord

 Answers
34

Discord.js


discord.js have update new Discord.MessageEmbed() from new Discord.RichEmbed()


const embed = new Discord.MessageEmbed()
.setAuthor(message.author.username)
.setDescription("Usuario rikolino.")
.setColor("#3535353")
.addField("Usuario", '${message.author.username}#${message.author.discriminator}')
.addField("ID", message.author.id)
.addField("Creación", message.author.createdAt);

message.channel.send(embed);

[#51136] Friday, February 28, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
stefanicarolinat

Total Points: 145
Total Questions: 91
Total Answers: 93

Location: Cambodia
Member since Thu, Oct 7, 2021
3 Years ago
stefanicarolinat questions
Mon, Nov 15, 21, 00:00, 3 Years ago
Fri, Apr 16, 21, 00:00, 3 Years ago
Thu, Oct 15, 20, 00:00, 4 Years ago
Fri, Jul 17, 20, 00:00, 4 Years ago
;