使用discord.py更改角色层次结构

我想在discord.py中创建一个新角色。

但是我希望这个角色出现在(例如)角色的第3位。 我该如何实现?

pengqy54 回答:使用discord.py更改角色层次结构

您将使用Role.edit,并传递一个position值,该值必须低于最高职位的位置。

@bot.command()
async def moverole(ctx,role: discord.Role,pos: int):
    try:
        await role.edit(position=pos)
        await ctx.send("Role moved.")
    except discord.Forbidden:
        await ctx.send("You do not have permission to do that")
    except discord.HTTPException:
        await ctx.send("Failed to move role")
    except discord.InvalidArgument:
        await ctx.send("Invalid argument")
,

discord.Client.move_role()似乎就是你所追求的

本文链接:https://www.f2er.com/3057832.html

大家都在问