<commit_before>package me.mrkirby153.KirBot.command.executors.music

import me.mrkirby153.KirBot.command.Command
import net.dv8tion.jda.core.entities.Message
import net.dv8tion.jda.core.entities.MessageEmbed
import net.dv8tion.jda.core.u
import java.awt.Color

@Command(name = "queue", description = "Shows the current play queue")
class CommandQueue : MusicCommand() {
    override fun exec(message: Message, args: Array<String>) {
        val queue = server.musicManager.trackScheduler.queue
        val duration = server.musicManager.trackScheduler.queueLength()

        val np = server.musicManager.trackScheduler.nowPlaying

        var displayedTracks = 0

        // Display the next five songs
        message.send().embed("Music Queue") {
            color = Color.CYAN
            np?.let {
                field("Now Playing", false, " ${formatDuration((np.duration / 1000).toInt())} __**[${np.info.title}](${np.info.uri})**__")
            }

            field("Queue", false) {
                buildString {
                    if (queue.isEmpty()) {
                        append(u("Empty Queue."))
                    } else for (track in queue) {
                        displayedTracks++
                        appendln("**$displayedTracks.** [${formatDuration((track.duration / 1000).toInt())}] __[${track.info.title}](${track.info.uri})__")
                        if (length >= MessageEmbed.VALUE_MAX_LENGTH - 200 && queue.size - displayedTracks > 0) {
                            append(" And **${queue.size - displayedTracks}** more!")
                        }
                    }
                }
            }

            field("Size", true, queue.size)
            field("Duration", true, formatDuration(duration))
        }.rest().queue()
    }


    private fun formatDuration(seconds: Int): String {
        val mins = seconds / 60
        val secs = seconds - (mins * 60)

        return buildString {
            if (mins < 10) {
                append("0$mins")
            } else {
                append(mins)<commit_msg>Fix queue display issue if there were too many songs in the queue<commit_after>package me.mrkirby153.KirBot.command.executors.music

import me.mrkirby153.KirBot.command.Command
import net.dv8tion.jda.core.entities.Message
import net.dv8tion.jda.core.entities.MessageEmbed
import net.dv8tion.jda.core.u
import java.awt.Color

@Command(name = "queue", description = "Shows the current play queue")
class CommandQueue : MusicCommand() {
    override fun exec(message: Message, args: Array<String>) {
        val queue = server.musicManager.trackScheduler.queue
        val duration = server.musicManager.trackScheduler.queueLength()

        val np = server.musicManager.trackScheduler.nowPlaying

        var displayedTracks = 0

        // Display the next five songs
        message.send().embed("Music Queue") {
            color = Color.CYAN
            np?.let {
                field("Now Playing", false, " ${formatDuration((np.duration / 1000).toInt())} __**[${np.info.title}](${np.info.uri})**__")
            }

            field("Queue", false) {
                buildString {
                    if (queue.isEmpty()) {
                        append(u("Empty Queue."))
                    } else for (track in queue) {
                        displayedTracks++
                        appendln("**$displayedTracks.** [${formatDuration((track.duration / 1000).toInt())}] __[${track.info.title}](${track.info.uri})__")
                        if (length >= MessageEmbed.VALUE_MAX_LENGTH - 200 && queue.size - displayedTracks > 0) {
                            append(" And **${queue.size - displayedTracks}** more!")
                            break
                        }
                    }
                }
            }

            field("Size", true, queue.size)
            field("Duration", true, formatDuration(duration))
        }.rest().queue()
    }


    private fun formatDuration(seconds: Int): String {
        val mins = seconds / 60
        val secs = seconds - (mins * 60)

        return buildString {
            if (mins < 10) {
                append("0$mins")
            } else {
                append(mins)
{'fraction_non_alphanumeric': 0.12494061757719715, 'fraction_numerical': 0.013776722090261283, 'mean_word_length': 1.8223860589812333, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1118763', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1119, 'n_words': 242}