add move_to in player class
This commit is contained in:
parent
74256dc5ac
commit
4caaff8b04
|
|
@ -506,7 +506,7 @@ class Player(VoiceProtocol):
|
||||||
for filter in track.filters:
|
for filter in track.filters:
|
||||||
await self.add_filter(_filter=filter)
|
await self.add_filter(_filter=filter)
|
||||||
|
|
||||||
# Lavalink v4 changed the way the end time parameter works
|
# Lavalink v3.7.5 changed the way the end time parameter works
|
||||||
# so now the end time cannot be zero.
|
# so now the end time cannot be zero.
|
||||||
# If it isnt zero, it'll be set to None.
|
# If it isnt zero, it'll be set to None.
|
||||||
# Otherwise, it'll be set here:
|
# Otherwise, it'll be set here:
|
||||||
|
|
@ -574,6 +574,24 @@ class Player(VoiceProtocol):
|
||||||
self._log.debug(f"Player volume has been adjusted to {volume}")
|
self._log.debug(f"Player volume has been adjusted to {volume}")
|
||||||
return self._volume
|
return self._volume
|
||||||
|
|
||||||
|
async def move_to(self, *, channel: VoiceChannel) -> None:
|
||||||
|
"""Moves the player to a new voice channel."""
|
||||||
|
|
||||||
|
if self.current:
|
||||||
|
data: dict = {"position": self.position, "encodedTrack": self.current.track_id}
|
||||||
|
|
||||||
|
await self.guild.change_voice_state(channel=channel)
|
||||||
|
|
||||||
|
self.channel = channel
|
||||||
|
|
||||||
|
await self._dispatch_voice_update()
|
||||||
|
await self._node.send(
|
||||||
|
method="PATCH",
|
||||||
|
path=self._player_endpoint_uri,
|
||||||
|
guild_id=self._guild.id,
|
||||||
|
data=data,
|
||||||
|
)
|
||||||
|
|
||||||
async def add_filter(self, _filter: Filter, fast_apply: bool = False) -> Filters:
|
async def add_filter(self, _filter: Filter, fast_apply: bool = False) -> Filters:
|
||||||
"""Adds a filter to the player. Takes a pomice.Filter object.
|
"""Adds a filter to the player. Takes a pomice.Filter object.
|
||||||
This will only work if you are using a version of Lavalink that supports filters.
|
This will only work if you are using a version of Lavalink that supports filters.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue