aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dennis Pham <[email protected]>2022-01-01 15:50:05 -0500
committerGravatar GitHub <[email protected]>2022-01-01 15:50:05 -0500
commit175b7ef627d3a476a6da8465ed61ca4f31df4ccf (patch)
tree3cbc48fb2b68e1ef5258344a5e50129a675c4b3c
parentMerge pull request #994 from python-discord/logging-in-AoC-completer-task (diff)
parentAllow AoC join to be ran in the month before and after the event (diff)
Merge pull request #996 from python-discord/aoc-changes
AoC month changes
-rw-r--r--bot/exts/events/advent_of_code/_cog.py20
-rw-r--r--tox.ini6
2 files changed, 16 insertions, 10 deletions
diff --git a/bot/exts/events/advent_of_code/_cog.py b/bot/exts/events/advent_of_code/_cog.py
index c597fd0e..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
@@ -254,7 +258,7 @@ class AdventOfCode(commands.Cog):
else:
await ctx.message.add_reaction(Emojis.envelope)
- @in_month(Month.NOVEMBER, Month.DECEMBER)
+ @in_month(Month.NOVEMBER, Month.DECEMBER, Month.JANUARY)
@adventofcode_group.command(
name="link",
aliases=("connect",),
@@ -306,7 +310,7 @@ class AdventOfCode(commands.Cog):
" Please re-run the command with one specified."
)
- @in_month(Month.NOVEMBER, Month.DECEMBER)
+ @in_month(Month.NOVEMBER, Month.DECEMBER, Month.JANUARY)
@adventofcode_group.command(
name="unlink",
aliases=("disconnect",),
@@ -327,7 +331,7 @@ class AdventOfCode(commands.Cog):
log.info(f"Attempted to unlink {ctx.author} ({ctx.author.id}), but no link was found.")
await ctx.reply("You don't have an Advent of Code account linked.")
- @in_month(Month.DECEMBER)
+ @in_month(Month.DECEMBER, Month.JANUARY)
@adventofcode_group.command(
name="dayandstar",
aliases=("daynstar", "daystar"),
@@ -365,7 +369,7 @@ class AdventOfCode(commands.Cog):
await view.wait()
await message.edit(view=None)
- @in_month(Month.DECEMBER)
+ @in_month(Month.DECEMBER, Month.JANUARY)
@adventofcode_group.command(
name="leaderboard",
aliases=("board", "lb"),
@@ -410,7 +414,7 @@ class AdventOfCode(commands.Cog):
await ctx.send(content=f"{header}\n\n{table}", embed=info_embed)
return
- @in_month(Month.DECEMBER)
+ @in_month(Month.DECEMBER, Month.JANUARY)
@adventofcode_group.command(
name="global",
aliases=("globalboard", "gb"),
diff --git a/tox.ini b/tox.ini
index af87e6fc..f561fcd9 100644
--- a/tox.ini
+++ b/tox.ini
@@ -11,9 +11,11 @@ ignore=
# Docstring Quotes
D301,D302,
# Docstring Content
- D400,D401,D402,D404,D405,D406,D407,D408,D409,D410,D411,D412,D413,D414,D416,D417
+ D400,D401,D402,D404,D405,D406,D407,D408,D409,D410,D411,D412,D413,D414,D416,D417,
# Type Annotations
- ANN002,ANN003,ANN101,ANN102,ANN204,ANN206
+ ANN002,ANN003,ANN101,ANN102,ANN204,ANN206,
+ # Binary operators over multiple lines
+ W504,
exclude=
__pycache__,.cache,
venv,.venv,