diff options
| author | 2020-03-26 21:45:04 +0100 | |
|---|---|---|
| committer | 2020-03-26 21:45:04 +0100 | |
| commit | bcd67524c53980ad8f3263c26c65263083974c86 (patch) | |
| tree | 9c67a9f63a95481d1b27602208d4c82947381f8d /bot/branding.py | |
| parent | Deseasonify: season-lock commands where appropriate (diff) | |
Deseasonify: show help on group invoke
Previously, when a group was called without a specific subcommand,
the status / info command was invoked automatically. This was
inconsistent with how other cogs behave, and makes it difficult
to discover the full API.
The logic from the `daemon` group is split off into a separate cmd
to allow this behaviour.
Diffstat (limited to '')
| -rw-r--r-- | bot/branding.py | 27 | 
1 files changed, 14 insertions, 13 deletions
diff --git a/bot/branding.py b/bot/branding.py index 99ff404a..5c608bf5 100644 --- a/bot/branding.py +++ b/bot/branding.py @@ -366,7 +366,7 @@ class BrandingManager(commands.Cog):      async def branding_cmds(self, ctx: commands.Context) -> None:          """Group for commands allowing manual control of the cog."""          if not ctx.invoked_subcommand: -            await self.branding_info(ctx) +            await ctx.send_help(ctx.command)      @branding_cmds.command(name="info", aliases=["status"])      async def branding_info(self, ctx: commands.Context) -> None: @@ -435,20 +435,21 @@ class BrandingManager(commands.Cog):      @branding_cmds.group(name="daemon", aliases=["d", "task"])      async def daemon_group(self, ctx: commands.Context) -> None: -        """ -        Check whether the daemon is currently active. - -        Sub-commands allow starting and stopping the daemon. -        """ +        """Group for controlling the background task."""          if not ctx.invoked_subcommand: -            if self._daemon_running: -                remaining_time = (arrow.utcnow() + await time_until_midnight()).humanize() -                response = discord.Embed(description=f"Daemon running {Emojis.ok_hand}", colour=Colours.soft_green) -                response.set_footer(text=f"Next refresh {remaining_time}") -            else: -                response = discord.Embed(description="Daemon not running", colour=Colours.soft_red) +            await ctx.send_help(ctx.command) -            await ctx.send(embed=response) +    @daemon_group.command(name="status") +    async def daemon_status(self, ctx: commands.Context) -> None: +        """Check whether the daemon is currently active.""" +        if self._daemon_running: +            remaining_time = (arrow.utcnow() + await time_until_midnight()).humanize() +            response = discord.Embed(description=f"Daemon running {Emojis.ok_hand}", colour=Colours.soft_green) +            response.set_footer(text=f"Next refresh {remaining_time}") +        else: +            response = discord.Embed(description="Daemon not running", colour=Colours.soft_red) + +        await ctx.send(embed=response)      @daemon_group.command(name="start")      async def daemon_start(self, ctx: commands.Context) -> None:  |