chalda / DiscordBot

A chat bot for discord app based off discord.js
GNU General Public License v2.0
574 stars 357 forks source link

Music stops if Bot moved manually between voice channels #171

Open botea14 opened 3 years ago

botea14 commented 3 years ago

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. (/home/PantomathBot/plugins/MusicPlayer/player.js:158:26) at StreamDispatcher.emit (events.js:314:20) at StreamDispatcher._setSpeaking (/home/PantomathBot/node_modules/discord.js/src/client/voice/dispatcher/StreamDispatcher.js:310:10) at /home/PantomathBot/node_modules/discord.js/src/client/voice/dispatcher/StreamDispatcher.js:296:12 } bot error1 bot error2

F9Alejandro commented 3 years ago

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.

botea14 commented 3 years ago

out.log

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 :(

F9Alejandro commented 3 years ago

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.

Einarin commented 3 years ago

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.

Einarin commented 2 years ago

217 will fix this