Koenie06 / Discord.js-Music

19 stars 13 forks source link

Video links not working as intended #11

Open EckigerLuca opened 2 years ago

EckigerLuca commented 2 years ago

The bot is completely crashing sometimes when using links or no results were found. The weird thing when using links is, https://youtu.be/lPzfcJY-vLU works perfectly fine, but same Video different link (https://www.youtube.com/watch?v=lPzfcJY-vLU) crashes the bot. Error:

P:\bot stuff\darling.js\node_modules\@koenie06\discord.js-music\src\index.js:34
    if(!songInfo) throw new Error(`NO_SONG: There was no song found with the name/URL '${song}'.`);
                        ^

Error: NO_SONG: There was no song found with the name/URL 'https://www.youtube.com/watch?v=lPzfcJY-vLU'.
    at Object.exports.play (P:\bot stuff\darling.js\node_modules\@koenie06\discord.js-music\src\index.js:34:25)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Also weird, using https://youtube.com/watch?v=__Q3AfVe7Ow returns https://youtube.com/watch?v=tc6LVATPddc as result. Could that be a problem with https://github.com/talmobi/yt-search ?

And is there a way to prevent the bot from crashing?

Koenie06 commented 2 years ago

You can use a .catch() after the .play() function, this should catch the error. (If not say it to me) The problem of the youtube link is annoying yes. But i do think that this is a problem in the yt-search package.. So at the moment i don't know a answer for that one