#Understanding a function

11 messages · Page 1 of 1 (latest)

pale kettle
#

I'm trying to make a music bot using the discord.js API and this isn't my code as I'm a beginner but I can tell this function pulls all the song titles in the queue and kinda formats it, instead of it just being a flat array, I'm lost on where it defines the pull all song titles. I'm assuming if it can pull all the titles it can pull other details. I'm trying to pull all the song's duration as well, could someone point me in the right direction please?

#

sorry the queueString const pulls all the song titles*

ionic valve
#

song.duration gives the duration for a single requested song, and that gets mapped into an array

#

getQueue() is the function that handles the actual request for the songs

#

So basically from what I can see, getQueue() returns a JSON-like object, and the song durations are at queue.tracks[i].song.duration

pale kettle
#

So should I loop for i to get all songs in the queue or would there be a simpler way?

ionic valve
#

See what client.player.getQueue() contains or returns

#

That's on the second line of the code

pale kettle
#

alright

#

it returns this

#

once theres more than 3 songs in the queue 💀