diff options
| -rw-r--r-- | bot/__main__.py | 1 | ||||
| -rw-r--r-- | bot/cogs/cogs.py | 10 | ||||
| -rw-r--r-- | bot/cogs/deployment.py | 90 | ||||
| -rw-r--r-- | bot/constants.py | 2 | ||||
| -rw-r--r-- | config-default.yml | 2 |
5 files changed, 7 insertions, 98 deletions
diff --git a/bot/__main__.py b/bot/__main__.py index e12508e6d..b1a6a5fcd 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -53,7 +53,6 @@ if not DEBUG_MODE: # Feature cogs bot.load_extension("bot.cogs.alias") bot.load_extension("bot.cogs.defcon") -bot.load_extension("bot.cogs.deployment") bot.load_extension("bot.cogs.eval") bot.load_extension("bot.cogs.free") bot.load_extension("bot.cogs.information") diff --git a/bot/cogs/cogs.py b/bot/cogs/cogs.py index 5bef52c0a..eec611824 100644 --- a/bot/cogs/cogs.py +++ b/bot/cogs/cogs.py @@ -37,14 +37,14 @@ class Cogs: self.cogs.update({v: k for k, v in self.cogs.items()}) @group(name='cogs', aliases=('c',), invoke_without_command=True) - @with_role(*MODERATION_ROLES, Roles.devops) + @with_role(*MODERATION_ROLES, Roles.core_developer) async def cogs_group(self, ctx: Context): """Load, unload, reload, and list active cogs.""" await ctx.invoke(self.bot.get_command("help"), "cogs") @cogs_group.command(name='load', aliases=('l',)) - @with_role(*MODERATION_ROLES, Roles.devops) + @with_role(*MODERATION_ROLES, Roles.core_developer) async def load_command(self, ctx: Context, cog: str): """ Load up an unloaded cog, given the module containing it @@ -97,7 +97,7 @@ class Cogs: await ctx.send(embed=embed) @cogs_group.command(name='unload', aliases=('ul',)) - @with_role(*MODERATION_ROLES, Roles.devops) + @with_role(*MODERATION_ROLES, Roles.core_developer) async def unload_command(self, ctx: Context, cog: str): """ Unload an already-loaded cog, given the module containing it @@ -149,7 +149,7 @@ class Cogs: await ctx.send(embed=embed) @cogs_group.command(name='reload', aliases=('r',)) - @with_role(*MODERATION_ROLES, Roles.devops) + @with_role(*MODERATION_ROLES, Roles.core_developer) async def reload_command(self, ctx: Context, cog: str): """ Reload an unloaded cog, given the module containing it @@ -254,7 +254,7 @@ class Cogs: await ctx.send(embed=embed) @cogs_group.command(name='list', aliases=('all',)) - @with_role(*MODERATION_ROLES, Roles.devops) + @with_role(*MODERATION_ROLES, Roles.core_developer) async def list_command(self, ctx: Context): """ Get a list of all cogs, including their loaded status. diff --git a/bot/cogs/deployment.py b/bot/cogs/deployment.py deleted file mode 100644 index e71e07c2f..000000000 --- a/bot/cogs/deployment.py +++ /dev/null @@ -1,90 +0,0 @@ -import logging - -from discord import Colour, Embed -from discord.ext.commands import Bot, Context, command, group - -from bot.constants import Keys, MODERATION_ROLES, Roles, URLs -from bot.decorators import with_role - -log = logging.getLogger(__name__) - - -class Deployment: - """ - Bot information commands - """ - - def __init__(self, bot: Bot): - self.bot = bot - - @group(name='redeploy', invoke_without_command=True) - @with_role(*MODERATION_ROLES) - async def redeploy_group(self, ctx: Context): - """Redeploy the bot or the site.""" - - await ctx.invoke(self.bot.get_command("help"), "redeploy") - - @redeploy_group.command(name='bot') - @with_role(Roles.admin, Roles.owner, Roles.devops) - async def bot_command(self, ctx: Context): - """ - Trigger bot deployment on the server - will only redeploy if there were changes to deploy - """ - - response = await self.bot.http_session.get(URLs.deploy, headers={"token": Keys.deploy_bot}) - result = await response.text() - - if result == "True": - log.debug(f"{ctx.author} triggered deployment for bot. Deployment was started.") - await ctx.send(f"{ctx.author.mention} Bot deployment started.") - else: - log.error(f"{ctx.author} triggered deployment for bot. Deployment failed to start.") - await ctx.send(f"{ctx.author.mention} Bot deployment failed - check the logs!") - - @redeploy_group.command(name='site') - @with_role(Roles.admin, Roles.owner, Roles.devops) - async def site_command(self, ctx: Context): - """ - Trigger website deployment on the server - will only redeploy if there were changes to deploy - """ - - response = await self.bot.http_session.get(URLs.deploy, headers={"token": Keys.deploy_bot}) - result = await response.text() - - if result == "True": - log.debug(f"{ctx.author} triggered deployment for site. Deployment was started.") - await ctx.send(f"{ctx.author.mention} Site deployment started.") - else: - log.error(f"{ctx.author} triggered deployment for site. Deployment failed to start.") - await ctx.send(f"{ctx.author.mention} Site deployment failed - check the logs!") - - @command(name='uptimes') - @with_role(Roles.admin, Roles.owner, Roles.devops) - async def uptimes_command(self, ctx: Context): - """ - Check the various deployment uptimes for each service - """ - - log.debug(f"{ctx.author} requested service uptimes.") - response = await self.bot.http_session.get(URLs.status) - data = await response.json() - - embed = Embed( - title="Service status", - color=Colour.blurple() - ) - - for obj in data: - key, value = list(obj.items())[0] - - embed.add_field( - name=key, value=value, inline=True - ) - - log.debug("Uptimes retrieved and parsed, returning data.") - await ctx.send(embed=embed) - - -def setup(bot): - bot.add_cog(Deployment(bot)) - log.info("Cog loaded: Deployment") diff --git a/bot/constants.py b/bot/constants.py index 45c332438..4e14a85a8 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -374,7 +374,7 @@ class Roles(metaclass=YAMLGetter): announcements: int champion: int contributor: int - devops: int + core_developer: int jammer: int moderator: int muted: int diff --git a/config-default.yml b/config-default.yml index fb33caaf6..20897f78b 100644 --- a/config-default.yml +++ b/config-default.yml @@ -127,7 +127,7 @@ guild: announcements: 463658397560995840 champion: 430492892331769857 contributor: 295488872404484098 - devops: &DEVOPS_ROLE 409416496733880320 + core_developer: 587606783669829632 jammer: 423054537079783434 moderator: &MOD_ROLE 267629731250176001 muted: &MUTED_ROLE 277914926603829249 |