Skip to content

Commit

Permalink
Merge pull request #280 from samdammers/fix-queue-master
Browse files Browse the repository at this point in the history
fix: queue null check & queue track listing
  • Loading branch information
TannerGabriel authored Jun 2, 2024
2 parents cf3ae68 + 035271d commit edb283b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions commands/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!'
})
}
}
Expand Down

0 comments on commit edb283b

Please sign in to comment.