fix(Voice): only skip undocumented voice packet byte if present (#5309)

* fix(Voice*): Only skip undocumented byte if present

* fix linting errors
This commit is contained in:
Carson M
2021-04-05 02:56:48 -05:00
committed by GitHub
parent 67025e63e4
commit 2b52cdc915

View File

@@ -72,8 +72,9 @@ class PacketHandler extends EventEmitter {
if (byte === 0) continue;
offset += 1 + (0b1111 & (byte >> 4));
}
// Skip over undocumented Discord byte
offset++;
// Skip over undocumented Discord byte (if present)
const byte = packet.readUInt8(offset);
if (byte === 0x00 || byte === 0x02) offset++;
packet = packet.slice(offset);
}