Browse Source
Throw when trying to create a session without the dependency
pull/10300/head
Snazzah
1 month ago
No known key found for this signature in database
GPG Key ID: EA479766A94CEB61
2 changed files with
5 additions and
2 deletions
-
discord/gateway.py
-
discord/voice_state.py
|
@ -992,7 +992,8 @@ class DiscordVoiceWebSocket: |
|
|
self._connection.mode = data['mode'] |
|
|
self._connection.mode = data['mode'] |
|
|
await self.load_secret_key(data) |
|
|
await self.load_secret_key(data) |
|
|
self._connection.dave_protocol_version = data['dave_protocol_version'] |
|
|
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: |
|
|
elif op == self.HELLO: |
|
|
interval = data['heartbeat_interval'] / 1000.0 |
|
|
interval = data['heartbeat_interval'] / 1000.0 |
|
|
self._keep_alive = VoiceKeepAliveHandler(ws=self, interval=min(interval, 5.0)) |
|
|
self._keep_alive = VoiceKeepAliveHandler(ws=self, interval=min(interval, 5.0)) |
|
|
|
@ -266,7 +266,7 @@ class VoiceConnectionState: |
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
|
def max_dave_protocol_version(self) -> int: |
|
|
def max_dave_protocol_version(self) -> int: |
|
|
return davey.DAVE_PROTOCOL_VERSION |
|
|
return davey.DAVE_PROTOCOL_VERSION if has_dave else 0 |
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
|
def can_encrypt(self) -> bool: |
|
|
def can_encrypt(self) -> bool: |
|
@ -274,6 +274,8 @@ class VoiceConnectionState: |
|
|
|
|
|
|
|
|
async def reinit_dave_session(self) -> None: |
|
|
async def reinit_dave_session(self) -> None: |
|
|
if self.dave_protocol_version > 0: |
|
|
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: |
|
|
if self.dave_session: |
|
|
self.dave_session.reinit(self.dave_protocol_version, self.user.id, self.voice_client.channel.id) |
|
|
self.dave_session.reinit(self.dave_protocol_version, self.user.id, self.voice_client.channel.id) |
|
|
else: |
|
|
else: |
|
|