mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
fix: Better handling and formatting of duration
This commit is contained in:
1 parent
b8bd552335
commit
ebe4f7419a
1 file changed
+15
-3
+15
-3
@@ -68,9 +68,14 @@ module.exports = {
|
|||||||
queueString = queue.tracks.data
|
queueString = queue.tracks.data
|
||||||
.slice(page * 10, page * 10 + 10)
|
.slice(page * 10, page * 10 + 10)
|
||||||
.map((track, index) => {
|
.map((track, index) => {
|
||||||
return `**${page * 10 + index + 1}.** \`[${
|
let durationFormat =
|
||||||
track.duration
|
track.raw.duration === 0 || track.duration === '0:00'
|
||||||
}]\` [${track.title}](${track.url})`;
|
? ''
|
||||||
|
: `\`[${track.duration}]\``;
|
||||||
|
|
||||||
|
return `**${page * 10 + index + 1}.** ${durationFormat} [${
|
||||||
|
track.title
|
||||||
|
}](${track.url})`;
|
||||||
})
|
})
|
||||||
.join('\n');
|
.join('\n');
|
||||||
}
|
}
|
||||||
@@ -98,6 +103,13 @@ module.exports = {
|
|||||||
length: 13
|
length: 13
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (
|
||||||
|
currentTrack.raw.duration === 0 ||
|
||||||
|
currentTrack.duration === '0:00'
|
||||||
|
) {
|
||||||
|
bar = 'No duration available.';
|
||||||
|
}
|
||||||
|
|
||||||
return await interaction.editReply({
|
return await interaction.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
|
|||||||
Reference in new issue
Block a user