mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-08 10:53:10 +00:00
Re-implement voice sending.
This is a complete redesign of the old voice code. A list of major changes is as follows: * The voice websocket will now automatically reconnect with exponential back-off just like the regular Client does. * Removal of the stream player concept. * Audio now gracefully pauses and resumes when a disconnect is found. * Introduce a discord.AudioSource concept to abstract streams * Flatten previous stream player functionality with the VoiceClient, e.g. player.stop() is now voice_client.stop() * With the above re-coupling this means you no longer have to store players anywhere. * The after function now requires a single parameter, the error, if any existed. This will typically be None. A lot of this design is experimental.
This commit is contained in:
@ -110,6 +110,11 @@ class AutoShardedClient(Client):
|
||||
# the key is the shard_id
|
||||
self.shards = {}
|
||||
|
||||
def _get_websocket(guild_id):
|
||||
i = (guild_id >> 22) % self.shard_count
|
||||
return self.shards[i].ws
|
||||
|
||||
self.connection._get_websocket = _get_websocket
|
||||
self._still_sharding = True
|
||||
|
||||
@asyncio.coroutine
|
||||
|
Reference in New Issue
Block a user