aboutsummaryrefslogtreecommitdiffstats
path: root/bot
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2022-01-01 14:26:34 +0000
committerGravatar Chris Lovering <[email protected]>2022-01-01 14:42:23 +0000
commitd32c15206be6a1a726a57eea614de4856d5473d8 (patch)
tree3cbc48fb2b68e1ef5258344a5e50129a675c4b3c /bot
parentAllow AoC commands to be run in January (diff)
Allow AoC join to be ran in the month before and after the event
Diffstat (limited to 'bot')
-rw-r--r--bot/exts/events/advent_of_code/_cog.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/bot/exts/events/advent_of_code/_cog.py b/bot/exts/events/advent_of_code/_cog.py
index 493d58b2..a9625153 100644
--- a/bot/exts/events/advent_of_code/_cog.py
+++ b/bot/exts/events/advent_of_code/_cog.py
@@ -213,9 +213,13 @@ class AdventOfCode(commands.Cog):
@whitelist_override(channels=AOC_WHITELIST)
async def join_leaderboard(self, ctx: commands.Context) -> None:
"""DM the user the information for joining the Python Discord leaderboard."""
- current_year = datetime.now().year
- if current_year != AocConfig.year:
- await ctx.send(f"The Python Discord leaderboard for {current_year} is not yet available!")
+ current_date = datetime.now()
+ if (
+ current_date.month not in (Month.NOVEMBER, Month.DECEMBER) and current_date.year != AocConfig.year or
+ current_date.month != Month.JANUARY and current_date.year != AocConfig.year + 1
+ ):
+ # Only allow joining the leaderboard in the run up to AOC and the January following.
+ await ctx.send(f"The Python Discord leaderboard for {current_date.year} is not yet available!")
return
author = ctx.author