Coding newbies
Coding newbies

Reputation: 15

How to make our bot read other bot embed message

so I am trying to make a companion bot for a bot called "EPIC RPG" it is a game bot and there are some events that I would like my bot to ping a role so people notice there is an event going on but I just can't make my bot read the embed, any ideas?this is the EPIC RPG EVENT

Upvotes: 1

Views: 742

Answers (1)

dropdb
dropdb

Reputation: 656

You can use the Message.embeds. It returns an array of all the embeds in the message. Since a bot can send only 1 embed per messages, message.embeds[0] will return a MessageEmbed object of the embed.

So you can use the following code:

let embed = message.embeds[0];
embed.title // the title of the embed
embed.description // the description of the embed

[EDIT] full code:

client.on('message', message => { 
let embed = message.embeds[0];
if (message.author.id == 'epicrpgbot_id' && embed && embed.fields && embed.fields[0].title == 'IT'S RAINING COINS') {
// replace 'epicrpgbot_id with the bot's id
message.channel.send(`Embed
title: ${embed.title}
description: ${embed.description}
// replace this with the message you want to write 
${client.users.cache.get('bot_id')} // replace 'bot_id' with the epic rpg bot's id.
`);
}
}); 

Upvotes: 1

Related Questions