Add on_disconnect event.
I assume this is where it has to be. Fix #1937
This commit is contained in:
parent
f43690bde8
commit
963cf4b34e
@ -409,6 +409,7 @@ class Client:
|
||||
websockets.InvalidHandshake,
|
||||
websockets.WebSocketProtocolError) as exc:
|
||||
|
||||
self.dispatch('disconnect')
|
||||
if not reconnect:
|
||||
await self.close()
|
||||
if isinstance(exc, ConnectionClosed) and exc.code == 1000:
|
||||
|
@ -103,6 +103,14 @@ to handle it, which defaults to print a traceback and ignoring the exception.
|
||||
|
||||
The warnings on :func:`on_ready` also apply.
|
||||
|
||||
.. function:: on_disconnect()
|
||||
|
||||
Called when the client has disconnected from Discord. This could happen either through
|
||||
the internet being disconnect, explicit calls to logout, or Discord terminating the connection
|
||||
one way or the other.
|
||||
|
||||
This function can be called many times.
|
||||
|
||||
.. function:: on_ready()
|
||||
|
||||
Called when the client is done preparing the data received from Discord. Usually after login is successful
|
||||
|
Loading…
x
Reference in New Issue
Block a user