diff --git a/bot/exts/advent_of_code/_caches.py b/bot/exts/advent_of_code/_caches.py index 8174d64..bfa9b3c 100644 --- a/bot/exts/advent_of_code/_caches.py +++ b/bot/exts/advent_of_code/_caches.py @@ -6,6 +6,7 @@ class AoCSettingOption(Enum): COMPLETIONIST_ENABLED = "completionist_enabled" + # How many people are in each leaderboard # RedisCache[leaderboard_id, int] leaderboard_counts = async_rediscache.RedisCache(namespace="AOC_leaderboard_counts") diff --git a/bot/exts/advent_of_code/_cog.py b/bot/exts/advent_of_code/_cog.py index 74d6d92..3971e69 100644 --- a/bot/exts/advent_of_code/_cog.py +++ b/bot/exts/advent_of_code/_cog.py @@ -210,8 +210,8 @@ async def join_leaderboard(self, interaction: discord.Interaction) -> None: current_date = datetime.now(tz=UTC) 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 + (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 interaction.response.send_message( diff --git a/bot/utils/checks.py b/bot/utils/checks.py index 2704f49..8311793 100644 --- a/bot/utils/checks.py +++ b/bot/utils/checks.py @@ -1,5 +1,4 @@ from collections.abc import Callable, Container -from typing import NoReturn from discord.ext import commands from discord.ext.commands import Context @@ -13,7 +12,7 @@ def in_code_jam_category(code_jam_category_name: str) -> Callable: """Raises `CodeJamCategoryCheckFailure` when the command is invoked outside the Code Jam categories.""" - async def predicate(ctx: commands.Context) -> bool | NoReturn: + async def predicate(ctx: commands.Context) -> bool: if not ctx.guild: return False if not ctx.message.channel.category: diff --git a/tests/helpers.py b/tests/helpers.py index 56dfe0e..c317e72 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -666,6 +666,7 @@ class MockAsyncWebhook(CustomMockMixin, unittest.mock.MagicMock): spec_set = webhook_instance additional_spec_asyncs = ("send", "edit", "delete", "execute") + @contextmanager def no_create_task(): def side_effect(coro, *_, **__):