[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:
DiscordLiz
2019-06-23 23:36:00 -04:00
committed by Michael H
parent 71d0bd0d07
commit 6bdc9606f6
8 changed files with 161 additions and 99 deletions

View File

@@ -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,