diff options
author | 2020-03-28 17:00:34 +0100 | |
---|---|---|
committer | 2020-03-28 17:02:51 +0100 | |
commit | b68471916db719265e90754067e8c71c4b771ba7 (patch) | |
tree | b960a91513723915db34f375b12c92bf878463fa | |
parent | Deseasonify: add cmd showing all available seasons (diff) |
Deseasonify: re-order command defs for consistency with doc
Define commands in the same order in which the cog's docstring lists
them. This shall make it easier to browse or look up implementations.
The commands are defined roughly in the order in which a user would be
expected to use them.
-rw-r--r-- | bot/exts/evergreen/branding.py | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/bot/exts/evergreen/branding.py b/bot/exts/evergreen/branding.py index 2b94c5e7..5211bd98 100644 --- a/bot/exts/evergreen/branding.py +++ b/bot/exts/evergreen/branding.py @@ -376,16 +376,6 @@ class BrandingManager(commands.Cog): if not ctx.invoked_subcommand: await ctx.send_help(ctx.command) - @branding_cmds.command(name="info", aliases=["status"]) - async def branding_info(self, ctx: commands.Context) -> None: - """ - Show assets for current season. - - This can be used to confirm that assets have been resolved properly. - When `apply` is used, it attempts to upload exactly the assets listed here. - """ - await ctx.send(embed=await self._info_embed()) - @branding_cmds.command(name="list", aliases=["ls"]) async def branding_list(self, ctx: commands.Context) -> None: """List all available seasons and branding sources.""" @@ -406,48 +396,6 @@ class BrandingManager(commands.Cog): await ctx.send(embed=embed) - @branding_cmds.command(name="refresh") - async def branding_refresh(self, ctx: commands.Context) -> None: - """ - Refresh current season from branding repository. - - Polls Github API to refresh assets available for current season. - """ - async with ctx.typing(): - await self.refresh() - await self.branding_info(ctx) - - @branding_cmds.command(name="cycle") - async def branding_cycle(self, ctx: commands.Context) -> None: - """ - Apply the next-up guild icon, if multiple are available. - - The order is random. - """ - async with ctx.typing(): - success = await self.cycle() - if not success: - raise BrandingError("Failed to cycle icon") - - response = discord.Embed(description=f"Success {Emojis.ok_hand}", colour=Colours.soft_green) - await ctx.send(embed=response) - - @branding_cmds.command(name="apply") - async def branding_apply(self, ctx: commands.Context) -> None: - """ - Apply current season's branding to the guild. - - Use `info` to check which assets will be applied. Shows which assets have - failed to be applied, if any. - """ - async with ctx.typing(): - failed_assets = await self.apply() - if failed_assets: - raise BrandingError(f"Failed to apply following assets: {', '.join(failed_assets)}") - - response = discord.Embed(description=f"All assets applied {Emojis.ok_hand}", colour=Colours.soft_green) - await ctx.send(embed=response) - @branding_cmds.command(name="set") async def branding_set(self, ctx: commands.Context, *, season_name: t.Optional[str] = None) -> None: """ @@ -482,6 +430,58 @@ class BrandingManager(commands.Cog): await self.refresh() await self.branding_info(ctx) + @branding_cmds.command(name="info", aliases=["status"]) + async def branding_info(self, ctx: commands.Context) -> None: + """ + Show assets for current season. + + This can be used to confirm that assets have been resolved properly. + When `apply` is used, it attempts to upload exactly the assets listed here. + """ + await ctx.send(embed=await self._info_embed()) + + @branding_cmds.command(name="refresh") + async def branding_refresh(self, ctx: commands.Context) -> None: + """ + Refresh current season from branding repository. + + Polls Github API to refresh assets available for current season. + """ + async with ctx.typing(): + await self.refresh() + await self.branding_info(ctx) + + @branding_cmds.command(name="apply") + async def branding_apply(self, ctx: commands.Context) -> None: + """ + Apply current season's branding to the guild. + + Use `info` to check which assets will be applied. Shows which assets have + failed to be applied, if any. + """ + async with ctx.typing(): + failed_assets = await self.apply() + if failed_assets: + raise BrandingError(f"Failed to apply following assets: {', '.join(failed_assets)}") + + response = discord.Embed(description=f"All assets applied {Emojis.ok_hand}", colour=Colours.soft_green) + await ctx.send(embed=response) + + @branding_cmds.command(name="cycle") + async def branding_cycle(self, ctx: commands.Context) -> None: + """ + Apply the next-up guild icon, if multiple are available. + + The order is random. + """ + async with ctx.typing(): + success = await self.cycle() + if not success: + raise BrandingError("Failed to cycle icon") + + response = discord.Embed(description=f"Success {Emojis.ok_hand}", colour=Colours.soft_green) + await ctx.send(embed=response) + @branding_cmds.group(name="daemon", aliases=["d", "task"]) async def daemon_group(self, ctx: commands.Context) -> None: """Control the background daemon.""" |