Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: queue null check & queue track listing #280

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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