Add self_deaf and self_mute params to voice connect methods

This commit is contained in:
Vaskel
2022-04-14 19:06:22 -04:00
committed by GitHub
parent 862eba1e59
commit 89b9f1616c
3 changed files with 29 additions and 6 deletions

View File

@ -1783,6 +1783,8 @@ class Connectable(Protocol):
timeout: float = 60.0,
reconnect: bool = True,
cls: Callable[[Client, Connectable], T] = MISSING,
self_deaf: bool = False,
self_mute: bool = False,
) -> T:
"""|coro|
@ -1802,6 +1804,14 @@ class Connectable(Protocol):
cls: Type[:class:`~discord.VoiceProtocol`]
A type that subclasses :class:`~discord.VoiceProtocol` to connect with.
Defaults to :class:`~discord.VoiceClient`.
self_mute: :class:`bool`
Indicates if the client should be self-muted.
.. versionadded: 2.0
self_deaf: :class:`bool`
Indicates if the client should be self-deafened.
.. versionadded: 2.0
Raises
-------
@ -1838,7 +1848,7 @@ class Connectable(Protocol):
state._add_voice_client(key_id, voice)
try:
await voice.connect(timeout=timeout, reconnect=reconnect)
await voice.connect(timeout=timeout, reconnect=reconnect, self_deaf=self_deaf, self_mute=self_mute)
except asyncio.TimeoutError:
try:
await voice.disconnect(force=True)