From 1d740c3534a90f2625dee10e63ff6b1e0909e9c3 Mon Sep 17 00:00:00 2001 From: elenakrittik Date: Thu, 16 Nov 2023 22:49:17 +0300 Subject: [PATCH] docs: 3.0 --- disnake/client.py | 8 +++++++- disnake/ext/commands/cog.py | 14 ++++++++++++-- disnake/ext/commands/common_bot_base.py | 18 ++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/disnake/client.py b/disnake/client.py index 3396fcbe57..4fcd5f1c81 100644 --- a/disnake/client.py +++ b/disnake/client.py @@ -469,7 +469,7 @@ def _handle_first_connect(self) -> None: def loop(self): """:class:`asyncio.AbstractEventLoop`: Same as :func:`asyncio.get_running_loop`. - .. deprecated:: 2.10 + .. deprecated:: 3.0 Use :func:`asyncio.get_running_loop` directly. """ warnings.warn( @@ -1003,6 +1003,9 @@ async def login(self, token: str) -> None: Logs in the client with the specified credentials and calls :meth:`.setup_hook`. + .. versionchanged:: 3.0 + Now also calls :meth:`.setup_hook`. + Parameters ---------- token: :class:`str` @@ -1254,6 +1257,9 @@ def run(self, *args: Any, **kwargs: Any) -> None: This function must be the last function to call due to the fact that it is blocking. That means that registration of events or anything being called after this function call will not execute until it returns. + + .. versionchanged:: 3.0 + Changed to use :func:`asyncio.run`, instead of custom logic. """ try: asyncio.run(self.start(*args, **kwargs)) diff --git a/disnake/ext/commands/cog.py b/disnake/ext/commands/cog.py index 9be5a133e5..7f07b093c2 100644 --- a/disnake/ext/commands/cog.py +++ b/disnake/ext/commands/cog.py @@ -476,12 +476,22 @@ def has_message_error_handler(self) -> bool: @_cog_special_method async def cog_load(self) -> None: - """A special method that is called when the cog is added.""" + """A special method that is called when the cog is added. + + .. versionchanged:: 3.0 + This is now ``await``ed directly instead of being scheduled as a task. + + This is now run when the cog fully finished loading. + """ pass @_cog_special_method async def cog_unload(self) -> None: - """A special method that is called when the cog gets removed.""" + """A special method that is called when the cog gets removed. + + .. versionchanged:: 3.0 + This can now be a coroutine. + """ pass @_cog_special_method diff --git a/disnake/ext/commands/common_bot_base.py b/disnake/ext/commands/common_bot_base.py index 0f556e8275..c4dc2b8ba7 100644 --- a/disnake/ext/commands/common_bot_base.py +++ b/disnake/ext/commands/common_bot_base.py @@ -158,6 +158,9 @@ async def add_cog(self, cog: Cog, *, override: bool = False) -> None: :exc:`.ClientException` is raised when a cog with the same name is already loaded. + .. versionchanged:: 3.0 + This is now a coroutine. + Parameters ---------- cog: :class:`.Cog` @@ -219,6 +222,9 @@ async def remove_cog(self, name: str) -> Optional[Cog]: If no cog is found then this method has no effect. + .. versionchanged:: 3.0 + This is now a coroutine. + Parameters ---------- name: :class:`str` @@ -326,6 +332,9 @@ async def load_extension(self, name: str, *, package: Optional[str] = None) -> N the entry point on what to do when the extension is loaded. This entry point must have a single argument, the ``bot``. + .. versionchanged:: 3.0 + This is now a coroutine. + Parameters ---------- name: :class:`str` @@ -373,6 +382,9 @@ async def unload_extension(self, name: str, *, package: Optional[str] = None) -> parameter, the ``bot``, similar to ``setup`` from :meth:`~.Bot.load_extension`. + .. versionchanged:: 3.0 + This is now a coroutine. + Parameters ---------- name: :class:`str` @@ -410,6 +422,9 @@ async def reload_extension(self, name: str, *, package: Optional[str] = None) -> except done in an atomic way. That is, if an operation fails mid-reload then the bot will roll-back to the prior working state. + .. versionchanged:: 3.0 + This is now a coroutine. + Parameters ---------- name: :class:`str` @@ -469,6 +484,9 @@ async def load_extensions(self, path: str) -> None: .. versionadded:: 2.4 + .. versionchanged:: 3.0 + This is now a coroutine. + Parameters ---------- path: :class:`str`