user9840885
user9840885

Reputation:

discord.py waiting for multiple reactions

I am trying to make the bot say something for every green check mark reaction added. I have got the bot waiting for reactions however it only allows one reaction from one user where I want it for a reaction added it will do something current code;

    @commands.command(pass_context=True)
    async def br(self, ctx):
        msg = await self.Nao.say('Please the reaction I have added.')
        await self.Nao.add_reaction(msg, '✅')
        res = await self.Nao.wait_for_reaction('✅')

However I want it to to allow multiple reactions instead of one user. So for every reaction added it will say {USER.MENTION} added a reaction!

Upvotes: 0

Views: 5168

Answers (1)

Patrick Haugh
Patrick Haugh

Reputation: 60974

You need to put the wait_for_reaction in a loop, so it can repeat. I also added a check to keep the bot from acknowledging its own reactions.

check = lambda reaction, user: client.user != user
while True:
    res = await self.Nao.wait_for_reaction(emoji='\N{WHITE HEAVY CHECK MARK}', message=msg, check=check)
    if res:
        await self.Nao.say(f"{res.user.mention} added a reaction!")

Upvotes: 2

Related Questions