I want to create a new role in discord.py.
But I want this role to be in the (let's say) 3rd spot of the roles. How can I achieve this?
You would use Role.edit
, passing a position
value, which must be lower than the position of your highest role.
@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")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With