我在 discord.py 中创建“添加角色”命令时遇到问题。我不知道出了什么问题;它只是不起作用。
@client.command()
@commands.has_role("Admin")
async def addrole(ctx):
user = ctx.message.author
role = discord.utils.get(user.server.roles, name="Test")
await client.add_roles(user, role)
Run Code Online (Sandbox Code Playgroud)