Scenario: I am trying to read various fields in an embed message posted to a sever, do some processing, and log results in a DB.
Once you have your Message
object, check the embeds
property to obtain an array of all MessageEmbeds
contained inside it. You can then read any of the properties, such as description
, fields
, etc.
Here's some example code:
const client = new Discord.Client();
/* client.login, etc. etc. */
client.on('message', (msg) => {
msg.embeds.forEach((embed) => {
// add this embed to the database, using embed.description, embed.fields, etc.
// if there are no embeds, this code won't run.
});
msg.reply("Embed sent!");
});