Add shard related connection and resume events.

These include:
* on_shard_resumed
* on_shard_connect
* on_shard_disconnect
This commit is contained in:
Rapptz
2020-04-11 22:35:07 -04:00
parent 80cc5b5edb
commit 8070d39a23
4 changed files with 41 additions and 0 deletions

View File

@ -117,6 +117,16 @@ to handle it, which defaults to print a traceback and ignoring the exception.
The warnings on :func:`on_ready` also apply.
.. function:: on_shard_connect(shard_id)
Similar to :func:`on_connect` except used by :class:`AutoShardedClient`
to denote when a particular shard ID has connected to Discord.
.. versionadded:: 1.4
:param shard_id: The shard ID that has connected.
:type shard_id: :class:`int`
.. function:: on_disconnect()
Called when the client has disconnected from Discord. This could happen either through
@ -125,6 +135,16 @@ to handle it, which defaults to print a traceback and ignoring the exception.
This function can be called many times.
.. function:: on_shard_disconnect(shard_id)
Similar to :func:`on_disconnect` except used by :class:`AutoShardedClient`
to denote when a particular shard ID has disconnected from Discord.
.. versionadded:: 1.4
:param shard_id: The shard ID that has disconnected.
:type shard_id: :class:`int`
.. function:: on_ready()
Called when the client is done preparing the data received from Discord. Usually after login is successful
@ -149,6 +169,16 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called when the client has resumed a session.
.. function:: on_shard_resumed(shard_id)
Similar to :func:`on_resumed` except used by :class:`AutoShardedClient`
to denote when a particular shard ID has resumed a session.
.. versionadded:: 1.4
:param shard_id: The shard ID that has resumed.
:type shard_id: :class:`int`
.. function:: on_error(event, \*args, \*\*kwargs)
Usually when an event raises an uncaught exception, a traceback is