Reputation: 25
I'm having some problems with discord embed
I have 3 embeds: embed1, embed2, embed3 but when i try to send an embed with a message with this code: message.channel.send({embed1})
I get this error:
(node:24120) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
Upvotes: 0
Views: 3595
Reputation: 711
This is cause in ES6 without adding the definer in an object. The varible's name is now the definer. Example:
message.channel.send({embed1});
//Get's translated to:
message.channel.send({embed1:embed1});
Since all objects need an definer and a value. ES6 just shortens it.
So your message.channel.send({embed1});
sets the definer to embed1
Which then embed
is undefined, and Discord.js doesn't know where the message is as it looks for the definer embed
not embed1
. Therefore it thinks it has no message or embed to send, Hence the empty message error
To upload your embed with your current code you'll need message.channel.send({embed:embed1});
;
Upvotes: 3