diff options
author | 2020-03-28 16:56:29 +0100 | |
---|---|---|
committer | 2020-03-28 16:56:59 +0100 | |
commit | c02836df85ec11b0cfe76ed15ba6ef0470d0b652 (patch) | |
tree | e72235444e239d1a2fe17fbbfd39cf935f39832b | |
parent | Deseasonify: add helper to give all available seasons (diff) |
Deseasonify: add cmd showing all available seasons
-rw-r--r-- | bot/exts/evergreen/branding.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/bot/exts/evergreen/branding.py b/bot/exts/evergreen/branding.py index 0a14cd84..2b94c5e7 100644 --- a/bot/exts/evergreen/branding.py +++ b/bot/exts/evergreen/branding.py @@ -12,7 +12,7 @@ from discord.ext import commands from bot.bot import SeasonalBot from bot.constants import Branding, Colours, Emojis, MODERATION_ROLES, Tokens -from bot.seasons import SeasonBase, get_current_season, get_season +from bot.seasons import SeasonBase, get_all_seasons, get_current_season, get_season from bot.utils.decorators import with_role from bot.utils.exceptions import BrandingError @@ -85,6 +85,9 @@ class BrandingManager(commands.Cog): All supported operations, e.g. setting seasons, applying the branding, or cycling icons, can also be invoked manually, via the following API: + branding list + - Show all available seasons + branding set <season_name> - Set the cog's internal state to represent `season_name`, if it exists. - If no `season_name` is given, set chronologically current season. @@ -383,6 +386,26 @@ class BrandingManager(commands.Cog): """ 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.""" + embed = discord.Embed(title="Available seasons", colour=Colours.soft_green) + + for season in get_all_seasons(): + if season is SeasonBase: + active_when = "always" + else: + months = ", ".join(m.name for m in season.months) + active_when = f"in {months}" + + description = ( + f"Active {active_when}\n" + f"Branding: {season.branding_path}" + ) + embed.add_field(name=season.season_name, value=description, inline=False) + + await ctx.send(embed=embed) + @branding_cmds.command(name="refresh") async def branding_refresh(self, ctx: commands.Context) -> None: """ |