【发布时间】:2018-07-20 21:40:11
【问题描述】:
如果用户在特殊消息中添加反应:HotS_Tank:,机器人将需要将此角色分配给用户,但我不知道该怎么做...
这就是我尝试过的:
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())
【问题讨论】:
标签: python python-3.x discord discord.py