#reactions

1 messages · Page 1 of 1 (latest)

cyan rose
#

im trying make code that will do something after ONE DEFINED USER react on message

   def check2(m):
            m.on_reaction_add('1️⃣', m.user_id)
            return ..
        await msg.add_reaction('1️⃣')
        await msg.add_reaction("2️⃣")
        await msg.add_reaction("3️⃣")
        await msg.add_reaction("4️⃣")
        await msg.add_reaction("5️⃣")
        await msg.add_reaction("6️⃣")
        await msg.add_reaction("7️⃣")
        await msg.add_reaction("8️⃣")
        await inter.bot.wait_for("raw_reaction_add", check=check2)```
but i cant rly understand how to do it correctly
woven dew
stoic siren
#

What?

cyan rose
#

-d on_reactions_add

fiery rootBOT
#

disnake.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://docs.disnake.dev/page/api.html#disnake.on_message_edit "disnake.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://docs.disnake.dev/page/api.html#disnake.on_raw_reaction_add "disnake.on_raw_reaction_add") instead.

Note

To get the [`Message`](https://docs.disnake.dev/page/api.html#disnake.Message "disnake.Message") being reacted, access it via [`Reaction.message`](https://docs.disnake.dev/page/api.html#disnake.Reaction.message "disnake.Reaction.message").

This requires [`Intents.reactions`](https://docs.disnake.dev/page/api.html#disnake.Intents.reactions "disnake.Intents.reactions") to be enabled.

Note

This doesn’t require [`Intents.members`](https://docs.disnake.dev/page/api.html#disnake.Intents.members "disnake.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message it’s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://docs.disnake.dev/page/api.html#disnake.on_raw_reaction_add "disnake.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
stoic siren
#

Yes. So, the wait_for will give you the reaction and the user values

#

And the check is only to return True/False for whether the wait_for should continue waiting or not

woven dew
#

I know that you're going to listen for this reactons again and again and again with different users (you mentioned it in vc), so I recommend you to use views insted

stoic siren
#

but you probably should use a listener rather than bot.wait_for

woven dew
#

-d disnake.ui.View

fiery rootBOT
#

class disnake.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

Alternatively, components can be handled with [`disnake.ui.ActionRow`](https://docs.disnake.dev/page/api.html#disnake.ui.ActionRow "disnake.ui.ActionRow")s and event listeners for a more low-level approach. Relevant events are [`disnake.on_button_click()`](https://docs.disnake.dev/page/api.html#disnake.on_button_click "disnake.on_button_click"), [`disnake.on_dropdown()`](https://docs.disnake.dev/page/api.html#disnake.on_dropdown "disnake.on_dropdown"), and the more generic [`disnake.on_message_interaction()`](https://docs.disnake.dev/page/api.html#disnake.on_message_interaction "disnake.on_message_interaction").

New in version 2.0.
stoic siren
#

They're using reactions for something.. views won't help

cyan rose
#

yes, im really stuck, because i understand what i ave to do, but still cant find the way, i will tr u both: listener and view, but i spend for about 4 hours with this simple issue

#

btw i just have to understand what user react and if the user that i need will react i have to do next step

stoic siren
#

Use a listener. on_raw_reaction_add()