aboutsummaryrefslogtreecommitdiff
path: root/discord/shard.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2020-04-11 22:35:07 -0400
committerRapptz <[email protected]>2020-07-25 09:59:39 -0400
commit8070d39a23863aacd52b28e1b432e128cf5d3a2e (patch)
treef7460ce9fe541f0a2d33b4615f0150efbb1ad1b7 /discord/shard.py
parentHandle connection errors during reidentify flow. (diff)
downloaddiscord.py-8070d39a23863aacd52b28e1b432e128cf5d3a2e.tar.xz
discord.py-8070d39a23863aacd52b28e1b432e128cf5d3a2e.zip
Add shard related connection and resume events.
These include: * on_shard_resumed * on_shard_connect * on_shard_disconnect
Diffstat (limited to 'discord/shard.py')
-rw-r--r--discord/shard.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/discord/shard.py b/discord/shard.py
index 0b037398..dfa3849c 100644
--- a/discord/shard.py
+++ b/discord/shard.py
@@ -104,6 +104,7 @@ class Shard:
async def _handle_disconnect(self, e):
self._dispatch('disconnect')
+ self._dispatch('shard_disconnect', self.id)
if not self._reconnect:
self._queue.put_nowait(EventItem(EventType.close, self, e))
return
@@ -136,6 +137,7 @@ class Shard:
async def reidentify(self, exc):
self._cancel_task()
self._dispatch('disconnect')
+ self._dispatch('shard_disconnect', self.id)
log.info('Got a request to %s the websocket at Shard ID %s.', exc.op, self.id)
try:
coro = DiscordWebSocket.from_client(self._client, resume=exc.resume, shard_id=self.id,