Open Henrik-Henkel opened 1 year ago
I have the same thing going on
How to Fix?
Discord has made an announcement on the Discord Developers server in regards to the change that broke most musicbots.
Whoops. Didn't mean to close the issue... Can we get an update for the bot?
Discord has made an announcement on the Discord Developers server in regards to the change that broke most musicbots.
Okay, that's all, but how to fix the situation or wait for the expected fifteen years?
I think only the author can provide us with a fix for that
Modified from this: https://github.com/discordjs/discord.js/issues/9185#issuecomment-1452514375
This is an issue inside of discord.js related to the screenshot above. You can add a patch to distube (a node module used in this bot) which seems to fix the issue.
MusicBot/node_modules/distube/dist/index.js
Above this around line 754
this.connection.on(import_voice.VoiceConnectionStatus.Disconnected, (_, newState) => {
Add this:
this.connection.on('stateChange', (oldState, newState) => {
const oldNetworking = Reflect.get(oldState, 'networking');
const newNetworking = Reflect.get(newState, 'networking');
const networkStateChangeHandler = (oldNetworkState, newNetworkState) => {
const newUdp = Reflect.get(newNetworkState, 'udp');
clearInterval(newUdp?.keepAliveInterval);
}
oldNetworking?.off('stateChange', networkStateChangeHandler);
newNetworking?.on('stateChange', networkStateChangeHandler);
});
like this?
like this?
Above that, not below.
like this?
Above that, not below.
It worked, wow!!!!!
Modified from this: discordjs/discord.js#9185 (comment)
This is an issue inside of discord.js related to the screenshot above. You can add a patch to distube (a node module used in this bot) which seems to fix the issue.
MusicBot/node_modules/distube/dist/index.js Above this around line 754
this.connection.on(import_voice.VoiceConnectionStatus.Disconnected, (_, newState) => {
Add this: this.connection.on('stateChange', (oldState, newState) => { const oldNetworking = Reflect.get(oldState, 'networking'); const newNetworking = Reflect.get(newState, 'networking'); const networkStateChangeHandler = (oldNetworkState, newNetworkState) => { const newUdp = Reflect.get(newNetworkState, 'udp'); clearInterval(newUdp?.keepAliveInterval); } oldNetworking?.off('stateChange', networkStateChangeHandler); newNetworking?.on('stateChange', networkStateChangeHandler); });
That comment has been updated according to https://github.com/discordjs/discord.js/issues/9185#issuecomment-1459083216 So in this case, you should use:
const networkStateChangeHandler = (oldNetworkState, newNetworkState) => {
const newUdp = Reflect.get(newNetworkState, 'udp');
clearInterval(newUdp?.keepAliveInterval);
}
this.connection.on('stateChange', (oldState, newState) => {
Reflect.get(oldState, 'networking')?.off('stateChange', networkStateChangeHandler);
Reflect.get(newState, 'networking')?.on('stateChange', networkStateChangeHandler);
});
any update?
any update?
I think the issue in discordjs is actually fixed now so you can just update it using npm i @discordjs/voice@latest
and it should work.
Modified from this: discordjs/discord.js#9185 (comment)
This is an issue inside of discord.js related to the screenshot above. You can add a patch to distube (a node module used in this bot) which seems to fix the issue.
MusicBot/node_modules/distube/dist/index.js Above this around line 754
this.connection.on(import_voice.VoiceConnectionStatus.Disconnected, (_, newState) => {
Add this: this.connection.on('stateChange', (oldState, newState) => { const oldNetworking = Reflect.get(oldState, 'networking'); const newNetworking = Reflect.get(newState, 'networking'); const networkStateChangeHandler = (oldNetworkState, newNetworkState) => { const newUdp = Reflect.get(newNetworkState, 'udp'); clearInterval(newUdp?.keepAliveInterval); } oldNetworking?.off('stateChange', networkStateChangeHandler); newNetworking?.on('stateChange', networkStateChangeHandler); });
I changed code like this and used npm i @discordjs/voice@latest
.
However, I saw this issue again.
What I should do?
I was fixed this problem. I seted like this.
client.config = config;
client.player = new DisTube(client, {
leaveOnStop: config.opt.voiceConfig.leaveOnStop,
leaveOnFinish: config.opt.voiceConfig.leaveOnFinish,
leaveOnEmpty: config.opt.voiceConfig.leaveOnEmpty.status,
emitNewSongOnly: true,
emitAddSongWhenCreatingQueue: false,
emitAddListWhenCreatingQueue: false,
plugins: [
new SpotifyPlugin(),
new SoundCloudPlugin(),
new YtDlpPlugin(),
new DeezerPlugin(),
],
});
However, this change is for my program. So, it may not be a good change for programs in this repository.
How do I fix it ?
After running npm i
, run node index.js
.
Does that fix it?
run this command
npm i @discordjs/voice@latest
thx it worked
The bot stops playing after around 1 minute of playback... No error in the console.
Any idea what could be causing this?