@discordjs/voice 1.0.0-dev.1752321900-591668099 → 1.0.0-dev.1752452152-7e3d4e536
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +287 -8
- package/dist/index.d.ts +287 -8
- package/dist/index.js +1462 -925
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1454 -918
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -13
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ import { Buffer } from 'node:buffer';
|
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
3
|
import { Readable, ReadableOptions } from 'node:stream';
|
|
4
4
|
import prism from 'prism-media';
|
|
5
|
+
import { VoiceDavePrepareTransitionData, VoiceDavePrepareEpochData, VoiceOpcodes, VoiceSendPayload, VoiceReceivePayload } from 'discord-api-types/voice/v8';
|
|
5
6
|
import WebSocket, { MessageEvent } from 'ws';
|
|
6
7
|
import { GatewayVoiceServerUpdateDispatchData, GatewayVoiceStateUpdateDispatchData } from 'discord-api-types/v10';
|
|
7
8
|
|
|
@@ -556,6 +557,174 @@ declare function getVoiceConnections(group: string): Map<string, VoiceConnection
|
|
|
556
557
|
*/
|
|
557
558
|
declare function getVoiceConnection(guildId: string, group?: string): VoiceConnection | undefined;
|
|
558
559
|
|
|
560
|
+
interface SessionMethods {
|
|
561
|
+
canPassthrough(userId: string): boolean;
|
|
562
|
+
decrypt(userId: string, mediaType: 0 | 1, packet: Buffer): Buffer;
|
|
563
|
+
encryptOpus(packet: Buffer): Buffer;
|
|
564
|
+
getSerializedKeyPackage(): Buffer;
|
|
565
|
+
getVerificationCode(userId: string): Promise<string>;
|
|
566
|
+
processCommit(commit: Buffer): void;
|
|
567
|
+
processProposals(optype: 0 | 1, proposals: Buffer, recognizedUserIds?: string[]): ProposalsResult;
|
|
568
|
+
processWelcome(welcome: Buffer): void;
|
|
569
|
+
ready: boolean;
|
|
570
|
+
reinit(protocolVersion: number, userId: string, channelId: string): void;
|
|
571
|
+
reset(): void;
|
|
572
|
+
setExternalSender(externalSender: Buffer): void;
|
|
573
|
+
setPassthroughMode(passthrough: boolean, expiry: number): void;
|
|
574
|
+
voicePrivacyCode: string;
|
|
575
|
+
}
|
|
576
|
+
interface ProposalsResult {
|
|
577
|
+
commit?: Buffer;
|
|
578
|
+
welcome?: Buffer;
|
|
579
|
+
}
|
|
580
|
+
interface TransitionResult {
|
|
581
|
+
success: boolean;
|
|
582
|
+
transitionId: number;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Options that dictate the session behavior.
|
|
586
|
+
*/
|
|
587
|
+
interface DAVESessionOptions {
|
|
588
|
+
decryptionFailureTolerance?: number | undefined;
|
|
589
|
+
}
|
|
590
|
+
interface DAVESession extends EventEmitter {
|
|
591
|
+
on(event: 'error', listener: (error: Error) => void): this;
|
|
592
|
+
on(event: 'debug', listener: (message: string) => void): this;
|
|
593
|
+
on(event: 'keyPackage', listener: (message: Buffer) => void): this;
|
|
594
|
+
on(event: 'invalidateTransition', listener: (transitionId: number) => void): this;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Manages the DAVE protocol group session.
|
|
598
|
+
*/
|
|
599
|
+
declare class DAVESession extends EventEmitter {
|
|
600
|
+
/**
|
|
601
|
+
* The channel id represented by this session.
|
|
602
|
+
*/
|
|
603
|
+
channelId: string;
|
|
604
|
+
/**
|
|
605
|
+
* The user id represented by this session.
|
|
606
|
+
*/
|
|
607
|
+
userId: string;
|
|
608
|
+
/**
|
|
609
|
+
* The protocol version being used.
|
|
610
|
+
*/
|
|
611
|
+
protocolVersion: number;
|
|
612
|
+
/**
|
|
613
|
+
* The last transition id executed.
|
|
614
|
+
*/
|
|
615
|
+
lastTransitionId?: number | undefined;
|
|
616
|
+
/**
|
|
617
|
+
* The pending transition.
|
|
618
|
+
*/
|
|
619
|
+
private pendingTransition?;
|
|
620
|
+
/**
|
|
621
|
+
* Whether this session was downgraded previously.
|
|
622
|
+
*/
|
|
623
|
+
private downgraded;
|
|
624
|
+
/**
|
|
625
|
+
* The amount of consecutive failures encountered when decrypting.
|
|
626
|
+
*/
|
|
627
|
+
private consecutiveFailures;
|
|
628
|
+
/**
|
|
629
|
+
* The amount of consecutive failures needed to attempt to recover.
|
|
630
|
+
*/
|
|
631
|
+
private readonly failureTolerance;
|
|
632
|
+
/**
|
|
633
|
+
* Whether this session is currently re-initializing due to an invalid transition.
|
|
634
|
+
*/
|
|
635
|
+
reinitializing: boolean;
|
|
636
|
+
/**
|
|
637
|
+
* The underlying DAVE Session of this wrapper.
|
|
638
|
+
*/
|
|
639
|
+
session: SessionMethods | undefined;
|
|
640
|
+
constructor(protocolVersion: number, userId: string, channelId: string, options: DAVESessionOptions);
|
|
641
|
+
/**
|
|
642
|
+
* The current voice privacy code of the session. Will be `null` if there is no session.
|
|
643
|
+
*/
|
|
644
|
+
get voicePrivacyCode(): string | null;
|
|
645
|
+
/**
|
|
646
|
+
* Gets the verification code for a user in the session.
|
|
647
|
+
*
|
|
648
|
+
* @throws Will throw if there is not an active session or the user id provided is invalid or not in the session.
|
|
649
|
+
*/
|
|
650
|
+
getVerificationCode(userId: string): Promise<string>;
|
|
651
|
+
/**
|
|
652
|
+
* Re-initializes (or initializes) the underlying session.
|
|
653
|
+
*/
|
|
654
|
+
reinit(): void;
|
|
655
|
+
/**
|
|
656
|
+
* Set the external sender for this session.
|
|
657
|
+
*
|
|
658
|
+
* @param externalSender - The external sender
|
|
659
|
+
*/
|
|
660
|
+
setExternalSender(externalSender: Buffer): void;
|
|
661
|
+
/**
|
|
662
|
+
* Prepare for a transition.
|
|
663
|
+
*
|
|
664
|
+
* @param data - The transition data
|
|
665
|
+
* @returns Whether we should signal to the voice server that we are ready
|
|
666
|
+
*/
|
|
667
|
+
prepareTransition(data: VoiceDavePrepareTransitionData): boolean;
|
|
668
|
+
/**
|
|
669
|
+
* Execute a transition.
|
|
670
|
+
*
|
|
671
|
+
* @param transitionId - The transition id to execute on
|
|
672
|
+
*/
|
|
673
|
+
executeTransition(transitionId: number): boolean | undefined;
|
|
674
|
+
/**
|
|
675
|
+
* Prepare for a new epoch.
|
|
676
|
+
*
|
|
677
|
+
* @param data - The epoch data
|
|
678
|
+
*/
|
|
679
|
+
prepareEpoch(data: VoiceDavePrepareEpochData): void;
|
|
680
|
+
/**
|
|
681
|
+
* Recover from an invalid transition by re-initializing.
|
|
682
|
+
*
|
|
683
|
+
* @param transitionId - The transition id to invalidate
|
|
684
|
+
*/
|
|
685
|
+
recoverFromInvalidTransition(transitionId: number): void;
|
|
686
|
+
/**
|
|
687
|
+
* Processes proposals from the MLS group.
|
|
688
|
+
*
|
|
689
|
+
* @param payload - The binary message payload
|
|
690
|
+
* @param connectedClients - The set of connected client IDs
|
|
691
|
+
* @returns The payload to send back to the voice server, if there is one
|
|
692
|
+
*/
|
|
693
|
+
processProposals(payload: Buffer, connectedClients: Set<string>): Buffer | undefined;
|
|
694
|
+
/**
|
|
695
|
+
* Processes a commit from the MLS group.
|
|
696
|
+
*
|
|
697
|
+
* @param payload - The payload
|
|
698
|
+
* @returns The transaction id and whether it was successful
|
|
699
|
+
*/
|
|
700
|
+
processCommit(payload: Buffer): TransitionResult;
|
|
701
|
+
/**
|
|
702
|
+
* Processes a welcome from the MLS group.
|
|
703
|
+
*
|
|
704
|
+
* @param payload - The payload
|
|
705
|
+
* @returns The transaction id and whether it was successful
|
|
706
|
+
*/
|
|
707
|
+
processWelcome(payload: Buffer): TransitionResult;
|
|
708
|
+
/**
|
|
709
|
+
* Encrypt a packet using end-to-end encryption.
|
|
710
|
+
*
|
|
711
|
+
* @param packet - The packet to encrypt
|
|
712
|
+
*/
|
|
713
|
+
encrypt(packet: Buffer): Buffer;
|
|
714
|
+
/**
|
|
715
|
+
* Decrypt a packet using end-to-end encryption.
|
|
716
|
+
*
|
|
717
|
+
* @param packet - The packet to decrypt
|
|
718
|
+
* @param userId - The user id that sent the packet
|
|
719
|
+
* @returns The decrypted packet, or `null` if the decryption failed but should be ignored
|
|
720
|
+
*/
|
|
721
|
+
decrypt(packet: Buffer, userId: string): Buffer | null;
|
|
722
|
+
/**
|
|
723
|
+
* Resets the session.
|
|
724
|
+
*/
|
|
725
|
+
destroy(): void;
|
|
726
|
+
}
|
|
727
|
+
|
|
559
728
|
/**
|
|
560
729
|
* Stores an IP address and port. Used to store socket details for the local client as well as
|
|
561
730
|
* for Discord.
|
|
@@ -634,6 +803,14 @@ declare class VoiceUDPSocket extends EventEmitter {
|
|
|
634
803
|
performIPDiscovery(ssrc: number): Promise<SocketConfig>;
|
|
635
804
|
}
|
|
636
805
|
|
|
806
|
+
/**
|
|
807
|
+
* A binary WebSocket message.
|
|
808
|
+
*/
|
|
809
|
+
interface BinaryWebSocketMessage {
|
|
810
|
+
op: VoiceOpcodes;
|
|
811
|
+
payload: Buffer;
|
|
812
|
+
seq: number;
|
|
813
|
+
}
|
|
637
814
|
interface VoiceWebSocket extends EventEmitter {
|
|
638
815
|
on(event: 'error', listener: (error: Error) => void): this;
|
|
639
816
|
on(event: 'open', listener: (event: WebSocket.Event) => void): this;
|
|
@@ -650,6 +827,12 @@ interface VoiceWebSocket extends EventEmitter {
|
|
|
650
827
|
* @eventProperty
|
|
651
828
|
*/
|
|
652
829
|
on(event: 'packet', listener: (packet: any) => void): this;
|
|
830
|
+
/**
|
|
831
|
+
* Binary message event.
|
|
832
|
+
*
|
|
833
|
+
* @eventProperty
|
|
834
|
+
*/
|
|
835
|
+
on(event: 'binary', listener: (message: BinaryWebSocketMessage) => void): this;
|
|
653
836
|
}
|
|
654
837
|
/**
|
|
655
838
|
* An extension of the WebSocket class to provide helper functionality when interacting
|
|
@@ -702,7 +885,7 @@ declare class VoiceWebSocket extends EventEmitter {
|
|
|
702
885
|
destroy(): void;
|
|
703
886
|
/**
|
|
704
887
|
* Handles message events on the WebSocket. Attempts to JSON parse the messages and emit them
|
|
705
|
-
* as packets.
|
|
888
|
+
* as packets. Binary messages will be parsed and emitted.
|
|
706
889
|
*
|
|
707
890
|
* @param event - The message event
|
|
708
891
|
*/
|
|
@@ -712,7 +895,14 @@ declare class VoiceWebSocket extends EventEmitter {
|
|
|
712
895
|
*
|
|
713
896
|
* @param packet - The packet to send
|
|
714
897
|
*/
|
|
715
|
-
sendPacket(packet:
|
|
898
|
+
sendPacket(packet: VoiceSendPayload): void;
|
|
899
|
+
/**
|
|
900
|
+
* Sends a binary mesasge over the WebSocket.
|
|
901
|
+
*
|
|
902
|
+
* @param opcode - The opcode to use
|
|
903
|
+
* @param payload - The payload to send
|
|
904
|
+
*/
|
|
905
|
+
sendBinaryMessage(opcode: VoiceOpcodes, payload: Buffer): void;
|
|
716
906
|
/**
|
|
717
907
|
* Sends a heartbeat over the WebSocket.
|
|
718
908
|
*/
|
|
@@ -762,7 +952,7 @@ interface NetworkingIdentifyingState {
|
|
|
762
952
|
*/
|
|
763
953
|
interface NetworkingUdpHandshakingState {
|
|
764
954
|
code: NetworkingStatusCode.UdpHandshaking;
|
|
765
|
-
connectionData: Pick<ConnectionData, 'ssrc'>;
|
|
955
|
+
connectionData: Pick<ConnectionData, 'connectedClients' | 'ssrc'>;
|
|
766
956
|
connectionOptions: ConnectionOptions;
|
|
767
957
|
udp: VoiceUDPSocket;
|
|
768
958
|
ws: VoiceWebSocket;
|
|
@@ -772,7 +962,7 @@ interface NetworkingUdpHandshakingState {
|
|
|
772
962
|
*/
|
|
773
963
|
interface NetworkingSelectingProtocolState {
|
|
774
964
|
code: NetworkingStatusCode.SelectingProtocol;
|
|
775
|
-
connectionData: Pick<ConnectionData, 'ssrc'>;
|
|
965
|
+
connectionData: Pick<ConnectionData, 'connectedClients' | 'ssrc'>;
|
|
776
966
|
connectionOptions: ConnectionOptions;
|
|
777
967
|
udp: VoiceUDPSocket;
|
|
778
968
|
ws: VoiceWebSocket;
|
|
@@ -785,6 +975,7 @@ interface NetworkingReadyState {
|
|
|
785
975
|
code: NetworkingStatusCode.Ready;
|
|
786
976
|
connectionData: ConnectionData;
|
|
787
977
|
connectionOptions: ConnectionOptions;
|
|
978
|
+
dave?: DAVESession | undefined;
|
|
788
979
|
preparedPacket?: Buffer | undefined;
|
|
789
980
|
udp: VoiceUDPSocket;
|
|
790
981
|
ws: VoiceWebSocket;
|
|
@@ -797,6 +988,7 @@ interface NetworkingResumingState {
|
|
|
797
988
|
code: NetworkingStatusCode.Resuming;
|
|
798
989
|
connectionData: ConnectionData;
|
|
799
990
|
connectionOptions: ConnectionOptions;
|
|
991
|
+
dave?: DAVESession | undefined;
|
|
800
992
|
preparedPacket?: Buffer | undefined;
|
|
801
993
|
udp: VoiceUDPSocket;
|
|
802
994
|
ws: VoiceWebSocket;
|
|
@@ -818,6 +1010,7 @@ type NetworkingState = NetworkingClosedState | NetworkingIdentifyingState | Netw
|
|
|
818
1010
|
* and VOICE_STATE_UPDATE packets.
|
|
819
1011
|
*/
|
|
820
1012
|
interface ConnectionOptions {
|
|
1013
|
+
channelId: string;
|
|
821
1014
|
endpoint: string;
|
|
822
1015
|
serverId: string;
|
|
823
1016
|
sessionId: string;
|
|
@@ -829,6 +1022,7 @@ interface ConnectionOptions {
|
|
|
829
1022
|
* the connection, timing information for playback of streams.
|
|
830
1023
|
*/
|
|
831
1024
|
interface ConnectionData {
|
|
1025
|
+
connectedClients: Set<string>;
|
|
832
1026
|
encryptionMode: string;
|
|
833
1027
|
nonce: number;
|
|
834
1028
|
nonceBuffer: Buffer;
|
|
@@ -839,6 +1033,14 @@ interface ConnectionData {
|
|
|
839
1033
|
ssrc: number;
|
|
840
1034
|
timestamp: number;
|
|
841
1035
|
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Options for networking that dictate behavior.
|
|
1038
|
+
*/
|
|
1039
|
+
interface NetworkingOptions {
|
|
1040
|
+
daveEncryption?: boolean | undefined;
|
|
1041
|
+
debug?: boolean | undefined;
|
|
1042
|
+
decryptionFailureTolerance?: number | undefined;
|
|
1043
|
+
}
|
|
842
1044
|
interface Networking extends EventEmitter {
|
|
843
1045
|
/**
|
|
844
1046
|
* Debug event for Networking.
|
|
@@ -849,6 +1051,7 @@ interface Networking extends EventEmitter {
|
|
|
849
1051
|
on(event: 'error', listener: (error: Error) => void): this;
|
|
850
1052
|
on(event: 'stateChange', listener: (oldState: NetworkingState, newState: NetworkingState) => void): this;
|
|
851
1053
|
on(event: 'close', listener: (code: number) => void): this;
|
|
1054
|
+
on(event: 'transitioned', listener: (transitionId: number) => void): this;
|
|
852
1055
|
}
|
|
853
1056
|
/**
|
|
854
1057
|
* Manages the networking required to maintain a voice connection and dispatch audio packets
|
|
@@ -859,10 +1062,14 @@ declare class Networking extends EventEmitter {
|
|
|
859
1062
|
* The debug logger function, if debugging is enabled.
|
|
860
1063
|
*/
|
|
861
1064
|
private readonly debug;
|
|
1065
|
+
/**
|
|
1066
|
+
* The options used to create this Networking instance.
|
|
1067
|
+
*/
|
|
1068
|
+
private readonly options;
|
|
862
1069
|
/**
|
|
863
1070
|
* Creates a new Networking instance.
|
|
864
1071
|
*/
|
|
865
|
-
constructor(
|
|
1072
|
+
constructor(connectionOptions: ConnectionOptions, options: NetworkingOptions);
|
|
866
1073
|
/**
|
|
867
1074
|
* Destroys the Networking instance, transitioning it into the Closed state.
|
|
868
1075
|
*/
|
|
@@ -883,7 +1090,13 @@ declare class Networking extends EventEmitter {
|
|
|
883
1090
|
*/
|
|
884
1091
|
private createWebSocket;
|
|
885
1092
|
/**
|
|
886
|
-
*
|
|
1093
|
+
* Creates a new DAVE session for this voice connection if we can create one.
|
|
1094
|
+
*
|
|
1095
|
+
* @param protocolVersion - The protocol version to use
|
|
1096
|
+
*/
|
|
1097
|
+
private createDaveSession;
|
|
1098
|
+
/**
|
|
1099
|
+
* Propagates errors from the children VoiceWebSocket, VoiceUDPSocket and DAVESession.
|
|
887
1100
|
*
|
|
888
1101
|
* @param error - The error that was emitted by a child
|
|
889
1102
|
*/
|
|
@@ -911,6 +1124,24 @@ declare class Networking extends EventEmitter {
|
|
|
911
1124
|
* @param packet - The received packet
|
|
912
1125
|
*/
|
|
913
1126
|
private onWsPacket;
|
|
1127
|
+
/**
|
|
1128
|
+
* Called when a binary message is received on the connection's WebSocket.
|
|
1129
|
+
*
|
|
1130
|
+
* @param message - The received message
|
|
1131
|
+
*/
|
|
1132
|
+
private onWsBinary;
|
|
1133
|
+
/**
|
|
1134
|
+
* Called when a new key package is ready to be sent to the voice server.
|
|
1135
|
+
*
|
|
1136
|
+
* @param keyPackage - The new key package
|
|
1137
|
+
*/
|
|
1138
|
+
private onDaveKeyPackage;
|
|
1139
|
+
/**
|
|
1140
|
+
* Called when the DAVE session wants to invalidate their transition and re-initialize.
|
|
1141
|
+
*
|
|
1142
|
+
* @param transitionId - The transition to invalidate
|
|
1143
|
+
*/
|
|
1144
|
+
private onDaveInvalidateTransition;
|
|
914
1145
|
/**
|
|
915
1146
|
* Propagates debug messages from the child WebSocket.
|
|
916
1147
|
*
|
|
@@ -923,6 +1154,12 @@ declare class Networking extends EventEmitter {
|
|
|
923
1154
|
* @param message - The emitted debug message
|
|
924
1155
|
*/
|
|
925
1156
|
private onUdpDebug;
|
|
1157
|
+
/**
|
|
1158
|
+
* Propagates debug messages from the child DAVESession.
|
|
1159
|
+
*
|
|
1160
|
+
* @param message - The emitted debug message
|
|
1161
|
+
*/
|
|
1162
|
+
private onDaveDebug;
|
|
926
1163
|
/**
|
|
927
1164
|
* Prepares an Opus packet for playback. This includes attaching metadata to it and encrypting it.
|
|
928
1165
|
* It will be stored within the instance, and can be played by dispatchAudio()
|
|
@@ -958,6 +1195,7 @@ declare class Networking extends EventEmitter {
|
|
|
958
1195
|
*
|
|
959
1196
|
* @param opusPacket - The Opus packet to prepare
|
|
960
1197
|
* @param connectionData - The current connection data of the instance
|
|
1198
|
+
* @param daveSession - The DAVE session to use for encryption
|
|
961
1199
|
*/
|
|
962
1200
|
private createAudioPacket;
|
|
963
1201
|
/**
|
|
@@ -965,6 +1203,7 @@ declare class Networking extends EventEmitter {
|
|
|
965
1203
|
*
|
|
966
1204
|
* @param opusPacket - The Opus packet to encrypt
|
|
967
1205
|
* @param connectionData - The current connection data of the instance
|
|
1206
|
+
* @param daveSession - The DAVE session to use for encryption
|
|
968
1207
|
*/
|
|
969
1208
|
private encryptOpusPacket;
|
|
970
1209
|
}
|
|
@@ -1133,7 +1372,7 @@ declare class VoiceReceiver {
|
|
|
1133
1372
|
* @param packet - The received packet
|
|
1134
1373
|
* @internal
|
|
1135
1374
|
*/
|
|
1136
|
-
onWsPacket(packet:
|
|
1375
|
+
onWsPacket(packet: VoiceReceivePayload): void;
|
|
1137
1376
|
private decrypt;
|
|
1138
1377
|
/**
|
|
1139
1378
|
* Parses an audio packet, decrypting it to yield an Opus packet.
|
|
@@ -1142,6 +1381,7 @@ declare class VoiceReceiver {
|
|
|
1142
1381
|
* @param mode - The encryption mode
|
|
1143
1382
|
* @param nonce - The nonce buffer used by the connection for encryption
|
|
1144
1383
|
* @param secretKey - The secret key used by the connection for encryption
|
|
1384
|
+
* @param userId - The user id that sent the packet
|
|
1145
1385
|
* @returns The parsed Opus packet
|
|
1146
1386
|
*/
|
|
1147
1387
|
private parsePacket;
|
|
@@ -1346,6 +1586,12 @@ interface VoiceConnection extends EventEmitter {
|
|
|
1346
1586
|
* @eventProperty
|
|
1347
1587
|
*/
|
|
1348
1588
|
on(event: 'stateChange', listener: (oldState: VoiceConnectionState, newState: VoiceConnectionState) => void): this;
|
|
1589
|
+
/**
|
|
1590
|
+
* Emitted when the end-to-end encrypted session has transitioned
|
|
1591
|
+
*
|
|
1592
|
+
* @eventProperty
|
|
1593
|
+
*/
|
|
1594
|
+
on(event: 'transitioned', listener: (transitionId: number) => void): this;
|
|
1349
1595
|
/**
|
|
1350
1596
|
* Emitted when the state of the voice connection changes to a specific status
|
|
1351
1597
|
*
|
|
@@ -1388,6 +1634,10 @@ declare class VoiceConnection extends EventEmitter {
|
|
|
1388
1634
|
* The debug logger function, if debugging is enabled.
|
|
1389
1635
|
*/
|
|
1390
1636
|
private readonly debug;
|
|
1637
|
+
/**
|
|
1638
|
+
* The options used to create this voice connection.
|
|
1639
|
+
*/
|
|
1640
|
+
private readonly options;
|
|
1391
1641
|
/**
|
|
1392
1642
|
* Creates a new voice connection.
|
|
1393
1643
|
*
|
|
@@ -1468,6 +1718,12 @@ declare class VoiceConnection extends EventEmitter {
|
|
|
1468
1718
|
* @param message - The debug message to propagate
|
|
1469
1719
|
*/
|
|
1470
1720
|
private onNetworkingDebug;
|
|
1721
|
+
/**
|
|
1722
|
+
* Propagates transitions from the underlying network instance.
|
|
1723
|
+
*
|
|
1724
|
+
* @param transitionId - The transition id
|
|
1725
|
+
*/
|
|
1726
|
+
private onNetworkingTransitioned;
|
|
1471
1727
|
/**
|
|
1472
1728
|
* Prepares an audio packet for dispatch.
|
|
1473
1729
|
*
|
|
@@ -1535,6 +1791,20 @@ declare class VoiceConnection extends EventEmitter {
|
|
|
1535
1791
|
ws: number | undefined;
|
|
1536
1792
|
udp: number | undefined;
|
|
1537
1793
|
};
|
|
1794
|
+
/**
|
|
1795
|
+
* The current voice privacy code of the encrypted session.
|
|
1796
|
+
*
|
|
1797
|
+
* @remarks
|
|
1798
|
+
* For this data to be available, the VoiceConnection must be in the Ready state,
|
|
1799
|
+
* and the connection would have to be end-to-end encrypted.
|
|
1800
|
+
*/
|
|
1801
|
+
get voicePrivacyCode(): string | undefined;
|
|
1802
|
+
/**
|
|
1803
|
+
* Gets the verification code for a user in the session.
|
|
1804
|
+
*
|
|
1805
|
+
* @throws Will throw if end-to-end encryption is not on or if the user id provided is not in the session.
|
|
1806
|
+
*/
|
|
1807
|
+
getVerificationCode(userId: string): Promise<string>;
|
|
1538
1808
|
/**
|
|
1539
1809
|
* Called when a subscription of this voice connection to an audio player is removed.
|
|
1540
1810
|
*
|
|
@@ -1548,11 +1818,20 @@ declare class VoiceConnection extends EventEmitter {
|
|
|
1548
1818
|
*/
|
|
1549
1819
|
interface CreateVoiceConnectionOptions {
|
|
1550
1820
|
adapterCreator: DiscordGatewayAdapterCreator;
|
|
1821
|
+
/**
|
|
1822
|
+
* Whether to use the DAVE protocol for end-to-end encryption. Defaults to true.
|
|
1823
|
+
*/
|
|
1824
|
+
daveEncryption?: boolean | undefined;
|
|
1551
1825
|
/**
|
|
1552
1826
|
* If true, debug messages will be enabled for the voice connection and its
|
|
1553
1827
|
* related components. Defaults to false.
|
|
1554
1828
|
*/
|
|
1555
1829
|
debug?: boolean | undefined;
|
|
1830
|
+
/**
|
|
1831
|
+
* The amount of consecutive decryption failures needed to try to
|
|
1832
|
+
* re-initialize the end-to-end encrypted session to recover. Defaults to 24.
|
|
1833
|
+
*/
|
|
1834
|
+
decryptionFailureTolerance?: number | undefined;
|
|
1556
1835
|
}
|
|
1557
1836
|
/**
|
|
1558
1837
|
* The options that can be given when joining a voice channel.
|
|
@@ -1646,4 +1925,4 @@ declare function demuxProbe(stream: Readable, probeSize?: number, validator?: ty
|
|
|
1646
1925
|
*/
|
|
1647
1926
|
declare const version: string;
|
|
1648
1927
|
|
|
1649
|
-
export { AudioPlayer, type AudioPlayerBufferingState, AudioPlayerError, type AudioPlayerIdleState, type AudioPlayerPausedState, type AudioPlayerPlayingState, type AudioPlayerState, AudioPlayerStatus, AudioReceiveStream, type AudioReceiveStreamOptions, AudioResource, type ConnectionData, type ConnectionOptions, type CreateAudioPlayerOptions, type CreateAudioResourceOptions, type CreateVoiceConnectionOptions, type DiscordGatewayAdapterCreator, type DiscordGatewayAdapterImplementerMethods, type DiscordGatewayAdapterLibraryMethods, type Edge, type EndBehavior, EndBehaviorType, type JoinConfig, type JoinVoiceChannelOptions, Networking, type NetworkingClosedState, type NetworkingIdentifyingState, type NetworkingOpeningWsState, type NetworkingReadyState, type NetworkingResumingState, type NetworkingSelectingProtocolState, type NetworkingState, NetworkingStatusCode, type NetworkingUdpHandshakingState, NoSubscriberBehavior, Node, PlayerSubscription, type ProbeInfo, SSRCMap, type SocketConfig, SpeakingMap, StreamType, TransformerType, VoiceConnection, type VoiceConnectionConnectingState, type VoiceConnectionDestroyedState, VoiceConnectionDisconnectReason, type VoiceConnectionDisconnectedBaseState, type VoiceConnectionDisconnectedOtherState, type VoiceConnectionDisconnectedState, type VoiceConnectionDisconnectedWebSocketState, type VoiceConnectionReadyState, type VoiceConnectionSignallingState, type VoiceConnectionState, VoiceConnectionStatus, VoiceReceiver, VoiceUDPSocket, type VoiceUserData, VoiceWebSocket, createAudioPlayer, createAudioResource, createDefaultAudioReceiveStreamOptions, demuxProbe, entersState, generateDependencyReport, getGroups, getVoiceConnection, getVoiceConnections, joinVoiceChannel, validateDiscordOpusHead, version };
|
|
1928
|
+
export { AudioPlayer, type AudioPlayerBufferingState, AudioPlayerError, type AudioPlayerIdleState, type AudioPlayerPausedState, type AudioPlayerPlayingState, type AudioPlayerState, AudioPlayerStatus, AudioReceiveStream, type AudioReceiveStreamOptions, AudioResource, type ConnectionData, type ConnectionOptions, type CreateAudioPlayerOptions, type CreateAudioResourceOptions, type CreateVoiceConnectionOptions, DAVESession, type DiscordGatewayAdapterCreator, type DiscordGatewayAdapterImplementerMethods, type DiscordGatewayAdapterLibraryMethods, type Edge, type EndBehavior, EndBehaviorType, type JoinConfig, type JoinVoiceChannelOptions, Networking, type NetworkingClosedState, type NetworkingIdentifyingState, type NetworkingOpeningWsState, type NetworkingReadyState, type NetworkingResumingState, type NetworkingSelectingProtocolState, type NetworkingState, NetworkingStatusCode, type NetworkingUdpHandshakingState, NoSubscriberBehavior, Node, PlayerSubscription, type ProbeInfo, SSRCMap, type SocketConfig, SpeakingMap, StreamType, TransformerType, VoiceConnection, type VoiceConnectionConnectingState, type VoiceConnectionDestroyedState, VoiceConnectionDisconnectReason, type VoiceConnectionDisconnectedBaseState, type VoiceConnectionDisconnectedOtherState, type VoiceConnectionDisconnectedState, type VoiceConnectionDisconnectedWebSocketState, type VoiceConnectionReadyState, type VoiceConnectionSignallingState, type VoiceConnectionState, VoiceConnectionStatus, VoiceReceiver, VoiceUDPSocket, type VoiceUserData, VoiceWebSocket, createAudioPlayer, createAudioResource, createDefaultAudioReceiveStreamOptions, demuxProbe, entersState, generateDependencyReport, getGroups, getVoiceConnection, getVoiceConnections, joinVoiceChannel, validateDiscordOpusHead, version };
|