From b5bed9ef33ab9eeefc6f9c4f9006f9d2916ed4eb Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sun, 8 Jan 2017 01:31:46 -0500 Subject: Change the way shards are launched in AutoShardedClient. --- discord/gateway.py | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'discord/gateway.py') diff --git a/discord/gateway.py b/discord/gateway.py index fcba2dfc..8180f4ec 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -214,35 +214,6 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol): else: return ws - @classmethod - @asyncio.coroutine - def from_sharded_client(cls, client): - if client.shard_count is None: - client.shard_count, gateway = yield from client.http.get_bot_gateway() - else: - gateway = yield from client.http.get_gateway() - - ret = [] - client.connection.shard_count = client.shard_count - - for shard_id in range(client.shard_count): - ws = yield from websockets.connect(gateway, loop=client.loop, klass=cls) - ws.token = client.http.token - ws._connection = client.connection - ws._dispatch = client.dispatch - ws.gateway = gateway - ws.shard_id = shard_id - ws.shard_count = client.shard_count - - # OP HELLO - yield from ws.poll_event() - yield from ws.identify() - ret.append(ws) - log.info('Sent IDENTIFY payload to create the websocket for shard_id: %s' % shard_id) - yield from asyncio.sleep(5.0, loop=client.loop) - - return ret - def wait_for(self, event, predicate, result=None): """Waits for a DISPATCH'd event that meets the predicate. -- cgit v1.2.3