diff options
| author | 2020-03-26 21:22:53 +0100 | |
|---|---|---|
| committer | 2020-03-26 21:26:04 +0100 | |
| commit | 6b7caa1835ab809a8ccdfa5ea3ada705acaede70 (patch) | |
| tree | 67fc3a5d2b026d228afec9b53bf6424a54161e4c /bot/seasons/valentines | |
| parent | Deseasonify: extend `in_month` doc (diff) | |
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.
Diffstat (limited to 'bot/seasons/valentines')
| -rw-r--r-- | bot/seasons/valentines/be_my_valentine.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bot/seasons/valentines/be_my_valentine.py b/bot/seasons/valentines/be_my_valentine.py index ab8ea290..67d8796a 100644 --- a/bot/seasons/valentines/be_my_valentine.py +++ b/bot/seasons/valentines/be_my_valentine.py @@ -8,7 +8,8 @@ import discord from discord.ext import commands from discord.ext.commands.cooldowns import BucketType -from bot.constants import Channels, Client, Colours, Lovefest +from bot.constants import Channels, Client, Colours, Lovefest, Month +from bot.decorators import in_month log = logging.getLogger(__name__) @@ -30,7 +31,8 @@ class BeMyValentine(commands.Cog): valentines = load(json_data) return valentines - @commands.group(name="lovefest", invoke_without_command=True) + @in_month(Month.february) + @commands.group(name="lovefest") async def lovefest_role(self, ctx: commands.Context) -> None: """ Subscribe or unsubscribe from the lovefest role. @@ -40,7 +42,8 @@ class BeMyValentine(commands.Cog): 1) use the command \".lovefest sub\" to get the lovefest role. 2) use the command \".lovefest unsub\" to get rid of the lovefest role. """ - await ctx.send_help(ctx.command) + if not ctx.invoked_subcommand: + await ctx.send_help(ctx.command) @lovefest_role.command(name="sub") async def add_role(self, ctx: commands.Context) -> None: |