Skip to content

Commit

Permalink
Use song.duration if string, else always format duration from seconds…
Browse files Browse the repository at this point in the history
… integer value.
  • Loading branch information
NovaLynxie committed Jan 27, 2022
1 parent 6415483 commit a115208
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/commands/music/music.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,15 @@ module.exports = {
logger.verbose(`queue.section.length=${section.length}`);
logger.verbose(`pageNo:${index}; posNo:${pos};`)
for (const item of section) {
let { title, duration, type, url } = item;
let { title, duration, type, url } = item;
try {
switch (type) {
case "youtube":
field = {
name: `Track #${no}`,
value: `
Title: ${title}
Duration: ${formatDuration(duration)}
Duration: ${(typeof duration === 'string') ? duration : formatDuration(duration)}
Sourced from YouTube`
};
break;
Expand All @@ -309,7 +309,7 @@ module.exports = {
name: `Track #${no}`,
value: `
Title: ${title}
Duration: ${formatDuration(duration)}
Duration: ${(typeof duration === 'string') ? duration : formatDuration(duration)}
Sourced from SoundCloud`
};
break;
Expand Down Expand Up @@ -400,15 +400,15 @@ module.exports = {
playerState = 'Player Off';
};
};
if (!connection) playerState = 'Voice D/C 🔇';
if (!connection) playerState = 'Voice D/C 🔇';
playerEmbed.fields = [
{
name: 'Player Status',
value: (playerState) ? playerState : '...',
},
{
name: 'Song Information',
value: `${(song) ? `${(song.title) ? `${song.title.replace("''", "'")}` : 'unknown'} (${(song.type) ? song.type : 'unknown'})` : '...'} (${(song.duration ? formatDuration(song.duration) : '--:--')})`, inline: true
value: `${(song) ? `${(song.title) ? `${song.title.replace("''", "'")}` : 'unknown'} (${(song.type) ? song.type : 'unknown'})` : '...'} (${(song.duration ? (typeof song.duration === 'string') ? song.duration : formatDuration(song.duration) : '--:--')})`, inline: true
},
{
name: 'Volume', value: `${Math.floor(voiceData.volume * 100)}%`, inline: true
Expand Down

0 comments on commit a115208

Please sign in to comment.