From 035271df2799b91dcaa6939b96412f35f3b6c00e Mon Sep 17 00:00:00 2001 From: Sam Dammers Date: Sat, 1 Jun 2024 18:09:24 +1000 Subject: [PATCH] fix: queue null check & queue track listing --- commands/queue.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/commands/queue.js b/commands/queue.js index 690f6565..ab82f241 100644 --- a/commands/queue.js +++ b/commands/queue.js @@ -12,19 +12,27 @@ module.exports = { } const queue = useQueue(interaction.guild.id) - if (typeof (queue) != 'undefined') { + if (queue != null) { const trimString = (str, max) => ((str.length > max) ? `${str.slice(0, max - 3)}...` : str); + + let queueStr = `🎶 | **Upcoming Songs:**\n` + + // Build queue list + queue.tracks.data.forEach((track, index) => { + queueStr += `${index + 1}. ${track.title} - ${track.author}\n`; + }); + return void interaction.reply({ embeds: [ { - title: 'Now Playing', - description: trimString(`The Current song playing is 🎶 | **${queue.currentTrack.title}**! \n 🎶 | ${queue}! `, 4095), + title: `Now Playing 🎶 | **${queue.currentTrack.title}**`, + description: trimString(queueStr, 4095), } ] }) } else { return void interaction.reply({ - content: 'There is no song in the queue!' + content: 'There are no songs in the queue!' }) } }