Skip to content

Commit 76eb582

Browse files
committed
Add BotBase.wait_until_bot_started which can be used to hold a process until all extensions are loaded.
1 parent b52f1ab commit 76eb582

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

docs/changelog.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Changelog
55
=========
66

77

8+
- :release:`10.1.0 <25th July 2023>`
9+
- :feature:`190` Overwrite :obj:`discord.ext.commands.Bot.process_commands` to ensure no commands are processed until all extensions are loaded. This only works for clients using :obj:`pydis_core.BotBase.load_extensions`
10+
11+
812
- :release:`10.0.0 <14th July 2023>`
913
- :breaking:`188` Support sending multiple files at once to paste service. All calls to :obj:`pydis_core.utils.paste_service.send_to_paste_service` must now provide a list of :obj:`pydis_core.utils.paste_service.PasteFile`
1014
- :bug:`187 major` Fix :obj:`pydis_core.utils.channel.get_or_fetch_channel`'s return type to include :obj:`discord.abc.PrivateChannel` and :obj:`discord.Thread`.

pydis_core/_bot.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ async def wait_until_guild_available(self) -> None:
231231
"""
232232
await self._guild_available.wait()
233233

234+
async def process_commands(self, message: discord.Message) -> None:
235+
"""Wait until all extensions are loaded before processing commands."""
236+
if self._extension_loading_task:
237+
await self._extension_loading_task
238+
await super().process_commands(message)
239+
234240
async def setup_hook(self) -> None:
235241
"""
236242
An async init to startup generic services.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pydis_core"
3-
version = "10.0.0"
3+
version = "10.1.0"
44
description = "PyDis core provides core functionality and utility to the bots of the Python Discord community."
55
authors = ["Python Discord <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)