如果用户在一条特殊的消息中添加反应:HotS_Tank:
,bot将需要将此角色授予用户,但我不知道如何做。。。在
这就是我所尝试的:
async def role_background_task():
await client.wait_until_ready()
roleChannel = discord.Object(id='411270826374070293')
roleMSG1 = client.get_message(roleChannel, id='411657109860515840')
roleMSG2 = client.get_message(roleChannel, id='411657144488689674')
while not client.is_closed:
reac1 = await client.wait_for_reaction(emoji=':HotS_Tank:411445724287598592',message=roleMSG1)
if reac1.reaction.emoji == ':HotS_Tank:411445724287598592':
await client.add_roles(reac1.user, roleHOTS_Tank)
client.loop.create_task(role_background_task())
如果您查看文档,会发现一个名为
on_reaction_add
here的事件。你可以简单地使用它。在相关问题 更多 >
编程相关推荐