我想在 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")
关于python - 使用 discord.py 更改角色层次结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58975932/