Implement AutoShardedClient for transparent sharding.

This allows people to run their >2,500 guild bot in a single process
without the headaches of IPC/RPC or much difficulty.
This commit is contained in:
Rapptz
2017-01-07 21:55:47 -05:00
parent d54d7f7ac0
commit 20041ea756
9 changed files with 341 additions and 31 deletions

View File

@ -118,14 +118,17 @@ class ConnectionClosed(ClientException):
Attributes
-----------
code : int
code: int
The close code of the websocket.
reason : str
reason: str
The reason provided for the closure.
shard_id: Optional[int]
The shard ID that got closed if applicable.
"""
def __init__(self, original):
def __init__(self, original, *, shard_id):
# This exception is just the same exception except
# reconfigured to subclass ClientException for users
self.code = original.code
self.reason = original.reason
self.shard_id = shard_id
super().__init__(str(original))