@discordjs/voice 1.0.0-dev.1690416599-8f4256d.0 → 1.0.0-dev.1732752782-e89c6b66a
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/README.md +7 -2
- package/dist/index.d.mts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.js +260 -247
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +264 -250
- package/dist/index.mjs.map +1 -1
- package/package.json +51 -44
- package/CHANGELOG.md +0 -127
package/README.md
CHANGED
|
@@ -32,12 +32,13 @@
|
|
|
32
32
|
|
|
33
33
|
## Installation
|
|
34
34
|
|
|
35
|
-
**Node.js
|
|
35
|
+
**Node.js 20 or newer is required.**
|
|
36
36
|
|
|
37
37
|
```sh
|
|
38
38
|
npm install @discordjs/voice
|
|
39
39
|
yarn add @discordjs/voice
|
|
40
40
|
pnpm add @discordjs/voice
|
|
41
|
+
bun add @discordjs/voice
|
|
41
42
|
```
|
|
42
43
|
|
|
43
44
|
## Dependencies
|
|
@@ -50,9 +51,13 @@ try installing another.
|
|
|
50
51
|
|
|
51
52
|
**Encryption Libraries (npm install):**
|
|
52
53
|
|
|
54
|
+
> [!NOTE]
|
|
55
|
+
> You only need to install one of these libraries if your system does not support `aes-256-gcm` (verify by running `require('node:crypto').getCiphers().includes('aes-256-gcm')`).
|
|
56
|
+
|
|
53
57
|
- `sodium-native`: ^3.3.0
|
|
54
58
|
- `sodium`: ^3.0.2
|
|
55
|
-
-
|
|
59
|
+
- `@stablelib/xchacha20poly1305`: ^2.0.0
|
|
60
|
+
- `@noble/ciphers`: ^1.0.0
|
|
56
61
|
- `libsodium-wrappers`: ^0.7.9
|
|
57
62
|
|
|
58
63
|
**Opus Libraries (npm install):**
|
package/dist/index.d.mts
CHANGED
|
@@ -76,9 +76,9 @@ declare class Node {
|
|
|
76
76
|
/**
|
|
77
77
|
* Options that are set when creating a new audio resource.
|
|
78
78
|
*
|
|
79
|
-
* @typeParam
|
|
79
|
+
* @typeParam Metadata - the type for the metadata (if any) of the audio resource
|
|
80
80
|
*/
|
|
81
|
-
interface CreateAudioResourceOptions<
|
|
81
|
+
interface CreateAudioResourceOptions<Metadata> {
|
|
82
82
|
/**
|
|
83
83
|
* Whether or not inline volume should be enabled. If enabled, you will be able to change the volume
|
|
84
84
|
* of the stream on-the-fly. However, this also increases the performance cost of playback. Defaults to `false`.
|
|
@@ -93,7 +93,7 @@ interface CreateAudioResourceOptions<T> {
|
|
|
93
93
|
* This is useful for identification purposes when the resource is passed around in events.
|
|
94
94
|
* See {@link AudioResource.metadata}
|
|
95
95
|
*/
|
|
96
|
-
metadata?:
|
|
96
|
+
metadata?: Metadata;
|
|
97
97
|
/**
|
|
98
98
|
* The number of silence frames to append to the end of the resource's audio stream, to prevent interpolation glitches.
|
|
99
99
|
* Defaults to 5.
|
|
@@ -103,9 +103,9 @@ interface CreateAudioResourceOptions<T> {
|
|
|
103
103
|
/**
|
|
104
104
|
* Represents an audio resource that can be played by an audio player.
|
|
105
105
|
*
|
|
106
|
-
* @typeParam
|
|
106
|
+
* @typeParam Metadata - the type for the metadata (if any) of the audio resource
|
|
107
107
|
*/
|
|
108
|
-
declare class AudioResource<
|
|
108
|
+
declare class AudioResource<Metadata = unknown> {
|
|
109
109
|
/**
|
|
110
110
|
* An object-mode Readable stream that emits Opus packets. This is what is played by audio players.
|
|
111
111
|
*/
|
|
@@ -119,7 +119,7 @@ declare class AudioResource<T = unknown> {
|
|
|
119
119
|
/**
|
|
120
120
|
* Optional metadata that can be used to identify the resource.
|
|
121
121
|
*/
|
|
122
|
-
metadata:
|
|
122
|
+
metadata: Metadata;
|
|
123
123
|
/**
|
|
124
124
|
* If the resource was created with inline volume transformation enabled, then this will be a
|
|
125
125
|
* prism-media VolumeTransformer. You can use this to alter the volume of the stream.
|
|
@@ -150,7 +150,7 @@ declare class AudioResource<T = unknown> {
|
|
|
150
150
|
* The number of remaining silence frames to play. If -1, the frames have not yet started playing.
|
|
151
151
|
*/
|
|
152
152
|
silenceRemaining: number;
|
|
153
|
-
constructor(edges: readonly Edge[], streams: readonly Readable[], metadata:
|
|
153
|
+
constructor(edges: readonly Edge[], streams: readonly Readable[], metadata: Metadata, silencePaddingFrames: number);
|
|
154
154
|
/**
|
|
155
155
|
* Whether this resource is readable. If the underlying resource is no longer readable, this will still return true
|
|
156
156
|
* while there are silence padding frames left to play.
|
|
@@ -183,9 +183,9 @@ declare class AudioResource<T = unknown> {
|
|
|
183
183
|
* Opus transcoders, and Ogg/WebM demuxers.
|
|
184
184
|
* @param input - The resource to play
|
|
185
185
|
* @param options - Configurable options for creating the resource
|
|
186
|
-
* @typeParam
|
|
186
|
+
* @typeParam Metadata - the type for the metadata (if any) of the audio resource
|
|
187
187
|
*/
|
|
188
|
-
declare function createAudioResource<
|
|
188
|
+
declare function createAudioResource<Metadata>(input: Readable | string, options: CreateAudioResourceOptions<Metadata> & Pick<Metadata extends null | undefined ? CreateAudioResourceOptions<Metadata> : Required<CreateAudioResourceOptions<Metadata>>, 'metadata'>): AudioResource<Metadata extends null | undefined ? null : Metadata>;
|
|
189
189
|
/**
|
|
190
190
|
* Creates an audio resource that can be played by audio players.
|
|
191
191
|
*
|
|
@@ -197,9 +197,9 @@ declare function createAudioResource<T>(input: Readable | string, options: Creat
|
|
|
197
197
|
* Opus transcoders, and Ogg/WebM demuxers.
|
|
198
198
|
* @param input - The resource to play
|
|
199
199
|
* @param options - Configurable options for creating the resource
|
|
200
|
-
* @typeParam
|
|
200
|
+
* @typeParam Metadata - the type for the metadata (if any) of the audio resource
|
|
201
201
|
*/
|
|
202
|
-
declare function createAudioResource<
|
|
202
|
+
declare function createAudioResource<Metadata extends null | undefined>(input: Readable | string, options?: Omit<CreateAudioResourceOptions<Metadata>, 'metadata'>): AudioResource<null>;
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* An error emitted by an AudioPlayer. Contains an attached resource to aid with
|
|
@@ -381,8 +381,8 @@ interface AudioPlayer extends EventEmitter {
|
|
|
381
381
|
*
|
|
382
382
|
* @eventProperty
|
|
383
383
|
*/
|
|
384
|
-
on<
|
|
385
|
-
status:
|
|
384
|
+
on<Event extends AudioPlayerStatus>(event: Event, listener: (oldState: AudioPlayerState, newState: AudioPlayerState & {
|
|
385
|
+
status: Event;
|
|
386
386
|
}) => void): this;
|
|
387
387
|
}
|
|
388
388
|
/**
|
|
@@ -461,7 +461,7 @@ declare class AudioPlayer extends EventEmitter {
|
|
|
461
461
|
* @param resource - The resource to play
|
|
462
462
|
* @throws Will throw if attempting to play an audio resource that has already ended, or is being played by another player
|
|
463
463
|
*/
|
|
464
|
-
play<
|
|
464
|
+
play<Metadata>(resource: AudioResource<Metadata>): void;
|
|
465
465
|
/**
|
|
466
466
|
* Pauses playback of the current resource, if any.
|
|
467
467
|
*
|
|
@@ -1346,8 +1346,8 @@ interface VoiceConnection extends EventEmitter {
|
|
|
1346
1346
|
*
|
|
1347
1347
|
* @eventProperty
|
|
1348
1348
|
*/
|
|
1349
|
-
on<
|
|
1350
|
-
status:
|
|
1349
|
+
on<Event extends VoiceConnectionStatus>(event: Event, listener: (oldState: VoiceConnectionState, newState: VoiceConnectionState & {
|
|
1350
|
+
status: Event;
|
|
1351
1351
|
}) => void): this;
|
|
1352
1352
|
}
|
|
1353
1353
|
/**
|
|
@@ -1636,9 +1636,9 @@ interface ProbeInfo {
|
|
|
1636
1636
|
declare function demuxProbe(stream: Readable, probeSize?: number, validator?: typeof validateDiscordOpusHead): Promise<ProbeInfo>;
|
|
1637
1637
|
|
|
1638
1638
|
/**
|
|
1639
|
-
* The {@link https://github.com/discordjs/discord.js/blob/main/packages/voice
|
|
1639
|
+
* The {@link https://github.com/discordjs/discord.js/blob/main/packages/voice#readme | @discordjs/voice} version
|
|
1640
1640
|
* that you are currently using.
|
|
1641
1641
|
*/
|
|
1642
1642
|
declare const version: string;
|
|
1643
1643
|
|
|
1644
|
-
export { AudioPlayer, AudioPlayerBufferingState, AudioPlayerError, AudioPlayerIdleState, AudioPlayerPausedState, AudioPlayerPlayingState, AudioPlayerState, AudioPlayerStatus, AudioReceiveStream, AudioReceiveStreamOptions, AudioResource, CreateAudioPlayerOptions, CreateAudioResourceOptions, CreateVoiceConnectionOptions, DiscordGatewayAdapterCreator, DiscordGatewayAdapterImplementerMethods, DiscordGatewayAdapterLibraryMethods, EndBehavior, EndBehaviorType, JoinConfig, JoinVoiceChannelOptions, NoSubscriberBehavior, PlayerSubscription, ProbeInfo, SSRCMap, SpeakingMap, StreamType, VoiceConnection, VoiceConnectionConnectingState, VoiceConnectionDestroyedState, VoiceConnectionDisconnectReason, VoiceConnectionDisconnectedBaseState, VoiceConnectionDisconnectedOtherState, VoiceConnectionDisconnectedState, VoiceConnectionDisconnectedWebSocketState, VoiceConnectionReadyState, VoiceConnectionSignallingState, VoiceConnectionState, VoiceConnectionStatus, VoiceReceiver, VoiceUserData, createAudioPlayer, createAudioResource, createDefaultAudioReceiveStreamOptions, demuxProbe, entersState, generateDependencyReport, getGroups, getVoiceConnection, getVoiceConnections, joinVoiceChannel, validateDiscordOpusHead, version };
|
|
1644
|
+
export { AudioPlayer, type AudioPlayerBufferingState, AudioPlayerError, type AudioPlayerIdleState, type AudioPlayerPausedState, type AudioPlayerPlayingState, type AudioPlayerState, AudioPlayerStatus, AudioReceiveStream, type AudioReceiveStreamOptions, AudioResource, type CreateAudioPlayerOptions, type CreateAudioResourceOptions, type CreateVoiceConnectionOptions, type DiscordGatewayAdapterCreator, type DiscordGatewayAdapterImplementerMethods, type DiscordGatewayAdapterLibraryMethods, type EndBehavior, EndBehaviorType, type JoinConfig, type JoinVoiceChannelOptions, NoSubscriberBehavior, PlayerSubscription, type ProbeInfo, SSRCMap, SpeakingMap, StreamType, VoiceConnection, type VoiceConnectionConnectingState, type VoiceConnectionDestroyedState, VoiceConnectionDisconnectReason, type VoiceConnectionDisconnectedBaseState, type VoiceConnectionDisconnectedOtherState, type VoiceConnectionDisconnectedState, type VoiceConnectionDisconnectedWebSocketState, type VoiceConnectionReadyState, type VoiceConnectionSignallingState, type VoiceConnectionState, VoiceConnectionStatus, VoiceReceiver, type VoiceUserData, createAudioPlayer, createAudioResource, createDefaultAudioReceiveStreamOptions, demuxProbe, entersState, generateDependencyReport, getGroups, getVoiceConnection, getVoiceConnections, joinVoiceChannel, validateDiscordOpusHead, version };
|
package/dist/index.d.ts
CHANGED
|
@@ -76,9 +76,9 @@ declare class Node {
|
|
|
76
76
|
/**
|
|
77
77
|
* Options that are set when creating a new audio resource.
|
|
78
78
|
*
|
|
79
|
-
* @typeParam
|
|
79
|
+
* @typeParam Metadata - the type for the metadata (if any) of the audio resource
|
|
80
80
|
*/
|
|
81
|
-
interface CreateAudioResourceOptions<
|
|
81
|
+
interface CreateAudioResourceOptions<Metadata> {
|
|
82
82
|
/**
|
|
83
83
|
* Whether or not inline volume should be enabled. If enabled, you will be able to change the volume
|
|
84
84
|
* of the stream on-the-fly. However, this also increases the performance cost of playback. Defaults to `false`.
|
|
@@ -93,7 +93,7 @@ interface CreateAudioResourceOptions<T> {
|
|
|
93
93
|
* This is useful for identification purposes when the resource is passed around in events.
|
|
94
94
|
* See {@link AudioResource.metadata}
|
|
95
95
|
*/
|
|
96
|
-
metadata?:
|
|
96
|
+
metadata?: Metadata;
|
|
97
97
|
/**
|
|
98
98
|
* The number of silence frames to append to the end of the resource's audio stream, to prevent interpolation glitches.
|
|
99
99
|
* Defaults to 5.
|
|
@@ -103,9 +103,9 @@ interface CreateAudioResourceOptions<T> {
|
|
|
103
103
|
/**
|
|
104
104
|
* Represents an audio resource that can be played by an audio player.
|
|
105
105
|
*
|
|
106
|
-
* @typeParam
|
|
106
|
+
* @typeParam Metadata - the type for the metadata (if any) of the audio resource
|
|
107
107
|
*/
|
|
108
|
-
declare class AudioResource<
|
|
108
|
+
declare class AudioResource<Metadata = unknown> {
|
|
109
109
|
/**
|
|
110
110
|
* An object-mode Readable stream that emits Opus packets. This is what is played by audio players.
|
|
111
111
|
*/
|
|
@@ -119,7 +119,7 @@ declare class AudioResource<T = unknown> {
|
|
|
119
119
|
/**
|
|
120
120
|
* Optional metadata that can be used to identify the resource.
|
|
121
121
|
*/
|
|
122
|
-
metadata:
|
|
122
|
+
metadata: Metadata;
|
|
123
123
|
/**
|
|
124
124
|
* If the resource was created with inline volume transformation enabled, then this will be a
|
|
125
125
|
* prism-media VolumeTransformer. You can use this to alter the volume of the stream.
|
|
@@ -150,7 +150,7 @@ declare class AudioResource<T = unknown> {
|
|
|
150
150
|
* The number of remaining silence frames to play. If -1, the frames have not yet started playing.
|
|
151
151
|
*/
|
|
152
152
|
silenceRemaining: number;
|
|
153
|
-
constructor(edges: readonly Edge[], streams: readonly Readable[], metadata:
|
|
153
|
+
constructor(edges: readonly Edge[], streams: readonly Readable[], metadata: Metadata, silencePaddingFrames: number);
|
|
154
154
|
/**
|
|
155
155
|
* Whether this resource is readable. If the underlying resource is no longer readable, this will still return true
|
|
156
156
|
* while there are silence padding frames left to play.
|
|
@@ -183,9 +183,9 @@ declare class AudioResource<T = unknown> {
|
|
|
183
183
|
* Opus transcoders, and Ogg/WebM demuxers.
|
|
184
184
|
* @param input - The resource to play
|
|
185
185
|
* @param options - Configurable options for creating the resource
|
|
186
|
-
* @typeParam
|
|
186
|
+
* @typeParam Metadata - the type for the metadata (if any) of the audio resource
|
|
187
187
|
*/
|
|
188
|
-
declare function createAudioResource<
|
|
188
|
+
declare function createAudioResource<Metadata>(input: Readable | string, options: CreateAudioResourceOptions<Metadata> & Pick<Metadata extends null | undefined ? CreateAudioResourceOptions<Metadata> : Required<CreateAudioResourceOptions<Metadata>>, 'metadata'>): AudioResource<Metadata extends null | undefined ? null : Metadata>;
|
|
189
189
|
/**
|
|
190
190
|
* Creates an audio resource that can be played by audio players.
|
|
191
191
|
*
|
|
@@ -197,9 +197,9 @@ declare function createAudioResource<T>(input: Readable | string, options: Creat
|
|
|
197
197
|
* Opus transcoders, and Ogg/WebM demuxers.
|
|
198
198
|
* @param input - The resource to play
|
|
199
199
|
* @param options - Configurable options for creating the resource
|
|
200
|
-
* @typeParam
|
|
200
|
+
* @typeParam Metadata - the type for the metadata (if any) of the audio resource
|
|
201
201
|
*/
|
|
202
|
-
declare function createAudioResource<
|
|
202
|
+
declare function createAudioResource<Metadata extends null | undefined>(input: Readable | string, options?: Omit<CreateAudioResourceOptions<Metadata>, 'metadata'>): AudioResource<null>;
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* An error emitted by an AudioPlayer. Contains an attached resource to aid with
|
|
@@ -381,8 +381,8 @@ interface AudioPlayer extends EventEmitter {
|
|
|
381
381
|
*
|
|
382
382
|
* @eventProperty
|
|
383
383
|
*/
|
|
384
|
-
on<
|
|
385
|
-
status:
|
|
384
|
+
on<Event extends AudioPlayerStatus>(event: Event, listener: (oldState: AudioPlayerState, newState: AudioPlayerState & {
|
|
385
|
+
status: Event;
|
|
386
386
|
}) => void): this;
|
|
387
387
|
}
|
|
388
388
|
/**
|
|
@@ -461,7 +461,7 @@ declare class AudioPlayer extends EventEmitter {
|
|
|
461
461
|
* @param resource - The resource to play
|
|
462
462
|
* @throws Will throw if attempting to play an audio resource that has already ended, or is being played by another player
|
|
463
463
|
*/
|
|
464
|
-
play<
|
|
464
|
+
play<Metadata>(resource: AudioResource<Metadata>): void;
|
|
465
465
|
/**
|
|
466
466
|
* Pauses playback of the current resource, if any.
|
|
467
467
|
*
|
|
@@ -1346,8 +1346,8 @@ interface VoiceConnection extends EventEmitter {
|
|
|
1346
1346
|
*
|
|
1347
1347
|
* @eventProperty
|
|
1348
1348
|
*/
|
|
1349
|
-
on<
|
|
1350
|
-
status:
|
|
1349
|
+
on<Event extends VoiceConnectionStatus>(event: Event, listener: (oldState: VoiceConnectionState, newState: VoiceConnectionState & {
|
|
1350
|
+
status: Event;
|
|
1351
1351
|
}) => void): this;
|
|
1352
1352
|
}
|
|
1353
1353
|
/**
|
|
@@ -1636,9 +1636,9 @@ interface ProbeInfo {
|
|
|
1636
1636
|
declare function demuxProbe(stream: Readable, probeSize?: number, validator?: typeof validateDiscordOpusHead): Promise<ProbeInfo>;
|
|
1637
1637
|
|
|
1638
1638
|
/**
|
|
1639
|
-
* The {@link https://github.com/discordjs/discord.js/blob/main/packages/voice
|
|
1639
|
+
* The {@link https://github.com/discordjs/discord.js/blob/main/packages/voice#readme | @discordjs/voice} version
|
|
1640
1640
|
* that you are currently using.
|
|
1641
1641
|
*/
|
|
1642
1642
|
declare const version: string;
|
|
1643
1643
|
|
|
1644
|
-
export { AudioPlayer, AudioPlayerBufferingState, AudioPlayerError, AudioPlayerIdleState, AudioPlayerPausedState, AudioPlayerPlayingState, AudioPlayerState, AudioPlayerStatus, AudioReceiveStream, AudioReceiveStreamOptions, AudioResource, CreateAudioPlayerOptions, CreateAudioResourceOptions, CreateVoiceConnectionOptions, DiscordGatewayAdapterCreator, DiscordGatewayAdapterImplementerMethods, DiscordGatewayAdapterLibraryMethods, EndBehavior, EndBehaviorType, JoinConfig, JoinVoiceChannelOptions, NoSubscriberBehavior, PlayerSubscription, ProbeInfo, SSRCMap, SpeakingMap, StreamType, VoiceConnection, VoiceConnectionConnectingState, VoiceConnectionDestroyedState, VoiceConnectionDisconnectReason, VoiceConnectionDisconnectedBaseState, VoiceConnectionDisconnectedOtherState, VoiceConnectionDisconnectedState, VoiceConnectionDisconnectedWebSocketState, VoiceConnectionReadyState, VoiceConnectionSignallingState, VoiceConnectionState, VoiceConnectionStatus, VoiceReceiver, VoiceUserData, createAudioPlayer, createAudioResource, createDefaultAudioReceiveStreamOptions, demuxProbe, entersState, generateDependencyReport, getGroups, getVoiceConnection, getVoiceConnections, joinVoiceChannel, validateDiscordOpusHead, version };
|
|
1644
|
+
export { AudioPlayer, type AudioPlayerBufferingState, AudioPlayerError, type AudioPlayerIdleState, type AudioPlayerPausedState, type AudioPlayerPlayingState, type AudioPlayerState, AudioPlayerStatus, AudioReceiveStream, type AudioReceiveStreamOptions, AudioResource, type CreateAudioPlayerOptions, type CreateAudioResourceOptions, type CreateVoiceConnectionOptions, type DiscordGatewayAdapterCreator, type DiscordGatewayAdapterImplementerMethods, type DiscordGatewayAdapterLibraryMethods, type EndBehavior, EndBehaviorType, type JoinConfig, type JoinVoiceChannelOptions, NoSubscriberBehavior, PlayerSubscription, type ProbeInfo, SSRCMap, SpeakingMap, StreamType, VoiceConnection, type VoiceConnectionConnectingState, type VoiceConnectionDestroyedState, VoiceConnectionDisconnectReason, type VoiceConnectionDisconnectedBaseState, type VoiceConnectionDisconnectedOtherState, type VoiceConnectionDisconnectedState, type VoiceConnectionDisconnectedWebSocketState, type VoiceConnectionReadyState, type VoiceConnectionSignallingState, type VoiceConnectionState, VoiceConnectionStatus, VoiceReceiver, type VoiceUserData, createAudioPlayer, createAudioResource, createDefaultAudioReceiveStreamOptions, demuxProbe, entersState, generateDependencyReport, getGroups, getVoiceConnection, getVoiceConnections, joinVoiceChannel, validateDiscordOpusHead, version };
|