Browse Source

Throw when trying to create a session without the dependency

pull/10300/head
Snazzah 1 month ago
parent
commit
0f91ea6cbb
No known key found for this signature in database GPG Key ID: EA479766A94CEB61
  1. 3
      discord/gateway.py
  2. 4
      discord/voice_state.py

3
discord/gateway.py

@ -992,7 +992,8 @@ class DiscordVoiceWebSocket:
self._connection.mode = data['mode']
await self.load_secret_key(data)
self._connection.dave_protocol_version = data['dave_protocol_version']
await self._connection.reinit_dave_session()
if data['dave_protocol_version'] > 0:
await self._connection.reinit_dave_session()
elif op == self.HELLO:
interval = data['heartbeat_interval'] / 1000.0
self._keep_alive = VoiceKeepAliveHandler(ws=self, interval=min(interval, 5.0))

4
discord/voice_state.py

@ -266,7 +266,7 @@ class VoiceConnectionState:
@property
def max_dave_protocol_version(self) -> int:
return davey.DAVE_PROTOCOL_VERSION
return davey.DAVE_PROTOCOL_VERSION if has_dave else 0
@property
def can_encrypt(self) -> bool:
@ -274,6 +274,8 @@ class VoiceConnectionState:
async def reinit_dave_session(self) -> None:
if self.dave_protocol_version > 0:
if not has_dave:
raise RuntimeError('davey library needed in order to use E2EE voice')
if self.dave_session:
self.dave_session.reinit(self.dave_protocol_version, self.user.id, self.voice_client.channel.id)
else:

Loading…
Cancel
Save