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?
#Understanding a function
11 messages · Page 1 of 1 (latest)
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
So should I loop for i to get all songs in the queue or would there be a simpler way?