diff options
author | 2023-07-25 14:28:54 +0100 | |
---|---|---|
committer | 2023-07-25 14:28:54 +0100 | |
commit | fc8af5edac4aaacb9862401d7a804cc643568e81 (patch) | |
tree | 24d7e19a79fbf6c2ae8b4e824920e899f73d0b21 /pydis_core/_bot.py | |
parent | Merge pull request #188 from python-discord/paste-servic-emultiple-files (diff) | |
parent | fixup: Update BotBase.process_commands docstring to be more explicit (diff) |
Merge pull request #190 from python-discord/wait_until_bot_startedv10.1.0
Don't process comands until extensions are loaded
Diffstat (limited to 'pydis_core/_bot.py')
-rw-r--r-- | pydis_core/_bot.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pydis_core/_bot.py b/pydis_core/_bot.py index 10cab457..6a3d3886 100644 --- a/pydis_core/_bot.py +++ b/pydis_core/_bot.py @@ -231,6 +231,16 @@ class BotBase(commands.Bot): """ await self._guild_available.wait() + async def process_commands(self, message: discord.Message) -> None: + """ + Overwrite default Discord.py behaviour to process commands only after ensuring extensions are loaded. + + This extension check is only relevant for clients that make use of :obj:`pydis_core.BotBase.load_extensions`. + """ + if self._extension_loading_task: + await self._extension_loading_task + await super().process_commands(message) + async def setup_hook(self) -> None: """ An async init to startup generic services. |