Skip to content

Commit

Permalink
Add self_deaf/mute to move_to
Browse files Browse the repository at this point in the history
  • Loading branch information
EvieePy committed Nov 27, 2023
1 parent 5f64fd8 commit 7e948f5
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions wavelink/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,8 @@ async def move_to(
channel: VocalGuildChannel | None,
*,
timeout: float = 10.0,
self_deaf: bool = False,
self_mute: bool = False,
self_deaf: bool | None = None,
self_mute: bool | None = None,
) -> None:
"""Method to move the player to another channel.
Expand All @@ -541,6 +541,12 @@ async def move_to(
The new channel to move to.
timeout: float
The timeout in ``seconds`` before raising. Defaults to 10.0.
self_deaf: bool | None
Whether to deafen when moving. Defaults to ``None`` which keeps the current setting or ``False``
if they can not be determined.
self_mute: bool | None
Whether to self mute when moving. Defaults to ``None`` which keeps the current setting or ``False``
if they can not be determined.
Raises
------
Expand All @@ -553,7 +559,18 @@ async def move_to(
raise InvalidChannelStateException(f"Player tried to move without a valid guild.")

self._connection_event.clear()
await self.guild.change_voice_state(channel=channel)
voice: discord.VoiceState | None = self.guild.me.voice

if self_deaf is None and voice:
self_deaf = voice.self_deaf

if self_mute is None and voice:
self_mute = voice.self_mute

self_deaf = bool(self_deaf)
self_mute = bool(self_mute)

await self.guild.change_voice_state(channel=channel, self_mute=self_mute, self_deaf=self_deaf)

if channel is None:
return
Expand Down

0 comments on commit 7e948f5

Please sign in to comment.