feat: leave vc, if there is no song next up and the current one failed to load
This commit is contained in:
parent
ae507dc4aa
commit
8b6b7dc5d5
1 changed files with 12 additions and 0 deletions
|
@ -36,6 +36,10 @@ import net.moonleay.botendo.util.*
|
|||
object MusicManager {
|
||||
private var musicManagerMap: MutableMap<Snowflake, GuildTrackScheduler> = mutableMapOf()
|
||||
|
||||
fun getMusicManager(guild: Guild): GuildTrackScheduler? {
|
||||
return musicManagerMap[guild.id]
|
||||
}
|
||||
|
||||
fun getGuildTrackScheduler(guild: Guild, player: Player): GuildTrackScheduler {
|
||||
return musicManagerMap.computeIfAbsent(guild.id) {
|
||||
GuildTrackScheduler(player)
|
||||
|
@ -181,6 +185,10 @@ object MusicManager {
|
|||
|
||||
}
|
||||
is LoadResult.NoMatches -> {
|
||||
if(gts.isEmpty()) {
|
||||
player.stopTrack()
|
||||
link.destroy()
|
||||
}
|
||||
if (!silent)
|
||||
ctx.respond {
|
||||
this.embed {
|
||||
|
@ -194,6 +202,10 @@ object MusicManager {
|
|||
}
|
||||
}
|
||||
is LoadResult.LoadFailed -> {
|
||||
if (gts.isEmpty()) {
|
||||
player.stopTrack()
|
||||
link.destroy()
|
||||
}
|
||||
if (!silent)
|
||||
ctx.respond {
|
||||
this.embed {
|
||||
|
|
Loading…
Reference in a new issue