aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts
diff options
context:
space:
mode:
authorGravatar wookie184 <[email protected]>2022-01-16 14:21:55 +0000
committerGravatar GitHub <[email protected]>2022-01-16 14:21:55 +0000
commit8b49afdda0993b65a904e52df76bb2ce021bffb7 (patch)
treeb8e3706e98775009545513e9b01d5884be3731bf /bot/exts
parenthandle OverflowError in relative times converter (diff)
parentchore(deps): bump pillow from 8.4.0 to 9.0.0 (diff)
Merge branch 'main' into main
Diffstat (limited to 'bot/exts')
-rw-r--r--bot/exts/events/advent_of_code/_cog.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/bot/exts/events/advent_of_code/_cog.py b/bot/exts/events/advent_of_code/_cog.py
index a5410871..3acfef39 100644
--- a/bot/exts/events/advent_of_code/_cog.py
+++ b/bot/exts/events/advent_of_code/_cog.py
@@ -96,7 +96,9 @@ class AdventOfCode(commands.Cog):
# Only give the role to people who have completed all 50 stars
continue
- member_id = aoc_name_to_member_id.get(member_aoc_info["name"], None)
+ aoc_name = member_aoc_info["name"] or f"Anonymous #{member_aoc_info['id']}"
+
+ member_id = aoc_name_to_member_id.get(aoc_name)
if not member_id:
log.debug(f"Could not find member_id for {member_aoc_info['name']}, not giving role.")
continue
@@ -187,9 +189,10 @@ class AdventOfCode(commands.Cog):
async def join_leaderboard(self, ctx: commands.Context) -> None:
"""DM the user the information for joining the Python Discord leaderboard."""
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
+ allowed_months = (Month.NOVEMBER.value, Month.DECEMBER.value)
+ if not (
+ current_date.month in allowed_months and current_date.year == AocConfig.year or
+ current_date.month == Month.JANUARY.value 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!")