Guild Sharding support

This commit is contained in:
cookie
2016-06-26 14:43:28 -04:00
committed by Rapptz
parent c34eb5f6dd
commit abf9be5f7d
2 changed files with 11 additions and 0 deletions

View File

@ -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