diff options
| author | cookie <[email protected]> | 2016-06-26 14:43:28 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-06-26 14:47:16 -0400 |
| commit | abf9be5f7db79cbfab6d4502fa15ba72975059dd (patch) | |
| tree | b92dd6c72f00ee84a9ff607daa09a38d022e1dcf /discord/gateway.py | |
| parent | Document that bot users can't use Client.accept_invite (diff) | |
| download | discord.py-abf9be5f7db79cbfab6d4502fa15ba72975059dd.tar.xz discord.py-abf9be5f7db79cbfab6d4502fa15ba72975059dd.zip | |
Guild Sharding support
Diffstat (limited to 'discord/gateway.py')
| -rw-r--r-- | discord/gateway.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/discord/gateway.py b/discord/gateway.py index c605cb95..ade93991 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -178,6 +178,8 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol): ws._connection = client.connection ws._dispatch = client.dispatch ws.gateway = gateway + ws.shard_id = client.shard_id + ws.shard_count = client.shard_count client.connection._update_references(ws) @@ -250,6 +252,9 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol): if not self._connection.is_bot: payload['d']['synced_guilds'] = [] + if self.shard_id is not None and self.shard_count is not None: + payload['d']['shard'] = [self.shard_id, self.shard_count] + yield from self.send_as_json(payload) @asyncio.coroutine |