Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions botcore/_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from botcore.async_stats import AsyncStatsClient
from botcore.site_api import APIClient
from botcore.utils import scheduling
from botcore.utils._extensions import walk_extensions
from botcore.utils.logging import get_logger

Expand Down Expand Up @@ -111,11 +112,16 @@ def _connect_statsd(
)

async def load_extensions(self, module: types.ModuleType) -> None:
"""Load all the extensions within the given module and save them to ``self.all_extensions``."""
"""
Load all the extensions within the given module and save them to ``self.all_extensions``.

This should be ran in a task on the event loop to avoid deadlocks caused by ``wait_for`` calls.
"""
await self.wait_until_guild_available()
self.all_extensions = walk_extensions(module)

for extension in self.all_extensions:
await self.load_extension(extension)
scheduling.create_task(self.load_extension(extension))

def _add_root_aliases(self, command: commands.Command) -> None:
"""Recursively add root aliases for ``command`` and any of its subcommands."""
Expand Down