如何使用get_reaction_users?

时间:2018-07-02 20:01:33

标签: python python-3.x discord discord.py

if message.content.startswith('!stopafk'):
        await client.send_message(botspam,"y")
        LHss = discord.Reaction("LH:461777566408376321")
        users = await client.get_reaction_users(LHss,limit=100)

我有这段代码,我不知道如何使它工作,我已经尝试了一切,但发现没有任何东西起作用或帮助过 我知道我可能只是愚蠢,但它说"LH....“是2个参数,但事实并非如此。 我已经用<Emote:ID><:Emote:ID><:Emote:#ID#><Emote#ID#>代替了表情符号,但实际上我不知道该怎么做。

1 个答案:

答案 0 :(得分:1)

这花了我比我愿意承认的更长的时间。 这是我在代码中使用的示例:)

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