diff options
Diffstat (limited to 'discord/voice_client.py')
| -rw-r--r-- | discord/voice_client.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/discord/voice_client.py b/discord/voice_client.py index c5b24a77..a92bf5b8 100644 --- a/discord/voice_client.py +++ b/discord/voice_client.py @@ -51,10 +51,15 @@ import shlex import functools import datetime import audioop -import nacl.secret log = logging.getLogger(__name__) +try: + import nacl.secret + has_nacl = True +except ImportError: + has_nacl = False + from . import utils, opus from .gateway import * from .errors import ClientException, InvalidArgument, ConnectionClosed @@ -182,6 +187,9 @@ class VoiceClient: The event loop that the voice client is running on. """ def __init__(self, user, main_ws, session_id, channel, data, loop): + if not has_nacl: + raise RuntimeError("PyNaCl library needed in order to use voice") + self.user = user self.main_ws = main_ws self.channel = channel @@ -196,6 +204,8 @@ class VoiceClient: self.encoder = opus.Encoder(48000, 2) log.info('created opus encoder with {0.__dict__}'.format(self.encoder)) + warn_nacl = not has_nacl + @property def server(self): return self.channel.server |