How to get the text of the message to which the person has put a reaction? Is it possible?
@client.event
async def on_raw_reaction_add(payload):
emoji = payload.emoji.name
if emoji == "🎦":
print(msg)
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Yes, payload allows you to get the message ID.
You can then convert this to the message, by getting the channel and then fetching the message. If you don’t want to do this, you should just use the normal reaction add event, which provides the actual message class (but only if the message cached – see here).
@client.event
async def on_raw_reaction_add(payload):
emoji = payload.emoji.name
if emoji == "🎦":
message = await client.get_channel(payload.channel_id).fetch_message(payload.message_id)
print(message.content)
# prints message content, or do whatever you need
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0