Reputation: 11
Im getting a message that got reacted with a emoji, and want to send it in another channel, but I cant get the embed information from that message reaction.message.embeds
is empty.
Do I need to set some intents to be able to read that data? Like GatewayIntentsBits.MessageContent
for messages
Want to re-send a message with embed to another channel
[EDIT]
When I do some weird shit: reaction.message.channel.messages.fetch(reaction.message.id)
the embeds
tag seems to work, is there any way or reason for that? Or should I use this weird way, can someone explain to me why the first example doesnt work?
Upvotes: 1
Views: 1118
Reputation: 295
In regards of the Intents:
This property requires the GatewayIntentBits.MessageContent privileged intent in a guild for messages that do not mention the client. (https://discord.js.org/#/docs/discord.js/main/class/Message?scrollTo=embeds)
The return is an Array of embeds. Therefore you would need to access it with reaction.message.embeds[0]
for example. Of course if your reaction.message.embeds
is completly empty this would not help.
A good way to check for the information is to console.log(reaction.message)
You can also fetch() the reaction directly to get the full MessageReaction information.
reaction.fetch().then((fetchedReaction) => {
fetchedReaction.message.embeds[0]; //or
fetchedReaction.message.embeds;
});
Your solution
reaction.message.channel.messages.fetch(reaction.message.id)
is indeed the best and correct way if the message may not be in the cache. This way it is still being retrived.
Upvotes: 0