Have two users challenge each other using reactions discord.py

Your code fragment is huge & in another language so I can’t help you directly (as I have no idea what’s going on), but this is how to use wait_for with reactions:

@client.event
async def on_message(message):
    if message.content.startswith('$thumb'):
        channel = message.channel
        await channel.send('Send me that 👍 reaction, mate')

        def check(reaction, user):
            return user == message.author and str(reaction.emoji) == '👍'

        try:
            reaction, user = await client.wait_for('reaction_add', timeout=60.0, check=check)
        except asyncio.TimeoutError:
            await channel.send('👎')
        else:
            await channel.send('👍')

Fragment taken out of the API Docs for wait_for, shows how to wait for a 👍 reaction & do something with it. In case the user doesn’t add the reaction within the timeout (here 60 seconds), it will throw a TimeoutError and send 👎. You can modify this to fit your needs & put it in your command where it fits.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top