Don't try to remove managed roles (#170)
This commit is contained in:
@@ -72,8 +72,10 @@ class Dungeon(commands.Cog):
|
||||
if not dungeon_role_obj:
|
||||
return await ctx.send("No dungeon role set.")
|
||||
|
||||
#Managed roles CANNOT be removed by the bot.
|
||||
remaining_roles = [r for r in user.roles if r.managed]
|
||||
try:
|
||||
await user.edit(roles=[], reason=f"Removing all roles, {ctx.message.author} is banishing user")
|
||||
await user.edit(roles=remaining_roles, reason=f"Removing all roles, {ctx.message.author} is banishing user")
|
||||
except discord.Forbidden:
|
||||
return await ctx.send(
|
||||
"I need permission to manage roles or the role hierarchy might not allow me to do this. I need a role higher than the person you're trying to banish."
|
||||
|
||||
Reference in New Issue
Block a user