[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

@ -1047,7 +1047,6 @@ class Mod:
await ctx.send(_("Channel already in ignore list."))
@ignore.command(name="guild", aliases=["server"])
@commands.has_permissions(manage_guild=True)
async def ignore_guild(self, ctx: RedContext):
"""Ignores current guild"""
guild = ctx.guild
@ -1081,7 +1080,6 @@ class Mod:
await ctx.send(_("That channel is not in the ignore list."))
@unignore.command(name="guild", aliases=["server"])
@commands.has_permissions(manage_guild=True)
async def unignore_guild(self, ctx: RedContext):
"""Removes current guild from ignore list"""
guild = ctx.message.guild

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)