【发布时间】:2020-04-08 12:43:43
【问题描述】:
我整天都在寻找这个,我似乎找不到为成员分配角色的正确方法。我尝试了几种分配角色的方法:
@client.command(pass_context=True)
async def claimrank(ctx, role: discord.Role):
user = ctx.message.author
await user.add_roles(role='Rookie')
和:
@client.command()
async def claimrank(member):
role = get(member.guild.roles, name="Rookie")
await member.add_roles(role)
更糟糕的是,通过这两种尝试,我都没有收到任何错误,但代码没有做任何事情。 请帮忙! 提前致谢。
【问题讨论】:
标签: python python-3.x discord.py discord.py-rewrite