Discord.py: No reactions in Message.reactions

Created on 20 Oct 2017  路  3Comments  路  Source: Rapptz/discord.py

The bot sends a message to the channel and then waits for user's reaction (it should).
It reacts to it's own message, like this:


Anyway, when I check the Message.reactions list, it's empty.
Here goes the code:

python botmsg = await bot.send_message(msg.message.channel,'Are you sure?') await bot.add_reaction(botmsg,'馃憥') await bot.add_reaction(botmsg,'馃憤') await asyncio.sleep(5) for item in botmsg.reactions: print(item)

Most helpful comment

This is because the message returned by bot.send_message is a temporary that is not the message that is in the cache. Only the message in the cache has reactions updated.

You will need to wait 0-1s for the msg to arrive via websocket, then grab the message from the cache.

e.g. cache_msg = discord.utils.get(bot.messages, id=botmsg.id)
then use cache_msg.reactions

All 3 comments

This is because the message returned by bot.send_message is a temporary that is not the message that is in the cache. Only the message in the cache has reactions updated.

You will need to wait 0-1s for the msg to arrive via websocket, then grab the message from the cache.

e.g. cache_msg = discord.utils.get(bot.messages, id=botmsg.id)
then use cache_msg.reactions

That worked! Thanks.

By the way, what if I am using rewrite? Client.messages was removed from there.
Edit:
I understood, there is now Context.get_message().

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Shea4 picture Shea4  路  21Comments

rektile picture rektile  路  18Comments

pappabewar picture pappabewar  路  26Comments

Yuvira picture Yuvira  路  18Comments

ThePiGuy24 picture ThePiGuy24  路  17Comments