fix: bot now doesn't leave when failing to find a song with no song in queue and one playing

Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
moonleay 2023-12-13 19:02:12 +01:00
parent 9b51693a75
commit 3d66548a3d
Signed by: moonleay
GPG key ID: 82667543CCD715FB

View file

@ -31,7 +31,10 @@ import dev.kord.rest.builder.message.embed
import dev.schlaubi.lavakord.audio.Link import dev.schlaubi.lavakord.audio.Link
import dev.schlaubi.lavakord.audio.player.Player import dev.schlaubi.lavakord.audio.player.Player
import dev.schlaubi.lavakord.rest.loadItem import dev.schlaubi.lavakord.rest.loadItem
import net.moonleay.botendo.util.* import net.moonleay.botendo.util.ButtonUtil
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.TimeUtil
import net.moonleay.botendo.util.UrlUtil
object MusicManager { object MusicManager {
private var musicManagerMap: MutableMap<Snowflake, GuildTrackScheduler> = mutableMapOf() private var musicManagerMap: MutableMap<Snowflake, GuildTrackScheduler> = mutableMapOf()
@ -185,7 +188,7 @@ object MusicManager {
} }
is LoadResult.NoMatches -> { is LoadResult.NoMatches -> {
if(gts.isEmpty()) { if (gts.isEmpty() && player.playingTrack == null) {
player.stopTrack() player.stopTrack()
link.destroy() link.destroy()
} }
@ -202,7 +205,7 @@ object MusicManager {
} }
} }
is LoadResult.LoadFailed -> { is LoadResult.LoadFailed -> {
if (gts.isEmpty()) { if (gts.isEmpty() && player.playingTrack == null) {
player.stopTrack() player.stopTrack()
link.destroy() link.destroy()
} }