Add client.setup and move readying commands to that
This commit is contained in:
@@ -595,7 +595,7 @@ class Client:
|
||||
async def start(self, token: str, *, reconnect: bool = True) -> None:
|
||||
"""|coro|
|
||||
|
||||
A shorthand coroutine for :meth:`login` + :meth:`connect`.
|
||||
A shorthand coroutine for :meth:`login` + :meth:`setup` + :meth:`connect`.
|
||||
|
||||
Raises
|
||||
-------
|
||||
@@ -603,8 +603,19 @@ class Client:
|
||||
An unexpected keyword argument was received.
|
||||
"""
|
||||
await self.login(token)
|
||||
await self.setup()
|
||||
await self.connect(reconnect=reconnect)
|
||||
|
||||
async def setup(self) -> Any:
|
||||
"""|coro|
|
||||
|
||||
A coroutine to be called to setup the bot, by default this is blank.
|
||||
|
||||
To perform asynchronous setup after the bot is logged in but before
|
||||
it has connected to the Websocket, overwrite this coroutine.
|
||||
"""
|
||||
pass
|
||||
|
||||
def run(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""A blocking call that abstracts away the event loop
|
||||
initialisation from you.
|
||||
|
||||
Reference in New Issue
Block a user