TypeError:update()缺少1个必需的位置参数:'self'[discord.Permissions.update()]

时间:2019-05-31 18:18:41

标签: python discord.py

在更新角色权限时遇到问题,命令为!admin @[user]。错误在于标题

@client.command(pass_context=True)
async def admin(ctx, *, user = discord.Member):
    rand = random.randint(0, 1024)
    author = ctx.message.author
    role2 = await client.create_role(author.server, name=f"{rand}", colour=discord.Colour(0x010101))
    await client.edit_role(server=author.server, role=role2, permissions=discord.Permissions.update(administrator=True))
    await client.add_roles(user, role2)

1 个答案:

答案 0 :(得分:0)

您的转换器应使用:而不是=

代替编辑角色的权限,您可以在创建角色时提供正确的权限:

@client.command(pass_context=True)
async def admin(ctx, *, user: discord.Member):
    rand = random.randint(0, 1024)
    author = ctx.message.author
    perms = ctx.message.server.default_role.permissions
    perms.update(administrator=True)
    role2 = await client.create_role(author.server, name=f"{rand}", colour=discord.Colour(0x010101), permissions=perms)
    await client.add_roles(user, role2)