[V3 Mod] fix some issues relating to ignore (#1166)

* [V3 Mod] remove unnecessary decos from ignore/unignore

* [V3 Core] fix is_mod and is_admin so they don't return True if the mod/admin roles aren't set
This commit is contained in:
palmtree5
2017-12-12 16:31:12 -09:00
committed by Will
parent 0a0f2a9dcc
commit 4f0043b805
2 changed files with 2 additions and 6 deletions

View File

@@ -121,15 +121,13 @@ class RedBase(BotBase, RpcMethodMixin):
async def is_admin(self, member: discord.Member):
"""Checks if a member is an admin of their guild."""
admin_role = await self.db.guild(member.guild).admin_role()
return (not admin_role or
any(role.id == admin_role for role in member.roles))
return any(role.id == admin_role for role in member.roles)
async def is_mod(self, member: discord.Member):
"""Checks if a member is a mod or admin of their guild."""
mod_role = await self.db.guild(member.guild).mod_role()
admin_role = await self.db.guild(member.guild).admin_role()
return (not (admin_role or mod_role) or
any(role.id in (mod_role, admin_role) for role in member.roles))
return any(role.id in (mod_role, admin_role) for role in member.roles)
async def get_context(self, message, *, cls=RedContext):
return await super().get_context(message, cls=cls)