Skip to content

Commit

Permalink
Add BotBase.wait_until_bot_started which can be used to hold a proces…
Browse files Browse the repository at this point in the history
…s until all extensions are loaded.
  • Loading branch information
ChrisLovering committed Jul 25, 2023
1 parent b52f1ab commit 76eb582
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Changelog
=========


- :release:`10.1.0 <25th July 2023>`
- :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`


- :release:`10.0.0 <14th July 2023>`
- :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`
- :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`.
Expand Down
6 changes: 6 additions & 0 deletions pydis_core/_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ async def wait_until_guild_available(self) -> None:
"""
await self._guild_available.wait()

async def process_commands(self, message: discord.Message) -> None:
"""Wait until all extensions are loaded before processing commands."""
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.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pydis_core"
version = "10.0.0"
version = "10.1.0"
description = "PyDis core provides core functionality and utility to the bots of the Python Discord community."
authors = ["Python Discord <info@pythondiscord.com>"]
license = "MIT"
Expand Down

0 comments on commit 76eb582

Please sign in to comment.