Reputation: 13
I'm making a discord bot, but I'm getting the error:
Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with
.catch()
. (rejection id: 2).
I know something is wrong, but not sure what is it.
client.on('message', message => {
if (message.content === 's!verifymsg') {
const embed = new RichEmbed()
.setTitle('__**VERIFICACIÓN**__')
.setColor(0xFF0000)
.setDescription('¡Para poder ver los demás canales, es necesario que reacciones para verificar! \n- Reacciona con (✅)')
message.channel.send(embed);
}
});
If you type s!verifymsg it sends an embed in that same channel containing some text in that same embed.
Upvotes: 1
Views: 4025
Reputation: 5097
Looking at this guide (https://anidiots.guide/first-bot/using-embeds-in-messages), shows be that there are a couple things that might be causing it:
1) new RichEmbed()
should probably be new Discord.RichEmbed()
. This is what the discord.js documentation shows.
2) message.channel.send(embed);
should probably be message.channel.send({embed});
.
Upvotes: 1