Skip to content

Commit

Permalink
The "Next Song" field for &nowplaying
Browse files Browse the repository at this point in the history
  • Loading branch information
ileukocyte committed Aug 31, 2022
1 parent 5d9d430 commit d0db920
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,30 @@ class NowPlayingCommand : TextCommand {
.takeUnless { track.info.isStream } ?: "(LIVE)")
}

if (musicManager.scheduler.queue.isNotEmpty()) {
val next = musicManager.scheduler.queue.first()

field {
val userData = next.customUserData

val trackTitle = next.info.uri.maskedLink(
next.info.title
.limitTo(32)
.replace('[', '(')
.replace(']', ')')
)

val trackDuration = if (next.info.isStream) {
"LIVE"
} else {
asDuration(next.duration)
}

title = "Next Song"
description = "$trackTitle ($trackDuration, ${userData.requester?.asMention ?: "unknown requester"})"
}
}

author {
name = "HiberPlayer"
iconUrl = jda.selfUser.effectiveAvatarUrl
Expand Down

0 comments on commit d0db920

Please sign in to comment.