mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 10:17:59 -05:00
[Core] Multiple mod admin roles (#2783)
* Adds Schema versioning - Adds Migration tool - Adds tool to migrate to allow multiple admin and mod roles - Supports Multiple mod and admin roles * Ensures migration is run prior to cog load and connection to discord * Updates to not rely on singular mod/admin role id * Update requires logic for multiple mod/admin roles * Add new commands for managing mod/admin roles * Feedback Update strings Update docstrings Add aliases * Use snowflakelist * paginate * Change variable name * Fix mistake * handle settings view fix * Fix name error * I'm bad at Ux * style fix
This commit is contained in:
@@ -84,18 +84,14 @@ class Reports(commands.Cog):
|
||||
await ctx.send(_("Reporting is now disabled."))
|
||||
|
||||
async def internal_filter(self, m: discord.Member, mod=False, perms=None):
|
||||
ret = False
|
||||
if mod:
|
||||
guild = m.guild
|
||||
admin_role = guild.get_role(await self.bot.db.guild(guild).admin_role())
|
||||
mod_role = guild.get_role(await self.bot.db.guild(guild).mod_role())
|
||||
ret |= any(r in m.roles for r in (mod_role, admin_role))
|
||||
if perms:
|
||||
ret |= m.guild_permissions >= perms
|
||||
if perms and m.guild_permissions >= perms:
|
||||
return True
|
||||
if mod and await self.bot.is_mod(m):
|
||||
return True
|
||||
# The following line is for consistency with how perms are handled
|
||||
# in Red, though I'm not sure it makse sense to use here.
|
||||
ret |= await self.bot.is_owner(m)
|
||||
return ret
|
||||
# in Red, though I'm not sure it makes sense to use here.
|
||||
if await self.bot.is_owner(m):
|
||||
return True
|
||||
|
||||
async def discover_guild(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user