From a8c22eda0c6ab57b71541da27e2f1a500262d4ab Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 12 Mar 2023 01:26:15 -0500 Subject: Fixed some issues and updated packages --- AudioBackend/VoiceInitialization.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'AudioBackend') diff --git a/AudioBackend/VoiceInitialization.js b/AudioBackend/VoiceInitialization.js index 4821a5c..3e5e8fa 100644 --- a/AudioBackend/VoiceInitialization.js +++ b/AudioBackend/VoiceInitialization.js @@ -37,18 +37,13 @@ export async function voiceInit(bot) { connection.on(VoiceConnectionStatus.Connecting, () => { console.log(`Connecting to ${channel.name}...`); }); - - const networkStateChangeHandler = (oldNetworkState, newNetworkState) => { + 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); + Reflect.get(oldState, 'networking')?.off('stateChange', networkStateChangeHandler); + Reflect.get(newState, 'networking')?.on('stateChange', networkStateChangeHandler); }); connection.on(VoiceConnectionStatus.Ready, async() => { -- cgit v1.2.3