Skip to content

Commit

Permalink
docs: 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
elenakrittik committed Nov 16, 2023
1 parent b68f114 commit 1d740c3
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
8 changes: 7 additions & 1 deletion disnake/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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))
Expand Down
14 changes: 12 additions & 2 deletions disnake/ext/commands/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions disnake/ext/commands/common_bot_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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`
Expand Down

0 comments on commit 1d740c3

Please sign in to comment.