From eaf88384edc76fff024fa94481f6dbffa29774fd Mon Sep 17 00:00:00 2001 From: Michael Rittmeister Date: Sun, 30 Jul 2023 18:32:40 +0200 Subject: [PATCH] Update stopTrack() to stop the track instead of destroying the player --- build.gradle.kts | 2 +- .../lavakord/audio/internal/WebsocketPlayer.kt | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 1c78c78e..d41bc9ec 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "dev.schlaubi.lavakord" -version = "5.1.1" +version = "5.1.2" allprojects { repositories { diff --git a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/WebsocketPlayer.kt b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/WebsocketPlayer.kt index 52c481e4..d1e9abe2 100644 --- a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/WebsocketPlayer.kt +++ b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/audio/internal/WebsocketPlayer.kt @@ -1,9 +1,6 @@ package dev.schlaubi.lavakord.audio.internal -import dev.arbjerg.lavalink.protocol.v4.PlayerState -import dev.arbjerg.lavalink.protocol.v4.PlayerUpdate -import dev.arbjerg.lavalink.protocol.v4.Track -import dev.arbjerg.lavalink.protocol.v4.toOmissible +import dev.arbjerg.lavalink.protocol.v4.* import dev.schlaubi.lavakord.audio.Event import dev.schlaubi.lavakord.audio.TrackEndEvent import dev.schlaubi.lavakord.audio.TrackStartEvent @@ -12,7 +9,6 @@ import dev.schlaubi.lavakord.audio.player.Equalizer import dev.schlaubi.lavakord.audio.player.Filters import dev.schlaubi.lavakord.audio.player.PlayOptions import dev.schlaubi.lavakord.audio.player.Player -import dev.schlaubi.lavakord.rest.destroyPlayer import dev.schlaubi.lavakord.rest.models.FiltersObject import dev.schlaubi.lavakord.rest.models.toLavalink import dev.schlaubi.lavakord.rest.updatePlayer @@ -99,7 +95,10 @@ internal class WebsocketPlayer(internal val node: NodeImpl, internal val guildId } override suspend fun stopTrack() { - node.destroyPlayer(guildId) + node.updatePlayer( + guildId, + request = PlayerUpdate(encodedTrack = Omissible(null)) + ) playingTrack = null }