From 971b4a3df23f54d30e116870e9aedf4cfae69a08 Mon Sep 17 00:00:00 2001 From: Flame442 <34169552+Flame442@users.noreply.github.com> Date: Sat, 10 Oct 2020 20:24:20 -0400 Subject: [PATCH] Don't try to remove managed roles (#170) --- dungeon/dungeon.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dungeon/dungeon.py b/dungeon/dungeon.py index 993157a..897a715 100644 --- a/dungeon/dungeon.py +++ b/dungeon/dungeon.py @@ -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."