aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_core/_bot.py
diff options
context:
space:
mode:
authorGravatar ChrisJL <[email protected]>2023-07-25 14:28:54 +0100
committerGravatar GitHub <[email protected]>2023-07-25 14:28:54 +0100
commitfc8af5edac4aaacb9862401d7a804cc643568e81 (patch)
tree24d7e19a79fbf6c2ae8b4e824920e899f73d0b21 /pydis_core/_bot.py
parentMerge pull request #188 from python-discord/paste-servic-emultiple-files (diff)
parentfixup: 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.py10
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.