DiscordBot
DiscordBot copied to clipboard
Music stops if Bot moved manually between voice channels
type: 'error',
message: 'WebSocket was closed before the connection was established',
error: Error: WebSocket was closed before the connection was established
at WebSocket.close (/home/PantomathBot/node_modules/ws/lib/websocket.js:217:14)
at VoiceWebSocket.reset (/home/PantomathBot/node_modules/discord.js/src/client/voice/networking/VoiceWebSocket.js:53:60)
at VoiceWebSocket.shutdown (/home/PantomathBot/node_modules/discord.js/src/client/voice/networking/VoiceWebSocket.js:44:10)
at VoiceConnection.emit (events.js:326:22)
at VoiceConnection.disconnect (/home/PantomathBot/node_modules/discord.js/src/client/voice/VoiceConnection.js:352:10)
at Player.stop_playing (/home/PantomathBot/plugins/MusicPlayer/player.js:178:20)
at StreamDispatcher.
That doesn't really seem like a bug but more of an issue that you shouldn't move the bot when something is playing, it should be moved via command.
here is the full log of the error.
The problem is not that the bot disconnects from playing music...
the bot stops when this happen.... maybe it can be solved somehow from music player... or a proteciton to only stop music from that server, and not turn off the bot :(
again using commands is the way how you are really supposed to do so safely, as the audio stream is still trying to push to the old voice channel but the bot is not in that voice channel anymore.
I think fixing this would require reworking how music playback is done. #165 is a similar problem also caused by the rudimentary audio stream handling.
#217 will fix this