diff options
| author | Rapptz <[email protected]> | 2017-04-18 02:29:43 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-04-18 03:49:48 -0400 |
| commit | 3b1b26ffb1c9a75ac9c3f958d6e134ccddd6be07 (patch) | |
| tree | dcaac87b10f4d2a2bdf82f260a5738c1367f425f /discord/client.py | |
| parent | Don't clear state when READY is reached for auto sharded clients. (diff) | |
| download | discord.py-3b1b26ffb1c9a75ac9c3f958d6e134ccddd6be07.tar.xz discord.py-3b1b26ffb1c9a75ac9c3f958d6e134ccddd6be07.zip | |
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.
Diffstat (limited to 'discord/client.py')
| -rw-r--r-- | discord/client.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/discord/client.py b/discord/client.py index dca01a4e..c8a81d33 100644 --- a/discord/client.py +++ b/discord/client.py @@ -31,6 +31,7 @@ from .errors import * from .permissions import Permissions, PermissionOverwrite from .enums import ChannelType, Status from .gateway import * +from .voice_client import VoiceClient from .emoji import Emoji from .http import HTTPClient from .state import ConnectionState @@ -119,10 +120,11 @@ class Client: self.connection.shard_count = self.shard_count self._closed = asyncio.Event(loop=self.loop) self._ready = asyncio.Event(loop=self.loop) + self.connection._get_websocket = lambda g: self.ws - # if VoiceClient.warn_nacl: - # VoiceClient.warn_nacl = False - # log.warning("PyNaCl is not installed, voice will NOT be supported") + if VoiceClient.warn_nacl: + VoiceClient.warn_nacl = False + log.warning("PyNaCl is not installed, voice will NOT be supported") # internals |