-
Notifications
You must be signed in to change notification settings - Fork 80
Bot gets disconnected from the player websocket with error 'Internal Error.' #145
Comments
It happens with me when I server deafen or mute the bot, although pausing and playing the bot sometimes fixes it |
Can reproduce this when I server deafen/mute the bot |
The best way of handling this is to pause/resume depending on the value of the |
i did manual handling for server mute and server deafen to pause and resume the music, but it still happens to me :/ |
Just do something like this for both if (newState.serverMute == true && oldState.serverMute == false && oldState.member.id == client.user.id)
return player.pause(true);
if (newState.serverMute == false && oldState.serverMute == true && oldState.member.id == client.user.id)
return player.pause(false); |
I believe this issue is due to something closing the websocket to the player. I've been logging the |
Also note that my issue isn't to do with any of the comments above. My issue happens completely randomly without ANY interaction with the bot. |
Can confirm it's the websocket being killed with code |
alright so i've been doing some testing lately, and it seems that I can no longer run into this issue I'm now using the config:
seems that the changes done in #142 are working great so far edit: i'm gonna test it for a few hours on my server running debian 11 and lavalink through docker, will post an update here to keep y'all in touch |
Please test the new build branch, I've merged #142. |
alright so, feedback few days later, my test has been a success even on my server (debian 11, lavalink through docker), no issue so far, and no errors from if you run into this issue, before posting, try to implement automatic play/pause on : server mute, server deafen, voice channel update, VC kick sharing with y'all my code for that in TS, not sure its optimal tho: Bot.on('voiceStateUpdate', async (oldState, newState) => {
let channel = oldState.channel;
if (!channel) return; // not parsing when the bot is connecting to a VC
// If the bot is disconnected from a VC, destroys the player
if (oldState.id === Bot.user.id && newState.id === Bot.user.id) {
if (!newState.channel) {
let player = Bot.music.players.get(oldState.guild.id);
if (player)
player.destroy();
}
}
// If the bot is server muted, or server demuted, then pause / resume the music
// Thanks @txj-xyz for the code
if (newState.serverMute == true && oldState.serverMute == false && oldState.member.id == Bot.user.id) {
let player = Bot.music.players.get(oldState.guild.id);
player.pause(true);
return;
}
if (newState.serverMute == false && oldState.serverMute == true && oldState.member.id == Bot.user.id) {
let player = Bot.music.players.get(oldState.guild.id);
player.pause(false);
return;
}
// NOTE: not parsing server deafen here but it seems to be working without it, tho my bot is always self-deafen so it may break if not?
}); // VC Region Update
Bot.on('channelUpdate', async (oldChannel: VoiceChannel, newChannel: VoiceChannel) => {
if (oldChannel.type === 'GUILD_VOICE' && newChannel.type === 'GUILD_VOICE') {
let player = Bot.music.players.get(newChannel.guild.id);
if (player) {
if (player.voiceChannel === newChannel.id) {
if (player.playing && !player.paused) {
player.pause(true);
setTimeout(() => {
player.pause(false);
}, 500); // Arbitrary cooldown, 0.5s seems to be working fine on my server but you might change this to a higher value if you're experiencing lag (haven't found a better way to do it yet)
}
}
}
}
}); |
Awesome, if everyone else reports the same thing I'll close this issue 👌🏼 |
No errors reported so far either here too however there are still some issues with moving the bot into another voice channel. Get a |
@DelxHQ I'll look into it, thanks 👌🏼 |
@DelxHQ Please try using the latest build branch, it adds better voice state handling so it may fix your issue. |
It happens less, though the same issue still occurs. Happens multiple players too it seems. |
Mine seems fine so far after 13hrs, still happens after about 2 days or so. |
Maybe I was wrong here. I've noticed it happen more and more as the bot stays online longer. |
Also moving the bot into a different channel still doesn't work. Just kills the websocket. |
Unfortunate. If you or anyone else has any ideas feel free to PR/comment on this issue, I don't use erela.js and don't plan on doing so. |
This issue could potentially be fixed by Lavalink. I've updated lavalink to the latest commit from main and have not noticed any EDIT: still broken :( |
Seems to be fixed in commit a43298f |
Interesting |
Has nothing to do with undici Has nothing much to do with lavalink Its connection instability. Lavalink controls the voice states. If lavalink looses connection players might get destroyed when reciving the connection again. The same applies to when erela js looses connection to lavalink. Which now happens more regularly from undici then it did with petitio |
I am completely unsure if this is an erela issue at all but I am experiencing an issue where music would just stop playing randomly. I get no errors or anything whenever this happens. Lavalink still sends events and still play's music according to the logs, though I think my bot just stops sending voice data to Discord.
The only way to have it send data again, is to destroy the player and create it again.
The text was updated successfully, but these errors were encountered: