From cc0b3c6bb98d9e72d610bdea4f6da20d1fbb8703 Mon Sep 17 00:00:00 2001 From: Vivek Santayana Date: Wed, 4 Aug 2021 15:24:39 +0100 Subject: [PATCH] Getting better? --- app/cogs/controlcommands/debug.py | 3 --- app/cogs/controlcommands/migrate.py | 8 ++++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/cogs/controlcommands/debug.py b/app/cogs/controlcommands/debug.py index 94e0fc3..bee65b2 100644 --- a/app/cogs/controlcommands/debug.py +++ b/app/cogs/controlcommands/debug.py @@ -24,9 +24,6 @@ class Debug(commands.Cog, name='Debug Commands'): if role.id == conf[str(ctx.guild.id)]['roles']['maintainer']: return True return ctx.author.id == ctx.guild.owner_id - async def cog_check(self, ctx): - return ctx.author.id == int(os.getenv('BOT_MAINTAINER_ID')) - @commands.command( name='testconfig', description='Tests the completeness of the configuration values of the current guild by comparing it to a configuration blueprint.', diff --git a/app/cogs/controlcommands/migrate.py b/app/cogs/controlcommands/migrate.py index 56fc110..ae79a5e 100644 --- a/app/cogs/controlcommands/migrate.py +++ b/app/cogs/controlcommands/migrate.py @@ -16,8 +16,12 @@ class Migrate(commands.Cog, name='Migrate Command'): self.client = client #### Permission Check: Only available to the bot's maintainer. - async def cog_check(self, ctx): - return ctx.author.id == int(os.getenv('BOT_MAINTAINER_ID')) + async def cog_check(self, ctx:commands.Context): + conf = yaml_load(configFile) + for role in ctx.author.roles: + if 'maintainer' in conf[str(ctx.guild.id)]['roles']: + if role.id == conf[str(ctx.guild.id)]['roles']['maintainer']: return True + return ctx.author.id == ctx.guild.owner_id @commands.command( name='migrate',