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
|
@ -37,6 +37,19 @@ export async function voiceInit(bot) {
|
||||||
connection.on(VoiceConnectionStatus.Connecting, () => {
|
connection.on(VoiceConnectionStatus.Connecting, () => {
|
||||||
console.log(`Connecting to ${channel.name}...`);
|
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() => {
|
connection.on(VoiceConnectionStatus.Ready, async() => {
|
||||||
console.log('Ready to blast some beats!');
|
console.log('Ready to blast some beats!');
|
||||||
|
|
Loading…
Reference in a new issue