mirror of
https://github.com/Rapptz/discord.py.git
synced 2026-03-05 03:02:49 +00:00
Add warning and raise if davey is not installed
This commit is contained in:
@@ -340,6 +340,10 @@ class Client:
|
|||||||
VoiceClient.warn_nacl = False
|
VoiceClient.warn_nacl = False
|
||||||
_log.warning('PyNaCl is not installed, voice will NOT be supported')
|
_log.warning('PyNaCl is not installed, voice will NOT be supported')
|
||||||
|
|
||||||
|
if VoiceClient.warn_dave:
|
||||||
|
VoiceClient.warn_dave = False
|
||||||
|
_log.warning('davey is not installed, voice will NOT be supported')
|
||||||
|
|
||||||
async def __aenter__(self) -> Self:
|
async def __aenter__(self) -> Self:
|
||||||
await self._async_setup_hook()
|
await self._async_setup_hook()
|
||||||
return self
|
return self
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ from .gateway import *
|
|||||||
from .errors import ClientException
|
from .errors import ClientException
|
||||||
from .player import AudioPlayer, AudioSource
|
from .player import AudioPlayer, AudioSource
|
||||||
from .utils import MISSING
|
from .utils import MISSING
|
||||||
from .voice_state import VoiceConnectionState
|
from .voice_state import VoiceConnectionState, has_dave
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .gateway import DiscordVoiceWebSocket
|
from .gateway import DiscordVoiceWebSocket
|
||||||
@@ -218,6 +218,8 @@ class VoiceClient(VoiceProtocol):
|
|||||||
def __init__(self, client: Client, channel: abc.Connectable) -> None:
|
def __init__(self, client: Client, channel: abc.Connectable) -> None:
|
||||||
if not has_nacl:
|
if not has_nacl:
|
||||||
raise RuntimeError('PyNaCl library needed in order to use voice')
|
raise RuntimeError('PyNaCl library needed in order to use voice')
|
||||||
|
if not has_dave:
|
||||||
|
raise RuntimeError('davey library needed in order to use voice')
|
||||||
|
|
||||||
super().__init__(client, channel)
|
super().__init__(client, channel)
|
||||||
state = client._connection
|
state = client._connection
|
||||||
@@ -235,6 +237,7 @@ class VoiceClient(VoiceProtocol):
|
|||||||
self._connection: VoiceConnectionState = self.create_connection_state()
|
self._connection: VoiceConnectionState = self.create_connection_state()
|
||||||
|
|
||||||
warn_nacl: bool = not has_nacl
|
warn_nacl: bool = not has_nacl
|
||||||
|
warn_dave: bool = not has_dave
|
||||||
supported_modes: Tuple[SupportedModes, ...] = (
|
supported_modes: Tuple[SupportedModes, ...] = (
|
||||||
'aead_xchacha20_poly1305_rtpsize',
|
'aead_xchacha20_poly1305_rtpsize',
|
||||||
'xsalsa20_poly1305_lite',
|
'xsalsa20_poly1305_lite',
|
||||||
|
|||||||
Reference in New Issue
Block a user