mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
voice: clean up packet handling
This commit is contained in:
@@ -168,15 +168,13 @@ class VoiceWebSocket extends EventEmitter {
|
||||
break;
|
||||
/* eslint-disable no-case-declarations */
|
||||
case VoiceOPCodes.SESSION_DESCRIPTION:
|
||||
const key = new Uint8Array(new ArrayBuffer(packet.d.secret_key.length));
|
||||
for (const i in packet.d.secret_key) key[i] = packet.d.secret_key[i];
|
||||
packet.d.secret_key = new Uint8Array(packet.d.secret_key);
|
||||
/**
|
||||
* Emitted once the Voice Websocket receives a description of this voice session.
|
||||
* @param {string} encryptionMode The type of encryption being used
|
||||
* @param {Uint8Array} secretKey The secret key used for encryption
|
||||
* @param {Object} packet The received packet
|
||||
* @event VoiceWebSocket#sessionDescription
|
||||
*/
|
||||
this.emit('sessionDescription', packet.d.mode, key);
|
||||
this.emit('sessionDescription', packet.d);
|
||||
break;
|
||||
case VoiceOPCodes.CLIENT_CONNECT:
|
||||
this.connection.ssrcMap.set(+packet.d.audio_ssrc, packet.d.user_id);
|
||||
|
||||
Reference in New Issue
Block a user