account for small chance where owner is victim in perm_check
@@ -12,8 +12,14 @@ class Mod(commands.Cog):
self.db = self.bot.get_cog('Database')
async def perm_check(self, author, victim):
- if isinstance(author, discord.Member) and author.id == author.guild.owner.id: return True
+ if isinstance(author, discord.Member):
+ if author.id == author.guild.owner.id:
+ return True
+ elif victim.id == author.guild.owner.id:
+ return False
+
guild_roles = author.guild.roles
+
return guild_roles.index(author.top_role) > guild_roles.index(victim.top_role) and not victim.id == author.guild.owner.id
@commands.command(name='purge', aliases=['p'])
