aboutsummaryrefslogtreecommitdiff
path: root/discord/gateway.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/gateway.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/gateway.py')
-rw-r--r--discord/gateway.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/discord/gateway.py b/discord/gateway.py
index db3c7fd5..3f92ec1f 100644
--- a/discord/gateway.py
+++ b/discord/gateway.py
@@ -438,11 +438,15 @@ class DiscordWebSocket:
self._trace = trace = data.get('_trace', [])
self.sequence = msg['s']
self.session_id = data['session_id']
+ # pass back shard ID to ready handler
+ data['__shard_id__'] = self.shard_id
log.info('Shard ID %s has connected to Gateway: %s (Session ID: %s).',
self.shard_id, ', '.join(trace), self.session_id)
elif event == 'RESUMED':
self._trace = trace = data.get('_trace', [])
+ # pass back the shard ID to the resumed handler
+ data['__shard_id__'] = self.shard_id
log.info('Shard ID %s has successfully RESUMED session %s under trace %s.',
self.shard_id, self.session_id, ', '.join(trace))