diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2023-03-12 01:26:15 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2023-03-12 01:33:31 -0500 |
| commit | a8c22eda0c6ab57b71541da27e2f1a500262d4ab (patch) | |
| tree | 9c77885a8065bae2ce38c7c81e1b00a6f5a17ae1 /AudioBackend | |
| parent | c520d84a0e3755557f0c8bb47d691fd2beb89c26 (diff) | |
| download | DLAP-a8c22eda0c6ab57b71541da27e2f1a500262d4ab.tar.gz DLAP-a8c22eda0c6ab57b71541da27e2f1a500262d4ab.tar.bz2 DLAP-a8c22eda0c6ab57b71541da27e2f1a500262d4ab.zip | |
Fixed some issues and updated packages
Diffstat (limited to 'AudioBackend')
| -rw-r--r-- | AudioBackend/VoiceInitialization.js | 11 |
1 files changed, 3 insertions, 8 deletions
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() => { |
