如何获取对discord.py中的消息作出反应的成员列表?

问题描述 投票:1回答:2

我在discord.py中找不到办法。 Reaction不包括成员。

python python-3.x discord discord.py
2个回答
0
投票

实际上有一个叫做get_reaction_users的协程


0
投票

我想我在你的上一篇文章中回答,但对那些没有看到它的人回答。这是我自己的机器人实现它的片段。 :)

@client.command(pass_context = True)
async def test(ctx):

    msg = await client.say('TEST')
    await client.add_reaction(msg, "✅")
    await asyncio.sleep(5)

    cache_msg = discord.utils.get(client.messages, id = msg.id)
    for reactor in cache_msg.reactions:
        reactors = await client.get_reaction_users(reactor)

        #from here you can do whatever you need with the member objects
        for member in reactors:
            await client.say(member.name)
© www.soinside.com 2019 - 2024. All rights reserved.