Z
Z
Zac Rider2020-12-22 20:43:59
Python
Zac Rider, 2020-12-22 20:43:59

How to make the bot reply with a certain message as many times as the number of users click on the emoji?

Good day! Please help me fix the code so that the bot can respond to each user, and not just to the one who called this command

Code:

@bot.command()
async def alive(ctx):
    msg = await ctx.channel.send('are you all right?')
    await msg.add_reaction('✝️')
    await msg.add_reaction('')

    try:
        reaction, user = await bot.wait_for('reaction_add',
                                            check=lambda reaction, user: user == ctx.author and reaction.emoji in ['✝️',
                                                                                                                   ''],
                                            timeout=5.0)

    except asyncio.TimeoutError:
        await ctx.channel.send('too late')

    else:
        if reaction.emoji == '✝️':
            await ctx.channel.send(f'{ctx.author.mention}, 1')

        else:
            await ctx.channel.send(
                f'{ctx.author.mention}, 2')

The problem is that the bot only sends a message to the user who called this command. Also, he responds to the message only once, and then falls silent. Please help me fix this stupid mistake.

PS ---> If anything, the second emoji just didn't load. Any emoji can be there, it doesn't matter

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question