diff options
Diffstat (limited to 'bot/exts/events/advent_of_code')
| -rw-r--r-- | bot/exts/events/advent_of_code/__init__.py | 4 | ||||
| -rw-r--r-- | bot/exts/events/advent_of_code/_cog.py | 6 | ||||
| -rw-r--r-- | bot/exts/events/advent_of_code/_helpers.py | 10 |
3 files changed, 4 insertions, 16 deletions
diff --git a/bot/exts/events/advent_of_code/__init__.py b/bot/exts/events/advent_of_code/__init__.py index 3c521168..33c3971a 100644 --- a/bot/exts/events/advent_of_code/__init__.py +++ b/bot/exts/events/advent_of_code/__init__.py @@ -1,10 +1,10 @@ from bot.bot import Bot -def setup(bot: Bot) -> None: +async def setup(bot: Bot) -> None: """Set up the Advent of Code extension.""" # Import the Cog at runtime to prevent side effects like defining # RedisCache instances too early. from ._cog import AdventOfCode - bot.add_cog(AdventOfCode(bot)) + await bot.add_cog(AdventOfCode(bot)) diff --git a/bot/exts/events/advent_of_code/_cog.py b/bot/exts/events/advent_of_code/_cog.py index 518841d4..49140a3f 100644 --- a/bot/exts/events/advent_of_code/_cog.py +++ b/bot/exts/events/advent_of_code/_cog.py @@ -18,7 +18,6 @@ from bot.exts.events.advent_of_code.views.dayandstarview import AoCDropdownView from bot.utils import members from bot.utils.decorators import InChannelCheckFailure, in_month, whitelist_override, with_role from bot.utils.exceptions import MovedCommandError -from bot.utils.extensions import invoke_help_command log = logging.getLogger(__name__) @@ -71,7 +70,6 @@ class AdventOfCode(commands.Cog): Runs on a schedule, as defined in the task.loop decorator. """ - await self.bot.wait_until_guild_available() guild = self.bot.get_guild(Client.guild) completionist_role = guild.get_role(Roles.aoc_completionist) if completionist_role is None: @@ -87,7 +85,7 @@ class AdventOfCode(commands.Cog): try: leaderboard = await _helpers.fetch_leaderboard() except _helpers.FetchingLeaderboardFailedError: - await self.bot.send_log("Unable to fetch AoC leaderboard during role sync.") + await self.bot.log_to_dev_log("Unable to fetch AoC leaderboard during role sync.") return placement_leaderboard = json.loads(leaderboard["placement_leaderboard"]) @@ -122,7 +120,7 @@ class AdventOfCode(commands.Cog): async def adventofcode_group(self, ctx: commands.Context) -> None: """All of the Advent of Code commands.""" if not ctx.invoked_subcommand: - await invoke_help_command(ctx) + await self.bot.invoke_help_command(ctx) @with_role(Roles.admins) @adventofcode_group.command( diff --git a/bot/exts/events/advent_of_code/_helpers.py b/bot/exts/events/advent_of_code/_helpers.py index 6c004901..abd80b77 100644 --- a/bot/exts/events/advent_of_code/_helpers.py +++ b/bot/exts/events/advent_of_code/_helpers.py @@ -523,13 +523,6 @@ async def countdown_status(bot: Bot) -> None: # Log that we're going to start with the countdown status. log.info("The Advent of Code has started or will start soon, starting countdown status.") - # Trying to change status too early in the bot's startup sequence will fail - # the task because the websocket instance has not yet been created. Waiting - # for this event means that both the websocket instance has been initialized - # and that the connection to Discord is mature enough to change the presence - # of the bot. - await bot.wait_until_guild_available() - # Calculate when the task needs to stop running. To prevent the task from # sleeping for the entire year, it will only wait in the currently # configured year. This means that the task will only start hibernating once @@ -578,9 +571,6 @@ async def new_puzzle_notification(bot: Bot) -> None: log.info("The Advent of Code has started or will start soon, waking up notification task.") - # Ensure that the guild cache is loaded so we can get the Advent of Code - # channel and role. - await bot.wait_until_guild_available() aoc_channel = bot.get_channel(Channels.advent_of_code) aoc_role = aoc_channel.guild.get_role(AdventOfCode.role_id) |