Don't try to remove managed roles (#170)

This commit is contained in:
Flame442
2020-10-10 20:24:20 -04:00
committed by GitHub
parent 586020bc6c
commit 971b4a3df2

View File

@@ -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."