Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
557 views
in Technique[技术] by (71.8m points)

python - How to get the list of members that reacted to a message in discord.py?

I just couldn't find a way to do it in discord.py. Reaction doesn't include members.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think I answered in your last post, but to those who did not see it. Here is a snippet from my own bot that implements it. :)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...