From 6b7caa1835ab809a8ccdfa5ea3ada705acaede70 Mon Sep 17 00:00:00 2001 From: kwzrd Date: Thu, 26 Mar 2020 21:22:53 +0100 Subject: Deseasonify: season-lock commands where appropriate I left as many available as possible. Some of the commands also handle being outside of their original season, e.g. by showing the amount of time until Hacktoberfest begins, if not currently active. These were left available as well. If a group is to be locked, the `invoke_without_command` param must be False (default), otherwise the group's callback will be circumvented if a valid subcommand is invoked. I adjusted these where necessary, except for the `HacktoberStats` cog, whose cmd group takes an arg, which would require a more involved adjustment - I decided to leave it as is, and instead manually lock both subcommands. --- bot/seasons/christmas/adventofcode.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bot/seasons/christmas/adventofcode.py') diff --git a/bot/seasons/christmas/adventofcode.py b/bot/seasons/christmas/adventofcode.py index 8caf43bd..e6100056 100644 --- a/bot/seasons/christmas/adventofcode.py +++ b/bot/seasons/christmas/adventofcode.py @@ -13,8 +13,8 @@ from bs4 import BeautifulSoup from discord.ext import commands from pytz import timezone -from bot.constants import AdventOfCode as AocConfig, Channels, Colours, Emojis, Tokens, WHITELISTED_CHANNELS -from bot.decorators import override_in_channel +from bot.constants import AdventOfCode as AocConfig, Channels, Colours, Emojis, Month, Tokens, WHITELISTED_CHANNELS +from bot.decorators import in_month, override_in_channel from bot.utils import unlocked_role log = logging.getLogger(__name__) @@ -153,11 +153,13 @@ class AdventOfCode(commands.Cog): status_coro = countdown_status(self.bot) self.status_task = self.bot.loop.create_task(status_coro) - @commands.group(name="adventofcode", aliases=("aoc",), invoke_without_command=True) + @in_month(Month.december) + @commands.group(name="adventofcode", aliases=("aoc",)) @override_in_channel(AOC_WHITELIST) async def adventofcode_group(self, ctx: commands.Context) -> None: """All of the Advent of Code commands.""" - await ctx.send_help(ctx.command) + if not ctx.invoked_subcommand: + await ctx.send_help(ctx.command) @adventofcode_group.command( name="subscribe", -- cgit v1.2.3