mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[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:
parent
0a0f2a9dcc
commit
4f0043b805
@ -1047,7 +1047,6 @@ class Mod:
|
|||||||
await ctx.send(_("Channel already in ignore list."))
|
await ctx.send(_("Channel already in ignore list."))
|
||||||
|
|
||||||
@ignore.command(name="guild", aliases=["server"])
|
@ignore.command(name="guild", aliases=["server"])
|
||||||
@commands.has_permissions(manage_guild=True)
|
|
||||||
async def ignore_guild(self, ctx: RedContext):
|
async def ignore_guild(self, ctx: RedContext):
|
||||||
"""Ignores current guild"""
|
"""Ignores current guild"""
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
@ -1081,7 +1080,6 @@ class Mod:
|
|||||||
await ctx.send(_("That channel is not in the ignore list."))
|
await ctx.send(_("That channel is not in the ignore list."))
|
||||||
|
|
||||||
@unignore.command(name="guild", aliases=["server"])
|
@unignore.command(name="guild", aliases=["server"])
|
||||||
@commands.has_permissions(manage_guild=True)
|
|
||||||
async def unignore_guild(self, ctx: RedContext):
|
async def unignore_guild(self, ctx: RedContext):
|
||||||
"""Removes current guild from ignore list"""
|
"""Removes current guild from ignore list"""
|
||||||
guild = ctx.message.guild
|
guild = ctx.message.guild
|
||||||
|
|||||||
@ -121,15 +121,13 @@ class RedBase(BotBase, RpcMethodMixin):
|
|||||||
async def is_admin(self, member: discord.Member):
|
async def is_admin(self, member: discord.Member):
|
||||||
"""Checks if a member is an admin of their guild."""
|
"""Checks if a member is an admin of their guild."""
|
||||||
admin_role = await self.db.guild(member.guild).admin_role()
|
admin_role = await self.db.guild(member.guild).admin_role()
|
||||||
return (not admin_role or
|
return any(role.id == admin_role for role in member.roles)
|
||||||
any(role.id == admin_role for role in member.roles))
|
|
||||||
|
|
||||||
async def is_mod(self, member: discord.Member):
|
async def is_mod(self, member: discord.Member):
|
||||||
"""Checks if a member is a mod or admin of their guild."""
|
"""Checks if a member is a mod or admin of their guild."""
|
||||||
mod_role = await self.db.guild(member.guild).mod_role()
|
mod_role = await self.db.guild(member.guild).mod_role()
|
||||||
admin_role = await self.db.guild(member.guild).admin_role()
|
admin_role = await self.db.guild(member.guild).admin_role()
|
||||||
return (not (admin_role or mod_role) or
|
return any(role.id in (mod_role, admin_role) for role in member.roles)
|
||||||
any(role.id in (mod_role, admin_role) for role in member.roles))
|
|
||||||
|
|
||||||
async def get_context(self, message, *, cls=RedContext):
|
async def get_context(self, message, *, cls=RedContext):
|
||||||
return await super().get_context(message, cls=cls)
|
return await super().get_context(message, cls=cls)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user