@discordjs/voice 0.16.1-dev.1699704218-5b0aa92c8 → 0.16.1
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 +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
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
|
/**
|
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
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2447,7 +2447,12 @@ function createAudioResource(input, options = {}) {
|
|
|
2447
2447
|
if (transformerPipeline.length === 0) {
|
|
2448
2448
|
if (typeof input === "string")
|
|
2449
2449
|
throw new Error(`Invalid pipeline constructed for string resource '${input}'`);
|
|
2450
|
-
return new AudioResource(
|
|
2450
|
+
return new AudioResource(
|
|
2451
|
+
[],
|
|
2452
|
+
[input],
|
|
2453
|
+
options.metadata ?? null,
|
|
2454
|
+
options.silencePaddingFrames ?? 5
|
|
2455
|
+
);
|
|
2451
2456
|
}
|
|
2452
2457
|
const streams = transformerPipeline.map((edge) => edge.transformer(input));
|
|
2453
2458
|
if (typeof input !== "string")
|
|
@@ -2481,7 +2486,7 @@ __name(findPackageJSON, "findPackageJSON");
|
|
|
2481
2486
|
function version(name) {
|
|
2482
2487
|
try {
|
|
2483
2488
|
if (name === "@discordjs/voice") {
|
|
2484
|
-
return "0.16.1
|
|
2489
|
+
return "0.16.1";
|
|
2485
2490
|
}
|
|
2486
2491
|
const pkg = findPackageJSON((0, import_node_path.dirname)(require.resolve(name)), name, 3);
|
|
2487
2492
|
return pkg?.version ?? "not found";
|
|
@@ -2624,7 +2629,7 @@ async function demuxProbe(stream, probeSize = 1024, validator = validateDiscordO
|
|
|
2624
2629
|
__name(demuxProbe, "demuxProbe");
|
|
2625
2630
|
|
|
2626
2631
|
// src/index.ts
|
|
2627
|
-
var version2 = "0.16.1
|
|
2632
|
+
var version2 = "0.16.1";
|
|
2628
2633
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2629
2634
|
0 && (module.exports = {
|
|
2630
2635
|
AudioPlayer,
|