我如何检测对我的帮助命令的反应 discord.py

How can i detect reactions for my help command discord.py

这是我的主要帮助命令:

@client.command(pass_context=True)
async def help(ctx):
    embed = discord.Embed(colour=discord.Colour.blurple())

    embed=discord.Embed(title="", description="This is a list of everything Otay! can do! If you need additional help with Otay! join the support server at `-support`", color=0x7289da)
    embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/776181059757932615/784819540496351233/otay2.png")
    embed.add_field(name='***:tada: Fun*** `-helpfun`', value='`level`, `8ball`, `coinflip`, `dice`', inline=False)
    embed.add_field(name='***:hammer_pick: Moderation*** `-helpmoderation`', value='`kick`, `ban`, `unban`, `nick`, `purge`, `slowmode`', inline=False)
    embed.add_field(name='***:warning: Setup*** `-setup`', value='`setup`, `changeprefix`, `welcome`', inline=False)
    embed.add_field(name='*** Giveaway*** `-helpgiveaway`', value='`gstart [minutes] [prize]`')
    embed.add_field(name='***:camera: Images*** `-helpimages`', value='`cat`, `dog`, `meme`', inline=False)
    embed.add_field(name='***:regional_indicator_i: Utilities*** `-helputilities`', value='`avatar`, `ping`, `poll`, `serverinfo`, `bitcoin`', inline=False)
    embed.add_field(name='***:link: Links***', value='[Invite](https://discord.com/oauth2/authorize?client_id=774687442895765535&scope=bot&permissions=-9) | [Support](https://discord.gg/452j64SdQt) | [Vote](https://top.gg/bot/774687442895765535/vote) | [Patreon](https://www.patreon.com/otay?fan_landing=true)')
    embed.set_footer(icon_url=f"https://cdn.discordapp.com/attachments/776181059757932615/784819540496351233/otay2.png", text=ctx.author)
    embed.timestamp = datetime.datetime.now()

    await ctx.send(embed=embed)

我想要它,以便它添加相应的表情符号,如果您按下表情符号,它会发送 the additional information embed。我知道如何添加反应,但我不知道如何“检测”它们。我在文档上找到了这个,但我仍然不知道我该怎么做

@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('')

wait_for 函数本质上是在等待调用某个事件。

第一个参数是一个要等待的事件,它可以是一个 on_message 事件,on_reaction_add 甚至 on_member_join,你传递它时没有 on_

check参数是returnsTrueFalse,wait_for只有check func [=35]才会结束的函数=] True

超时就是这样,会等待一定的时间,等到结束了,就会抛出asyncio.TimeoutError

代码解释如下

@client.command()
async def foo(ctx):
    # Here I'm assigning a message I'll send to later check if the reaction was added in it
    message = await ctx.send('Give me that  reaction, mate')

    def check(reaction, user):
        """ Note: the arguments passed here are the same as in the event, 
        in `on_message` it's going to be `message`, 
        in `on_member_join` is going to be `member`

        This returns `True` if the message where the reaction was added was the one sent before
        if the reaction added was ``
        and if the user that reacted is the one that invoked the command

        Another way to write would be like so:
        if reaction.message == message:
            if str(reaction) == '':
                if user == ctx.author:
                    return True

        return False
        """
        return reaction.message == message and str(reaction) == '' and user == ctx.author
    try:
        # Waiting for a reaction
        reaction, user = await client.wait_for('reaction_add', check=check, timeout=60.0)
        await ctx.channel.send('')
    except asyncio.TimeoutError:
        # Will send `` if the timeout is over
        await ctx.send('')

编辑

reaction, user = await client.wait_for('reaction_add', check=check, timeout=60.0)

if str(reaction) == '':
    # send some embed
elif str(reaction) == '':
    # send some other embed