mirror of
https://github.com/Alee14/DLAP.git
synced 2025-01-22 19:02:57 -05:00
Hopefully fixed an issue that causes the audio to stop in a minute?
This commit is contained in:
parent
4f5a9747dc
commit
c520d84a0e
1 changed files with 13 additions and 0 deletions
|
@ -38,6 +38,19 @@ export async function voiceInit(bot) {
|
|||
console.log(`Connecting to ${channel.name}...`);
|
||||
});
|
||||
|
||||
const networkStateChangeHandler = (oldNetworkState, newNetworkState) => {
|
||||
const newUdp = Reflect.get(newNetworkState, 'udp');
|
||||
clearInterval(newUdp?.keepAliveInterval);
|
||||
};
|
||||
|
||||
connection.on('stateChange', (oldState, newState) => {
|
||||
const oldNetworking = Reflect.get(oldState, 'networking');
|
||||
const newNetworking = Reflect.get(newState, 'networking');
|
||||
|
||||
oldNetworking?.off('stateChange', networkStateChangeHandler);
|
||||
newNetworking?.on('stateChange', networkStateChangeHandler);
|
||||
});
|
||||
|
||||
connection.on(VoiceConnectionStatus.Ready, async() => {
|
||||
console.log('Ready to blast some beats!');
|
||||
return (shuffle) ? await shufflePlaylist(bot) : await orderPlaylist(bot);
|
||||
|
|
Loading…
Reference in a new issue