Discord.py查找谁对邮件做出了反应

时间:2020-09-09 21:54:00

标签: python discord.py discord.py-rewrite

我正在编码一个不和谐的机器人并创建一个游戏。我需要让对消息做出反应的用户使用特定的表情符号添加到列表中。我该怎么办?

(下面是我的代码)

@client.command(aliases=['rr'])
async def roletarussa(ctx):
    embed = discord.Embed(title="ROLETA RUSSA", description="Reaja com ✅ para participar!")
    embed.set_thumbnail(
        url="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRa7rdwxpSOiReyDvnVd6MzqDg33rtQrxhoUw&usqp=CAU")
    embed.add_field(name="Só os brabo consegue entrar nesse web desafio ??",
                    value="Vai logo entra nesse bagaça medroso!", inline=False)
    embed.set_image(url='https://media1.tenor.com/images/64e0334d77b0976b808147bd160b8534/tenor.gif?itemid=12379724')
    message = await ctx.send(embed=embed)

    await message.add_reaction("✅")

    def check(reaction, user):
        return user == ctx.author and str(reaction.emoji) in ['✅']
       

    while True:
        try:

            reaction, user = await client.wait_for("reaction_add", timeout=60, check=check)
           

            if str(reaction.emoji) == "✅":
                await ctx.send('{} vai participar'.format(user))
                await message.remove_reaction(reaction, user)

            else:
                await message.remove_reaction(reaction, user)
                
        except asyncio.TimeoutError:
            await message.delete()
            break
            # ending the loop if user doesn't react after x seconds

        @client.command()
        async def startrr(ctx):
            players = []
            maxlenght = 6
            while len(players) < maxlenght:
                rrp = ctx.message.author.mention
                players.append(rrp)
                players = list(set(players))
            else:
                await ctx.send('Sem mais vagas para o jogo.')
            await ctx.send(players)

我需要让谁对味精做出反应并将其存储在“玩家”列表中。

0 个答案:

没有答案