AleixFerre / catabot

DISCONTINUED 🤖 - Benvingut al millor bot de Discord en Català! :D
https://aleixferre.github.io/catabot/
MIT License
11 stars 3 forks source link

[BUG] - Fail when pause, playnow and then resume #156

Closed AleixFerre closed 3 years ago

AleixFerre commented 3 years ago

If you have a song playing, pause it, add another song to the queue and then resume the song, the bot tries to WRITE IN A ENDED STREAM

Log:

 Sep 23 19:00:32 catabot app/worker.1 !p https://youtu.be/DPgE7PNzXag
 Sep 23 19:06:33 catabot app/worker.1 !pause
 Sep 23 19:08:54 catabot app/worker.1 !playnow https://youtu.be/sNySpPlSqhQ
 Sep 23 19:09:03 catabot app/worker.1 !play
 Sep 23 19:09:13 catabot app/worker.1 !resume
 Sep 23 19:09:13 catabot app/worker.1 Error [ERR_STREAM_WRITE_AFTER_END]: write after end
 Sep 23 19:09:13 catabot app/worker.1     at StreamDispatcher.Writable.write (internal/streams/writable.js:292:11)
 Sep 23 19:09:13 catabot app/worker.1     at Encoder.ondata (internal/streams/readable.js:726:22)
 Sep 23 19:09:13 catabot app/worker.1     at Encoder.emit (events.js:400:28)
 Sep 23 19:09:13 catabot app/worker.1     at Encoder.Readable.read (internal/streams/readable.js:500:10)
 Sep 23 19:09:13 catabot app/worker.1     at flow (internal/streams/readable.js:982:34)
 Sep 23 19:09:13 catabot app/worker.1     at resume_ (internal/streams/readable.js:963:3)
 Sep 23 19:09:13 catabot app/worker.1     at processTicksAndRejections (internal/process/task_queues.js:82:21) {
 Sep 23 19:09:13 catabot app/worker.1   code: 'ERR_STREAM_WRITE_AFTER_END'
 Sep 23 19:09:13 catabot app/worker.1 }
AleixFerre commented 3 years ago

It just needs to resume when paused and you execute the playnow command. Fixed in the last commit