meew0/Lethe

Next causes error and disconnects

Closed this issue · 4 comments

Queuing two songs and issuing next (with processor.js left alone) causes

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: Output stream closed
    at null._onTimeout (A:\chrome\Lethe-master\Lethe-master\node_modules\fluent-ffmpeg\lib\processor.js:476:25)
    at Timer.listOnTimeout (timers.js:92:15)

and with line 476 commented out

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: ffmpeg was killed with signal SIGTERM
    at ChildProcess.<anonymous> (A:\chrome\Lethe-master\Lethe-master\node_modules\fluent-ffmpeg\lib\processor.js:165:22)

    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
meew0 commented

A workaround is commenting out a line in fluent-ffmpeg (see the README). I haven't been able to get proper error handling working yet, I still need to do that.

meew0 commented

In commits e9f9e85 to adcf966 this particular ffmpeg error was fixed, but now discord.js crashes with the following error message:

/home/miras/Projects/lethe/node_modules/discord.js/lib/Voice/VoiceConnection.js:71
            this.instream.destroy();
                          ^

TypeError: this.instream.destroy is not a function
    at VoiceConnection.stopPlaying (/home/miras/Projects/lethe/node_modules/discord.js/lib/Voice/VoiceConnection.js:71:18)
    at playStopped (/home/miras/Projects/lethe/lethe.js:303:72)
    at Client.<anonymous> (/home/miras/Projects/lethe/lethe.js:71:5)
    at emitOne (events.js:77:13)
    at Client.emit (events.js:169:7)
    at WebSocket.websocket.onmessage (/home/miras/Projects/lethe/node_modules/discord.js/lib/Client/InternalClient.js:1056:14)
    at WebSocket.onMessage (/home/miras/Projects/lethe/node_modules/ws/lib/WebSocket.js:414:14)
    at emitTwo (events.js:92:20)
    at WebSocket.emit (events.js:172:7)
    at Receiver.ontext (/home/miras/Projects/lethe/node_modules/ws/lib/WebSocket.js:797:10)
meew0 commented

The bug was fixed in discord.js, however we will have to wait for a full release on NPM in order to be able to use this. For now, follow these steps if you absolutely need these to work:

  • git clone https://github.com/hydrabolt/discord.js.git
  • go into the folder and do npm install to install dev dependencies
  • make sure grunt CLI is installed (do sudo npm install -g grunt-cli if it's not)
  • do grunt --dev. Inside the discord.js folder there should now be a lib folder.
  • Copy the whole discord.js folder into Lethe's node_modules, replacing the old one
meew0 commented

discord.js changed to having the lib folder inside the repo again, this means that this issue is fixed in c4996ea.