jadestudios / discord-music-player

Complete framework to facilitate music commands using discord.js v14 and v13
MIT License
7 stars 3 forks source link

[BUG] Song object in Queue.play may be undefined #5

Closed thenerdoflight closed 2 years ago

thenerdoflight commented 2 years ago

Bug Description Util.best may fail a search and the song object is undefined. Queue.play does not check if song object is undefined and will throw and error when Song.data is accessed.

Expected Result Should instead throw a DMP error if this happens. Nor should the code access an undefined property.

Attachments image

Can reproduce by searching "lucky" in ytsr and getting the first result

thenerdoflight commented 2 years ago

Song object is undefined in certain cases after a failed ytsr search due to the hardcoded limit of 1. There is no song object in position 0 if the first search result is a movie. Expanding that limit to 3 and forcing a while loop on it fixes it but adds a delay between song query and play.