discord-player 6.6.0-dev.0 → 6.6.0

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.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { ListenerSignature, DefaultListener, EventEmitter, Collection, Queue, QueueStrategy } from '@discord-player/utils';
1
+ import { ListenerSignature, DefaultListener, EventEmitter, Queue, QueueStrategy, Collection } from '@discord-player/utils';
2
2
  import * as discord_js from 'discord.js';
3
- import { User, GuildVoiceChannelResolvable, VoiceChannel, StageChannel, UserResolvable, Guild, VoiceState, VoiceBasedChannel, Snowflake, Client, GuildResolvable } from 'discord.js';
4
- import { Readable, Duplex } from 'stream';
5
- import { RequestOptions } from 'http';
3
+ import { VoiceChannel, StageChannel, UserResolvable, Guild, VoiceState, VoiceBasedChannel, GuildVoiceChannelResolvable, User, Snowflake, Client, GuildResolvable } from 'discord.js';
6
4
  import * as _discord_player_equalizer from '@discord-player/equalizer';
7
5
  import { EqualizerBand, BiquadFilters, PCMFilters, FiltersChain } from '@discord-player/equalizer';
8
6
  export { AF_NIGHTCORE_RATE, AF_VAPORWAVE_RATE, BASS_EQ_BANDS, FilterType as BiquadFilterType, BiquadFilters, FiltersChain, AudioFilters as PCMAudioFilters, PCMFilters, Q_BUTTERWORTH, VolumeTransformer } from '@discord-player/equalizer';
7
+ import { Readable, Duplex } from 'stream';
9
8
  import { StreamType, AudioPlayerError, AudioResource, VoiceConnection, AudioPlayer, AudioPlayerStatus, EndBehaviorType } from '@discordjs/voice';
10
9
  export { AudioPlayer, CreateAudioPlayerOptions, createAudioPlayer } from '@discordjs/voice';
10
+ import { RequestOptions } from 'http';
11
11
  import { downloadOptions } from 'ytdl-core';
12
12
  export * from '@discord-player/ffmpeg';
13
13
 
@@ -17,483 +17,190 @@ declare class PlayerEventsEmitter<L extends ListenerSignature<L> = DefaultListen
17
17
  emit<K extends keyof L>(name: K, ...args: Parameters<L[K]>): boolean;
18
18
  }
19
19
 
20
- declare class Playlist {
21
- readonly player: Player;
22
- tracks: Track[];
23
- title: string;
24
- description: string;
25
- thumbnail: string;
26
- type: 'album' | 'playlist';
27
- source: TrackSource;
28
- author: {
29
- name: string;
30
- url: string;
31
- };
32
- id: string;
33
- url: string;
34
- readonly rawPlaylist?: any;
20
+ interface CreateStreamOps {
21
+ type?: StreamType;
22
+ data?: any;
23
+ disableVolume?: boolean;
24
+ disableEqualizer?: boolean;
25
+ disableBiquad?: boolean;
26
+ eq?: EqualizerBand[];
27
+ biquadFilter?: BiquadFilters;
28
+ disableFilters?: boolean;
29
+ defaultFilters?: PCMFilters[];
30
+ volume?: number;
31
+ disableResampler?: boolean;
32
+ sampleRate?: number;
33
+ }
34
+ interface VoiceEvents {
35
+ error: (error: AudioPlayerError) => any;
36
+ debug: (message: string) => any;
37
+ start: (resource: AudioResource<Track>) => any;
38
+ finish: (resource: AudioResource<Track>) => any;
39
+ dsp: (filters: PCMFilters[]) => any;
40
+ eqBands: (filters: EqualizerBand[]) => any;
41
+ sampleRate: (filters: number) => any;
42
+ biquad: (filters: BiquadFilters) => any;
43
+ volume: (volume: number) => any;
44
+ destroyed: () => any;
45
+ }
46
+ declare class StreamDispatcher extends EventEmitter<VoiceEvents> {
47
+ queue: GuildQueue;
48
+ readonly connectionTimeout: number;
49
+ voiceConnection: VoiceConnection;
50
+ audioPlayer: AudioPlayer;
51
+ receiver: VoiceReceiverNode;
52
+ channel: VoiceChannel | StageChannel;
53
+ audioResource?: AudioResource<Track> | null;
54
+ dsp: FiltersChain;
35
55
  /**
36
- * Playlist constructor
37
- * @param {Player} player The player
38
- * @param {PlaylistInitData} data The data
56
+ * Creates new connection object
57
+ * @param {VoiceConnection} connection The connection
58
+ * @param {VoiceChannel|StageChannel} channel The connected channel
59
+ * @private
39
60
  */
40
- constructor(player: Player, data: PlaylistInitData);
41
- [Symbol.iterator](): Generator<Track<unknown>, void, undefined>;
61
+ constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel, queue: GuildQueue, connectionTimeout?: number, audioPlayer?: AudioPlayer);
42
62
  /**
43
- * Estimated duration of this playlist
63
+ * Check if the player has been paused manually
44
64
  */
45
- get estimatedDuration(): number;
65
+ get paused(): boolean;
66
+ set paused(val: boolean);
46
67
  /**
47
- * Formatted estimated duration of this playlist
68
+ * Whether or not the player is currently paused automatically or manually.
48
69
  */
49
- get durationFormatted(): string;
70
+ isPaused(): boolean;
50
71
  /**
51
- * JSON representation of this playlist
52
- * @param {boolean} [withTracks=true] If it should build json with tracks
53
- * @returns {PlaylistJSON}
72
+ * Whether or not the player is currently buffering
54
73
  */
55
- toJSON(withTracks?: boolean): PlaylistJSON;
56
- }
57
-
58
- interface ExtractorExecutionEvents {
74
+ isBuffering(): boolean;
59
75
  /**
60
- * Emitted when a extractor is registered
61
- * @param context The context where extractor was registered
62
- * @param extractor The extractor that was registered
76
+ * Whether or not the player is currently playing
63
77
  */
64
- registered: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
78
+ isPlaying(): boolean;
65
79
  /**
66
- * Emitted when a extractor is unregistered
67
- * @param context The context where extractor was unregistered
68
- * @param extractor The extractor that was unregistered
80
+ * Whether or not the player is currently idle
69
81
  */
70
- unregistered: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
82
+ isIdle(): boolean;
71
83
  /**
72
- * Emitted when a extractor is activated
73
- * @param context The context where this event occurred
74
- * @param extractor The extractor which was activated
84
+ * Whether or not the voice connection has been destroyed
75
85
  */
76
- activate: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
86
+ isDestroyed(): boolean;
77
87
  /**
78
- * Emitted when a extractor is deactivated
79
- * @param context The context where this event occurred
80
- * @param extractor The extractor which was deactivated
88
+ * Whether or not the voice connection has been destroyed
81
89
  */
82
- deactivate: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
90
+ isDisconnected(): boolean;
83
91
  /**
84
- * Emitted when a extractor fails to activate/deactivate
85
- * @param context The context where this event occurred
86
- * @param extractor The extractor which was deactivated
92
+ * Whether or not the voice connection is ready to play
87
93
  */
88
- error: (context: ExtractorExecutionContext, extractor: BaseExtractor, error: Error) => unknown;
89
- }
90
- declare class ExtractorExecutionContext extends PlayerEventsEmitter<ExtractorExecutionEvents> {
91
- player: Player;
92
- store: Collection<string, BaseExtractor<object>>;
93
- constructor(player: Player);
94
+ isReady(): boolean;
94
95
  /**
95
- * Load default extractors from `@discord-player/extractor`
96
+ * Whether or not the voice connection is signalling
96
97
  */
97
- loadDefault(): Promise<{
98
- success: boolean;
99
- error: Error;
100
- } | {
101
- success: boolean;
102
- error: null;
103
- }>;
98
+ isSignalling(): boolean;
104
99
  /**
105
- * Validate if the given extractor is registered
106
- * @param identifier The extractor identifier
100
+ * Whether or not the voice connection is connecting
107
101
  */
108
- isRegistered(identifier: string): boolean;
102
+ isConnecting(): boolean;
109
103
  /**
110
- * The size of registered extractors
104
+ * Creates stream
105
+ * @param {Readable} src The stream source
106
+ * @param {object} [ops] Options
107
+ * @returns {AudioResource}
111
108
  */
112
- get size(): number;
109
+ createStream(src: Readable, ops?: CreateStreamOps): Promise<AudioResource<Track<unknown>>>;
110
+ get resampler(): _discord_player_equalizer.PCMResampler | null;
111
+ get filters(): _discord_player_equalizer.AudioFilter | null;
112
+ get biquad(): _discord_player_equalizer.BiquadStream | null;
113
+ get equalizer(): _discord_player_equalizer.EqualizerStream | null;
113
114
  /**
114
- * Get single extractor
115
- * @param identifier The extractor to get
115
+ * The player status
116
+ * @type {AudioPlayerStatus}
116
117
  */
117
- get(identifier: string): BaseExtractor<object> | undefined;
118
+ get status(): AudioPlayerStatus;
118
119
  /**
119
- * Register single extractor
120
- * @param _extractor The extractor to register
121
- * @param options Options supplied to the extractor
120
+ * Disconnects from voice
121
+ * @returns {void}
122
122
  */
123
- register<O extends object, T extends typeof BaseExtractor<O>>(_extractor: T, options: ConstructorParameters<T>['1']): Promise<void>;
123
+ disconnect(): void;
124
124
  /**
125
- * Unregister single extractor
126
- * @param _extractor The extractor to unregister
125
+ * Destroys this dispatcher
127
126
  */
128
- unregister<K extends string | BaseExtractor>(_extractor: K): Promise<void>;
127
+ destroy(): void;
129
128
  /**
130
- * Unregister all extractors
129
+ * Stops the player
130
+ * @returns {void}
131
131
  */
132
- unregisterAll(): Promise<void>;
132
+ end(): void;
133
133
  /**
134
- * Run all the extractors
135
- * @param fn The runner function
136
- * @param filterBlocked Filter blocked extractors
134
+ * Pauses the stream playback
135
+ * @param {boolean} [interpolateSilence=false] If true, the player will play 5 packets of silence after pausing to prevent audio glitches.
136
+ * @returns {boolean}
137
137
  */
138
- run<T = unknown>(fn: ExtractorExecutionFN<T>, filterBlocked?: boolean): Promise<ExtractorExecutionResult<T> | ExtractorExecutionResult<false> | undefined>;
139
- }
140
- interface ExtractorExecutionResult<T = unknown> {
141
- extractor: BaseExtractor;
142
- error: Error | null;
143
- result: T;
144
- }
145
- type ExtractorExecutionFN<T = unknown> = (extractor: BaseExtractor) => Promise<T | boolean>;
146
-
147
- declare class BaseExtractor<T extends object = object> {
148
- context: ExtractorExecutionContext;
149
- options: T;
138
+ pause(interpolateSilence?: boolean): boolean;
150
139
  /**
151
- * Identifier for this extractor
140
+ * Resumes the stream playback
141
+ * @returns {boolean}
152
142
  */
153
- static identifier: string;
143
+ resume(): boolean;
154
144
  /**
155
- * Handle bridge query creation
156
- * @param track The track to build query for
145
+ * Play stream
146
+ * @param {AudioResource<Track>} [resource=this.audioResource] The audio resource to play
147
+ * @returns {Promise<StreamDispatcher>}
157
148
  */
158
- createBridgeQuery: (track: Track) => string;
149
+ playStream(resource?: AudioResource<Track>): Promise<this | undefined>;
159
150
  /**
160
- * Extractor constructor
161
- * @param context Context that instantiated this extractor
162
- * @param options Initialization options for this extractor
151
+ * Sets playback volume
152
+ * @param {number} value The volume amount
153
+ * @returns {boolean}
163
154
  */
164
- constructor(context: ExtractorExecutionContext, options?: T);
155
+ setVolume(value: number): boolean;
165
156
  /**
166
- * Identifier of this extractor
157
+ * The current volume
158
+ * @type {number}
167
159
  */
168
- get identifier(): string;
160
+ get volume(): number;
169
161
  /**
170
- * Reconfigures this extractor
171
- * @param options The new options to apply
162
+ * The playback time
163
+ * @type {number}
172
164
  */
173
- reconfigure(options: T): Promise<void>;
165
+ get streamTime(): number;
166
+ }
167
+
168
+ interface VoiceReceiverOptions {
169
+ mode?: 'opus' | 'pcm';
170
+ end?: EndBehaviorType;
171
+ silenceDuration?: number;
172
+ crc?: boolean;
173
+ }
174
+ type RawTrackInit = Partial<Omit<RawTrackData, 'author' | 'playlist' | 'source' | 'engine' | 'raw' | 'queryType' | 'description' | 'views'>>;
175
+ declare class VoiceReceiverNode {
176
+ dispatcher: StreamDispatcher;
177
+ constructor(dispatcher: StreamDispatcher);
178
+ createRawTrack(stream: Readable, data?: RawTrackInit): Track<unknown>;
174
179
  /**
175
- * This method will be executed when this extractor is activated
180
+ * Merge multiple streams together
181
+ * @param streams The array of streams to merge
176
182
  */
177
- activate(): Promise<void>;
183
+ mergeRecordings(streams: Readable[]): void;
178
184
  /**
179
- * This method will be executed when this extractor is deactivated
185
+ * Record a user in voice channel
186
+ * @param user The user to record
187
+ * @param options Recording options
180
188
  */
181
- deactivate(): Promise<void>;
189
+ recordUser(user: UserResolvable, options?: VoiceReceiverOptions): Readable;
190
+ }
191
+
192
+ declare class GuildQueueHistory<Meta = unknown> {
193
+ queue: GuildQueue<Meta>;
194
+ tracks: Queue<Track<unknown>>;
195
+ constructor(queue: GuildQueue<Meta>);
182
196
  /**
183
- * Validate incoming query
184
- * @param query The query to validate
197
+ * Current track in the queue
185
198
  */
186
- validate(query: string, type?: SearchQueryType | null): Promise<boolean>;
199
+ get currentTrack(): Track<unknown> | null;
187
200
  /**
188
- * Stream the given track
189
- * @param info The track to stream
201
+ * Next track in the queue
190
202
  */
191
- stream(info: Track): Promise<Readable | string>;
192
- /**
193
- * Handle the given query
194
- * @param query The query to handle
195
- */
196
- handle(query: string, context: ExtractorSearchContext): Promise<ExtractorInfo>;
197
- /**
198
- * Get related tracks for the given track
199
- * @param track The track source
200
- */
201
- getRelatedTracks(track: Track): Promise<ExtractorInfo>;
202
- /**
203
- * A stream middleware to handle streams before passing it to the player
204
- * @param stream The incoming stream
205
- * @param next The next function
206
- */
207
- handlePostStream(stream: Readable, next: NextFunction): void;
208
- /**
209
- * Dispatch an event to the player
210
- * @param event The event to dispatch
211
- * @param args The data to dispatch
212
- */
213
- emit<K extends keyof PlayerEvents>(event: K, ...args: Parameters<PlayerEvents[K]>): boolean;
214
- /**
215
- * Create extractor response
216
- * @param playlist The playlist
217
- * @param tracks The track array
218
- */
219
- createResponse(playlist?: Playlist | null, tracks?: Track[]): ExtractorInfo;
220
- /**
221
- * Write debug message
222
- * @param message The debug message
223
- */
224
- debug(message: string): boolean;
225
- }
226
- type NextFunction = (error?: Error | null, stream?: Readable) => void;
227
- interface ExtractorInfo {
228
- playlist: Playlist | null;
229
- tracks: Track[];
230
- }
231
- interface ExtractorSearchContext {
232
- type?: SearchQueryType | null;
233
- requestedBy?: User | null;
234
- requestOptions?: RequestOptions;
235
- }
236
-
237
- type TrackResolvable = Track | string | number;
238
- type WithMetadata<T extends object, M> = T & {
239
- metadata: M;
240
- requestMetadata(): Promise<M>;
241
- };
242
- declare class Track<T = unknown> {
243
- readonly player: Player;
244
- title: string;
245
- description: string;
246
- author: string;
247
- url: string;
248
- thumbnail: string;
249
- duration: string;
250
- views: number;
251
- requestedBy: User | null;
252
- playlist?: Playlist;
253
- queryType: SearchQueryType | null | undefined;
254
- raw: RawTrackData;
255
- extractor: BaseExtractor | null;
256
- readonly id: string;
257
- private __metadata;
258
- private __reqMetadataFn;
259
- /**
260
- * Track constructor
261
- * @param player The player that instantiated this Track
262
- * @param data Track data
263
- */
264
- constructor(player: Player, data: Partial<WithMetadata<RawTrackData, T>>);
265
- /**
266
- * Request metadata for this track
267
- */
268
- requestMetadata(): Promise<T | null>;
269
- /**
270
- * Set metadata for this track
271
- */
272
- setMetadata(m: T | null): void;
273
- /**
274
- * Metadata of this track
275
- */
276
- get metadata(): T | null;
277
- /**
278
- * If this track has metadata
279
- */
280
- get hasMetadata(): boolean;
281
- /**
282
- * The queue in which this track is located
283
- */
284
- get queue(): GuildQueue;
285
- /**
286
- * The track duration in millisecond
287
- */
288
- get durationMS(): number;
289
- /**
290
- * Returns source of this track
291
- */
292
- get source(): TrackSource;
293
- /**
294
- * String representation of this track
295
- */
296
- toString(): string;
297
- /**
298
- * Raw JSON representation of this track
299
- */
300
- toJSON(hidePlaylist?: boolean): TrackJSON;
301
- /**
302
- * Get belonging queues of this track
303
- */
304
- getBelongingQueues(): Collection<string, GuildQueue<unknown>>;
305
- /**
306
- * Play this track to the given voice channel. If queue exists and another track is being played, this track will be added to the queue.
307
- * @param channel Voice channel on which this track shall be played
308
- * @param options Node initialization options
309
- */
310
- play<T = unknown>(channel: GuildVoiceChannelResolvable, options?: PlayerNodeInitializerOptions<T>): Promise<PlayerNodeInitializationResult<T>>;
311
- }
312
-
313
- interface CreateStreamOps {
314
- type?: StreamType;
315
- data?: any;
316
- disableVolume?: boolean;
317
- disableEqualizer?: boolean;
318
- disableBiquad?: boolean;
319
- eq?: EqualizerBand[];
320
- biquadFilter?: BiquadFilters;
321
- disableFilters?: boolean;
322
- defaultFilters?: PCMFilters[];
323
- volume?: number;
324
- disableResampler?: boolean;
325
- sampleRate?: number;
326
- }
327
- interface VoiceEvents {
328
- error: (error: AudioPlayerError) => any;
329
- debug: (message: string) => any;
330
- start: (resource: AudioResource<Track>) => any;
331
- finish: (resource: AudioResource<Track>) => any;
332
- dsp: (filters: PCMFilters[]) => any;
333
- eqBands: (filters: EqualizerBand[]) => any;
334
- sampleRate: (filters: number) => any;
335
- biquad: (filters: BiquadFilters) => any;
336
- volume: (volume: number) => any;
337
- destroyed: () => any;
338
- }
339
- declare class StreamDispatcher extends EventEmitter<VoiceEvents> {
340
- queue: GuildQueue;
341
- readonly connectionTimeout: number;
342
- voiceConnection: VoiceConnection;
343
- audioPlayer: AudioPlayer;
344
- receiver: VoiceReceiverNode;
345
- channel: VoiceChannel | StageChannel;
346
- audioResource?: AudioResource<Track> | null;
347
- dsp: FiltersChain;
348
- /**
349
- * Creates new connection object
350
- * @param {VoiceConnection} connection The connection
351
- * @param {VoiceChannel|StageChannel} channel The connected channel
352
- * @private
353
- */
354
- constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel, queue: GuildQueue, connectionTimeout?: number, audioPlayer?: AudioPlayer);
355
- /**
356
- * Check if the player has been paused manually
357
- */
358
- get paused(): boolean;
359
- set paused(val: boolean);
360
- /**
361
- * Whether or not the player is currently paused automatically or manually.
362
- */
363
- isPaused(): boolean;
364
- /**
365
- * Whether or not the player is currently buffering
366
- */
367
- isBuffering(): boolean;
368
- /**
369
- * Whether or not the player is currently playing
370
- */
371
- isPlaying(): boolean;
372
- /**
373
- * Whether or not the player is currently idle
374
- */
375
- isIdle(): boolean;
376
- /**
377
- * Whether or not the voice connection has been destroyed
378
- */
379
- isDestroyed(): boolean;
380
- /**
381
- * Whether or not the voice connection has been destroyed
382
- */
383
- isDisconnected(): boolean;
384
- /**
385
- * Whether or not the voice connection is ready to play
386
- */
387
- isReady(): boolean;
388
- /**
389
- * Whether or not the voice connection is signalling
390
- */
391
- isSignalling(): boolean;
392
- /**
393
- * Whether or not the voice connection is connecting
394
- */
395
- isConnecting(): boolean;
396
- /**
397
- * Creates stream
398
- * @param {Readable} src The stream source
399
- * @param {object} [ops] Options
400
- * @returns {AudioResource}
401
- */
402
- createStream(src: Readable, ops?: CreateStreamOps): Promise<AudioResource<Track<unknown>>>;
403
- get resampler(): _discord_player_equalizer.PCMResampler | null;
404
- get filters(): _discord_player_equalizer.AudioFilter | null;
405
- get biquad(): _discord_player_equalizer.BiquadStream | null;
406
- get equalizer(): _discord_player_equalizer.EqualizerStream | null;
407
- /**
408
- * The player status
409
- * @type {AudioPlayerStatus}
410
- */
411
- get status(): AudioPlayerStatus;
412
- /**
413
- * Disconnects from voice
414
- * @returns {void}
415
- */
416
- disconnect(): void;
417
- /**
418
- * Destroys this dispatcher
419
- */
420
- destroy(): void;
421
- /**
422
- * Stops the player
423
- * @returns {void}
424
- */
425
- end(): void;
426
- /**
427
- * Pauses the stream playback
428
- * @param {boolean} [interpolateSilence=false] If true, the player will play 5 packets of silence after pausing to prevent audio glitches.
429
- * @returns {boolean}
430
- */
431
- pause(interpolateSilence?: boolean): boolean;
432
- /**
433
- * Resumes the stream playback
434
- * @returns {boolean}
435
- */
436
- resume(): boolean;
437
- /**
438
- * Play stream
439
- * @param {AudioResource<Track>} [resource=this.audioResource] The audio resource to play
440
- * @returns {Promise<StreamDispatcher>}
441
- */
442
- playStream(resource?: AudioResource<Track>): Promise<this | undefined>;
443
- /**
444
- * Sets playback volume
445
- * @param {number} value The volume amount
446
- * @returns {boolean}
447
- */
448
- setVolume(value: number): boolean;
449
- /**
450
- * The current volume
451
- * @type {number}
452
- */
453
- get volume(): number;
454
- /**
455
- * The playback time
456
- * @type {number}
457
- */
458
- get streamTime(): number;
459
- }
460
-
461
- interface VoiceReceiverOptions {
462
- mode?: 'opus' | 'pcm';
463
- end?: EndBehaviorType;
464
- silenceDuration?: number;
465
- crc?: boolean;
466
- }
467
- type RawTrackInit = Partial<Omit<RawTrackData, 'author' | 'playlist' | 'source' | 'engine' | 'raw' | 'queryType' | 'description' | 'views'>>;
468
- declare class VoiceReceiverNode {
469
- dispatcher: StreamDispatcher;
470
- constructor(dispatcher: StreamDispatcher);
471
- createRawTrack(stream: Readable, data?: RawTrackInit): Track<unknown>;
472
- /**
473
- * Merge multiple streams together
474
- * @param streams The array of streams to merge
475
- */
476
- mergeRecordings(streams: Readable[]): void;
477
- /**
478
- * Record a user in voice channel
479
- * @param user The user to record
480
- * @param options Recording options
481
- */
482
- recordUser(user: UserResolvable, options?: VoiceReceiverOptions): Readable;
483
- }
484
-
485
- declare class GuildQueueHistory<Meta = unknown> {
486
- queue: GuildQueue<Meta>;
487
- tracks: Queue<Track<unknown>>;
488
- constructor(queue: GuildQueue<Meta>);
489
- /**
490
- * Current track in the queue
491
- */
492
- get currentTrack(): Track<unknown> | null;
493
- /**
494
- * Next track in the queue
495
- */
496
- get nextTrack(): Track<unknown> | null;
203
+ get nextTrack(): Track<unknown> | null;
497
204
  /**
498
205
  * Previous track in the queue
499
206
  */
@@ -805,26 +512,27 @@ declare function FFMPEG_ARGS_PIPED(fmt?: string): string[];
805
512
  declare function createFFmpegStream(stream: Readable | Duplex | string, options?: FFmpegStreamOptions): Readable;
806
513
 
807
514
  type Filters = keyof typeof AudioFilters.filters;
808
- declare const EqualizerConfigurationPreset: {
809
- readonly Flat: EqualizerBand[];
810
- readonly Classical: EqualizerBand[];
811
- readonly Club: EqualizerBand[];
812
- readonly Dance: EqualizerBand[];
813
- readonly FullBass: EqualizerBand[];
814
- readonly FullBassTreble: EqualizerBand[];
815
- readonly FullTreble: EqualizerBand[];
816
- readonly Headphones: EqualizerBand[];
817
- readonly LargeHall: EqualizerBand[];
818
- readonly Live: EqualizerBand[];
819
- readonly Party: EqualizerBand[];
820
- readonly Pop: EqualizerBand[];
821
- readonly Reggae: EqualizerBand[];
822
- readonly Rock: EqualizerBand[];
823
- readonly Ska: EqualizerBand[];
824
- readonly Soft: EqualizerBand[];
825
- readonly SoftRock: EqualizerBand[];
826
- readonly Techno: EqualizerBand[];
515
+ type EQPreset = {
516
+ Flat: EqualizerBand[];
517
+ Classical: EqualizerBand[];
518
+ Club: EqualizerBand[];
519
+ Dance: EqualizerBand[];
520
+ FullBass: EqualizerBand[];
521
+ FullBassTreble: EqualizerBand[];
522
+ FullTreble: EqualizerBand[];
523
+ Headphones: EqualizerBand[];
524
+ LargeHall: EqualizerBand[];
525
+ Live: EqualizerBand[];
526
+ Party: EqualizerBand[];
527
+ Pop: EqualizerBand[];
528
+ Reggae: EqualizerBand[];
529
+ Rock: EqualizerBand[];
530
+ Ska: EqualizerBand[];
531
+ Soft: EqualizerBand[];
532
+ SoftRock: EqualizerBand[];
533
+ Techno: EqualizerBand[];
827
534
  };
535
+ declare const EqualizerConfigurationPreset: Readonly<EQPreset>;
828
536
  declare class FFmpegFilterer<Meta = unknown> {
829
537
  #private;
830
538
  af: GuildQueueAudioFilters<Meta>;
@@ -918,26 +626,7 @@ declare class GuildQueueAudioFilters<Meta = unknown> {
918
626
  queue: GuildQueue<Meta>;
919
627
  graph: AFilterGraph<Meta>;
920
628
  ffmpeg: FFmpegFilterer<Meta>;
921
- equalizerPresets: {
922
- readonly Flat: EqualizerBand[];
923
- readonly Classical: EqualizerBand[];
924
- readonly Club: EqualizerBand[];
925
- readonly Dance: EqualizerBand[];
926
- readonly FullBass: EqualizerBand[];
927
- readonly FullBassTreble: EqualizerBand[];
928
- readonly FullTreble: EqualizerBand[];
929
- readonly Headphones: EqualizerBand[];
930
- readonly LargeHall: EqualizerBand[];
931
- readonly Live: EqualizerBand[];
932
- readonly Party: EqualizerBand[];
933
- readonly Pop: EqualizerBand[];
934
- readonly Reggae: EqualizerBand[];
935
- readonly Rock: EqualizerBand[];
936
- readonly Ska: EqualizerBand[];
937
- readonly Soft: EqualizerBand[];
938
- readonly SoftRock: EqualizerBand[];
939
- readonly Techno: EqualizerBand[];
940
- };
629
+ equalizerPresets: Readonly<EQPreset>;
941
630
  _lastFiltersCache: GuildQueueAFiltersCache;
942
631
  constructor(queue: GuildQueue<Meta>);
943
632
  /**
@@ -977,13 +666,43 @@ declare class AFilterGraph<Meta = unknown> {
977
666
  get resampler(): _discord_player_equalizer.PCMResampler | null;
978
667
  dump(): FilterGraph;
979
668
  }
980
- interface FilterGraph {
981
- ffmpeg: Filters[];
982
- equalizer: EqualizerBand[];
983
- biquad: Exclude<BiquadFilters, number> | null;
984
- filters: PCMFilters[];
985
- volume: number;
986
- sampleRate: number;
669
+ interface FilterGraph {
670
+ ffmpeg: Filters[];
671
+ equalizer: EqualizerBand[];
672
+ biquad: Exclude<BiquadFilters, number> | null;
673
+ filters: PCMFilters[];
674
+ volume: number;
675
+ sampleRate: number;
676
+ }
677
+
678
+ interface GuildQueueStatisticsMetadata {
679
+ latency: {
680
+ eventLoop: number;
681
+ voiceConnection: number;
682
+ };
683
+ status: {
684
+ buffering: boolean;
685
+ playing: boolean;
686
+ paused: boolean;
687
+ idle: boolean;
688
+ };
689
+ tracksCount: number;
690
+ historySize: number;
691
+ extractors: number;
692
+ listeners: number;
693
+ memoryUsage: NodeJS.MemoryUsage;
694
+ versions: {
695
+ node: string;
696
+ player: string;
697
+ };
698
+ }
699
+ declare class GuildQueueStatistics<Meta = unknown> {
700
+ queue: GuildQueue<Meta>;
701
+ constructor(queue: GuildQueue<Meta>);
702
+ /**
703
+ * Generate statistics of this queue
704
+ */
705
+ generate(): GuildQueueStatisticsMetadata;
987
706
  }
988
707
 
989
708
  interface GuildNodeInit<Meta = unknown> {
@@ -1387,181 +1106,444 @@ declare class GuildQueue<Meta = unknown> {
1387
1106
  */
1388
1107
  setTransitioning(state: boolean): void;
1389
1108
  /**
1390
- * if this queue is currently under transition mode
1109
+ * if this queue is currently under transition mode
1110
+ */
1111
+ isTransitioning(): boolean;
1112
+ /**
1113
+ * Set repeat mode for this queue
1114
+ * @param mode The repeat mode to apply
1115
+ */
1116
+ setRepeatMode(mode: QueueRepeatMode): void;
1117
+ /**
1118
+ * Max size of this queue
1119
+ */
1120
+ get maxSize(): number;
1121
+ /**
1122
+ * Max size of this queue
1123
+ */
1124
+ getMaxSize(): number;
1125
+ /**
1126
+ * Gets the size of the queue
1127
+ */
1128
+ get size(): number;
1129
+ /**
1130
+ * The size of this queue
1131
+ */
1132
+ getSize(): number;
1133
+ /**
1134
+ * Max history size of this queue
1135
+ */
1136
+ get maxHistorySize(): number;
1137
+ /**
1138
+ * Max history size of this queue
1139
+ */
1140
+ getMaxHistorySize(): number;
1141
+ /**
1142
+ * Set max history size for this queue
1143
+ * @param size The size to set
1144
+ */
1145
+ setMaxHistorySize(size: number): void;
1146
+ /**
1147
+ * Set max size for this queue
1148
+ * @param size The size to set
1149
+ */
1150
+ setMaxSize(size: number): void;
1151
+ /**
1152
+ * Clear this queue
1153
+ */
1154
+ clear(): void;
1155
+ /**
1156
+ * Check if this queue has no tracks left in it
1157
+ */
1158
+ isEmpty(): boolean;
1159
+ /**
1160
+ * Check if this queue is full
1161
+ */
1162
+ isFull(): boolean;
1163
+ /**
1164
+ * Get queue capacity
1165
+ */
1166
+ getCapacity(): number;
1167
+ /**
1168
+ * Check if this queue currently holds active audio resource
1169
+ */
1170
+ isPlaying(): boolean;
1171
+ /**
1172
+ * Add track to the queue. This will emit `audioTracksAdd` when multiple tracks are added, otherwise `audioTrackAdd`.
1173
+ * @param track Track or playlist or array of tracks to add
1174
+ */
1175
+ addTrack(track: Track | Track[] | Playlist): void;
1176
+ /**
1177
+ * Remove a track from queue
1178
+ * @param track The track to remove
1179
+ */
1180
+ removeTrack(track: TrackResolvable): Track<unknown> | null;
1181
+ /**
1182
+ * Inserts the track to the given index
1183
+ * @param track The track to insert
1184
+ * @param index The index to insert the track at (defaults to 0)
1185
+ */
1186
+ insertTrack(track: Track, index?: number): void;
1187
+ /**
1188
+ * Moves a track in the queue
1189
+ * @param from The track to move
1190
+ * @param to The position to move to
1191
+ */
1192
+ moveTrack(track: TrackResolvable, index?: number): void;
1193
+ /**
1194
+ * Copy a track in the queue
1195
+ * @param from The track to clone
1196
+ * @param to The position to clone at
1197
+ */
1198
+ copyTrack(track: TrackResolvable, index?: number): void;
1199
+ /**
1200
+ * Swap two tracks in the queue
1201
+ * @param src The first track to swap
1202
+ * @param dest The second track to swap
1203
+ */
1204
+ swapTracks(src: TrackResolvable, dest: TrackResolvable): void;
1205
+ /**
1206
+ * Create stream dispatcher from the given connection
1207
+ * @param connection The connection to use
1208
+ */
1209
+ createDispatcher(connection: VoiceConnection, options?: Pick<VoiceConnectConfig, 'audioPlayer' | 'timeout'>): void;
1210
+ /**
1211
+ * Connect to a voice channel
1212
+ * @param channelResolvable The voice channel to connect to
1213
+ * @param options Join config
1214
+ */
1215
+ connect(channelResolvable: GuildVoiceChannelResolvable, options?: VoiceConnectConfig): Promise<this>;
1216
+ /**
1217
+ * The voice connection latency of this queue
1218
+ */
1219
+ get ping(): number;
1220
+ /**
1221
+ * Delete this queue
1222
+ */
1223
+ delete(): void;
1224
+ /**
1225
+ * Revives this queue
1226
+ * @returns
1227
+ */
1228
+ revive(): void;
1229
+ /**
1230
+ * Set self deaf
1231
+ * @param mode On/Off state
1232
+ * @param reason Reason
1233
+ */
1234
+ setSelfDeaf(mode?: boolean, reason?: string): Promise<discord_js.GuildMember>;
1235
+ /**
1236
+ * Set self mute
1237
+ * @param mode On/Off state
1238
+ * @param reason Reason
1239
+ */
1240
+ setSelfMute(mode?: boolean, reason?: string): Promise<discord_js.GuildMember>;
1241
+ /**
1242
+ * Play a track in this queue
1243
+ * @param track The track to be played
1244
+ * @param options Player node initialization options
1245
+ */
1246
+ play(track: TrackLike, options?: PlayerNodeInitializerOptions<Meta>): Promise<PlayerNodeInitializationResult<Meta>>;
1247
+ /**
1248
+ * Emit an event on this queue
1249
+ * @param event The event to emit
1250
+ * @param args The args for the event
1251
+ */
1252
+ emit<K extends keyof GuildQueueEvents<Meta>>(event: K, ...args: Parameters<GuildQueueEvents<Meta>[K]>): boolean;
1253
+ get hasDebugger(): boolean;
1254
+ }
1255
+
1256
+ interface ExtractorExecutionEvents {
1257
+ /**
1258
+ * Emitted when a extractor is registered
1259
+ * @param context The context where extractor was registered
1260
+ * @param extractor The extractor that was registered
1261
+ */
1262
+ registered: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
1263
+ /**
1264
+ * Emitted when a extractor is unregistered
1265
+ * @param context The context where extractor was unregistered
1266
+ * @param extractor The extractor that was unregistered
1267
+ */
1268
+ unregistered: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
1269
+ /**
1270
+ * Emitted when a extractor is activated
1271
+ * @param context The context where this event occurred
1272
+ * @param extractor The extractor which was activated
1273
+ */
1274
+ activate: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
1275
+ /**
1276
+ * Emitted when a extractor is deactivated
1277
+ * @param context The context where this event occurred
1278
+ * @param extractor The extractor which was deactivated
1279
+ */
1280
+ deactivate: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
1281
+ /**
1282
+ * Emitted when a extractor fails to activate/deactivate
1283
+ * @param context The context where this event occurred
1284
+ * @param extractor The extractor which was deactivated
1285
+ */
1286
+ error: (context: ExtractorExecutionContext, extractor: BaseExtractor, error: Error) => unknown;
1287
+ }
1288
+ declare class ExtractorExecutionContext extends PlayerEventsEmitter<ExtractorExecutionEvents> {
1289
+ player: Player;
1290
+ store: Collection<string, BaseExtractor<object>>;
1291
+ constructor(player: Player);
1292
+ /**
1293
+ * Load default extractors from `@discord-player/extractor`
1294
+ */
1295
+ loadDefault(): Promise<{
1296
+ success: boolean;
1297
+ error: Error;
1298
+ } | {
1299
+ success: boolean;
1300
+ error: null;
1301
+ }>;
1302
+ /**
1303
+ * Validate if the given extractor is registered
1304
+ * @param identifier The extractor identifier
1305
+ */
1306
+ isRegistered(identifier: string): boolean;
1307
+ /**
1308
+ * The size of registered extractors
1309
+ */
1310
+ get size(): number;
1311
+ /**
1312
+ * Get single extractor
1313
+ * @param identifier The extractor to get
1314
+ */
1315
+ get(identifier: string): BaseExtractor<object> | undefined;
1316
+ /**
1317
+ * Register single extractor
1318
+ * @param _extractor The extractor to register
1319
+ * @param options Options supplied to the extractor
1320
+ */
1321
+ register<O extends object, T extends typeof BaseExtractor<O>>(_extractor: T, options: ConstructorParameters<T>['1']): Promise<void>;
1322
+ /**
1323
+ * Unregister single extractor
1324
+ * @param _extractor The extractor to unregister
1325
+ */
1326
+ unregister<K extends string | BaseExtractor>(_extractor: K): Promise<void>;
1327
+ /**
1328
+ * Unregister all extractors
1329
+ */
1330
+ unregisterAll(): Promise<void>;
1331
+ /**
1332
+ * Run all the extractors
1333
+ * @param fn The runner function
1334
+ * @param filterBlocked Filter blocked extractors
1335
+ */
1336
+ run<T = unknown>(fn: ExtractorExecutionFN<T>, filterBlocked?: boolean): Promise<ExtractorExecutionResult<T> | ExtractorExecutionResult<false> | undefined>;
1337
+ }
1338
+ interface ExtractorExecutionResult<T = unknown> {
1339
+ extractor: BaseExtractor;
1340
+ error: Error | null;
1341
+ result: T;
1342
+ }
1343
+ type ExtractorExecutionFN<T = unknown> = (extractor: BaseExtractor) => Promise<T | boolean>;
1344
+
1345
+ declare class BaseExtractor<T extends object = object> {
1346
+ context: ExtractorExecutionContext;
1347
+ options: T;
1348
+ /**
1349
+ * Identifier for this extractor
1391
1350
  */
1392
- isTransitioning(): boolean;
1351
+ static identifier: string;
1393
1352
  /**
1394
- * Set repeat mode for this queue
1395
- * @param mode The repeat mode to apply
1353
+ * Handle bridge query creation
1354
+ * @param track The track to build query for
1396
1355
  */
1397
- setRepeatMode(mode: QueueRepeatMode): void;
1356
+ createBridgeQuery: (track: Track) => string;
1398
1357
  /**
1399
- * Max size of this queue
1358
+ * Extractor constructor
1359
+ * @param context Context that instantiated this extractor
1360
+ * @param options Initialization options for this extractor
1400
1361
  */
1401
- get maxSize(): number;
1362
+ constructor(context: ExtractorExecutionContext, options?: T);
1402
1363
  /**
1403
- * Max size of this queue
1364
+ * Identifier of this extractor
1404
1365
  */
1405
- getMaxSize(): number;
1366
+ get identifier(): string;
1406
1367
  /**
1407
- * Gets the size of the queue
1368
+ * Reconfigures this extractor
1369
+ * @param options The new options to apply
1408
1370
  */
1409
- get size(): number;
1371
+ reconfigure(options: T): Promise<void>;
1410
1372
  /**
1411
- * The size of this queue
1373
+ * This method will be executed when this extractor is activated
1412
1374
  */
1413
- getSize(): number;
1375
+ activate(): Promise<void>;
1414
1376
  /**
1415
- * Max history size of this queue
1377
+ * This method will be executed when this extractor is deactivated
1416
1378
  */
1417
- get maxHistorySize(): number;
1379
+ deactivate(): Promise<void>;
1418
1380
  /**
1419
- * Max history size of this queue
1381
+ * Validate incoming query
1382
+ * @param query The query to validate
1420
1383
  */
1421
- getMaxHistorySize(): number;
1384
+ validate(query: string, type?: SearchQueryType | null): Promise<boolean>;
1422
1385
  /**
1423
- * Set max history size for this queue
1424
- * @param size The size to set
1386
+ * Stream the given track
1387
+ * @param info The track to stream
1425
1388
  */
1426
- setMaxHistorySize(size: number): void;
1389
+ stream(info: Track): Promise<Readable | string>;
1427
1390
  /**
1428
- * Set max size for this queue
1429
- * @param size The size to set
1391
+ * Handle the given query
1392
+ * @param query The query to handle
1430
1393
  */
1431
- setMaxSize(size: number): void;
1394
+ handle(query: string, context: ExtractorSearchContext): Promise<ExtractorInfo>;
1432
1395
  /**
1433
- * Clear this queue
1396
+ * Get related tracks for the given track
1397
+ * @param track The track source
1434
1398
  */
1435
- clear(): void;
1399
+ getRelatedTracks(track: Track): Promise<ExtractorInfo>;
1436
1400
  /**
1437
- * Check if this queue has no tracks left in it
1401
+ * A stream middleware to handle streams before passing it to the player
1402
+ * @param stream The incoming stream
1403
+ * @param next The next function
1438
1404
  */
1439
- isEmpty(): boolean;
1405
+ handlePostStream(stream: Readable, next: NextFunction): void;
1440
1406
  /**
1441
- * Check if this queue is full
1407
+ * Dispatch an event to the player
1408
+ * @param event The event to dispatch
1409
+ * @param args The data to dispatch
1442
1410
  */
1443
- isFull(): boolean;
1411
+ emit<K extends keyof PlayerEvents>(event: K, ...args: Parameters<PlayerEvents[K]>): boolean;
1444
1412
  /**
1445
- * Get queue capacity
1413
+ * Create extractor response
1414
+ * @param playlist The playlist
1415
+ * @param tracks The track array
1446
1416
  */
1447
- getCapacity(): number;
1417
+ createResponse(playlist?: Playlist | null, tracks?: Track[]): ExtractorInfo;
1448
1418
  /**
1449
- * Check if this queue currently holds active audio resource
1419
+ * Write debug message
1420
+ * @param message The debug message
1450
1421
  */
1451
- isPlaying(): boolean;
1422
+ debug(message: string): boolean;
1423
+ }
1424
+ type NextFunction = (error?: Error | null, stream?: Readable) => void;
1425
+ interface ExtractorInfo {
1426
+ playlist: Playlist | null;
1427
+ tracks: Track[];
1428
+ }
1429
+ interface ExtractorSearchContext {
1430
+ type?: SearchQueryType | null;
1431
+ requestedBy?: User | null;
1432
+ requestOptions?: RequestOptions;
1433
+ }
1434
+
1435
+ type TrackResolvable = Track | string | number;
1436
+ type WithMetadata<T extends object, M> = T & {
1437
+ metadata: M;
1438
+ requestMetadata(): Promise<M>;
1439
+ };
1440
+ declare class Track<T = unknown> {
1441
+ readonly player: Player;
1442
+ title: string;
1443
+ description: string;
1444
+ author: string;
1445
+ url: string;
1446
+ thumbnail: string;
1447
+ duration: string;
1448
+ views: number;
1449
+ requestedBy: User | null;
1450
+ playlist?: Playlist;
1451
+ queryType: SearchQueryType | null | undefined;
1452
+ raw: RawTrackData;
1453
+ extractor: BaseExtractor | null;
1454
+ readonly id: string;
1455
+ private __metadata;
1456
+ private __reqMetadataFn;
1452
1457
  /**
1453
- * Add track to the queue. This will emit `audioTracksAdd` when multiple tracks are added, otherwise `audioTrackAdd`.
1454
- * @param track Track or playlist or array of tracks to add
1458
+ * Track constructor
1459
+ * @param player The player that instantiated this Track
1460
+ * @param data Track data
1455
1461
  */
1456
- addTrack(track: Track | Track[] | Playlist): void;
1462
+ constructor(player: Player, data: Partial<WithMetadata<RawTrackData, T>>);
1457
1463
  /**
1458
- * Remove a track from queue
1459
- * @param track The track to remove
1464
+ * Request metadata for this track
1460
1465
  */
1461
- removeTrack(track: TrackResolvable): Track<unknown> | null;
1466
+ requestMetadata(): Promise<T | null>;
1462
1467
  /**
1463
- * Inserts the track to the given index
1464
- * @param track The track to insert
1465
- * @param index The index to insert the track at (defaults to 0)
1468
+ * Set metadata for this track
1466
1469
  */
1467
- insertTrack(track: Track, index?: number): void;
1470
+ setMetadata(m: T | null): void;
1468
1471
  /**
1469
- * Moves a track in the queue
1470
- * @param from The track to move
1471
- * @param to The position to move to
1472
+ * Metadata of this track
1472
1473
  */
1473
- moveTrack(track: TrackResolvable, index?: number): void;
1474
+ get metadata(): T | null;
1474
1475
  /**
1475
- * Copy a track in the queue
1476
- * @param from The track to clone
1477
- * @param to The position to clone at
1476
+ * If this track has metadata
1478
1477
  */
1479
- copyTrack(track: TrackResolvable, index?: number): void;
1478
+ get hasMetadata(): boolean;
1480
1479
  /**
1481
- * Swap two tracks in the queue
1482
- * @param src The first track to swap
1483
- * @param dest The second track to swap
1480
+ * The queue in which this track is located
1484
1481
  */
1485
- swapTracks(src: TrackResolvable, dest: TrackResolvable): void;
1482
+ get queue(): GuildQueue;
1486
1483
  /**
1487
- * Create stream dispatcher from the given connection
1488
- * @param connection The connection to use
1484
+ * The track duration in millisecond
1489
1485
  */
1490
- createDispatcher(connection: VoiceConnection, options?: Pick<VoiceConnectConfig, 'audioPlayer' | 'timeout'>): void;
1486
+ get durationMS(): number;
1491
1487
  /**
1492
- * Connect to a voice channel
1493
- * @param channelResolvable The voice channel to connect to
1494
- * @param options Join config
1488
+ * Returns source of this track
1495
1489
  */
1496
- connect(channelResolvable: GuildVoiceChannelResolvable, options?: VoiceConnectConfig): Promise<this>;
1490
+ get source(): TrackSource;
1497
1491
  /**
1498
- * The voice connection latency of this queue
1492
+ * String representation of this track
1499
1493
  */
1500
- get ping(): number;
1494
+ toString(): string;
1501
1495
  /**
1502
- * Delete this queue
1496
+ * Raw JSON representation of this track
1503
1497
  */
1504
- delete(): void;
1498
+ toJSON(hidePlaylist?: boolean): TrackJSON;
1505
1499
  /**
1506
- * Revives this queue
1507
- * @returns
1500
+ * Get belonging queues of this track
1508
1501
  */
1509
- revive(): void;
1502
+ getBelongingQueues(): Collection<string, GuildQueue<unknown>>;
1510
1503
  /**
1511
- * Set self deaf
1512
- * @param mode On/Off state
1513
- * @param reason Reason
1504
+ * Play this track to the given voice channel. If queue exists and another track is being played, this track will be added to the queue.
1505
+ * @param channel Voice channel on which this track shall be played
1506
+ * @param options Node initialization options
1514
1507
  */
1515
- setSelfDeaf(mode?: boolean, reason?: string): Promise<discord_js.GuildMember>;
1508
+ play<T = unknown>(channel: GuildVoiceChannelResolvable, options?: PlayerNodeInitializerOptions<T>): Promise<PlayerNodeInitializationResult<T>>;
1509
+ }
1510
+
1511
+ declare class Playlist {
1512
+ readonly player: Player;
1513
+ tracks: Track[];
1514
+ title: string;
1515
+ description: string;
1516
+ thumbnail: string;
1517
+ type: 'album' | 'playlist';
1518
+ source: TrackSource;
1519
+ author: {
1520
+ name: string;
1521
+ url: string;
1522
+ };
1523
+ id: string;
1524
+ url: string;
1525
+ readonly rawPlaylist?: any;
1516
1526
  /**
1517
- * Set self mute
1518
- * @param mode On/Off state
1519
- * @param reason Reason
1527
+ * Playlist constructor
1528
+ * @param {Player} player The player
1529
+ * @param {PlaylistInitData} data The data
1520
1530
  */
1521
- setSelfMute(mode?: boolean, reason?: string): Promise<discord_js.GuildMember>;
1531
+ constructor(player: Player, data: PlaylistInitData);
1532
+ [Symbol.iterator](): Generator<Track<unknown>, void, undefined>;
1522
1533
  /**
1523
- * Play a track in this queue
1524
- * @param track The track to be played
1525
- * @param options Player node initialization options
1534
+ * Estimated duration of this playlist
1526
1535
  */
1527
- play(track: TrackLike, options?: PlayerNodeInitializerOptions<Meta>): Promise<PlayerNodeInitializationResult<Meta>>;
1536
+ get estimatedDuration(): number;
1528
1537
  /**
1529
- * Emit an event on this queue
1530
- * @param event The event to emit
1531
- * @param args The args for the event
1538
+ * Formatted estimated duration of this playlist
1532
1539
  */
1533
- emit<K extends keyof GuildQueueEvents<Meta>>(event: K, ...args: Parameters<GuildQueueEvents<Meta>[K]>): boolean;
1534
- get hasDebugger(): boolean;
1535
- }
1536
-
1537
- interface GuildQueueStatisticsMetadata {
1538
- latency: {
1539
- eventLoop: number;
1540
- voiceConnection: number;
1541
- };
1542
- status: {
1543
- buffering: boolean;
1544
- playing: boolean;
1545
- paused: boolean;
1546
- idle: boolean;
1547
- };
1548
- tracksCount: number;
1549
- historySize: number;
1550
- extractors: number;
1551
- listeners: number;
1552
- memoryUsage: NodeJS.MemoryUsage;
1553
- versions: {
1554
- node: string;
1555
- player: string;
1556
- };
1557
- }
1558
- declare class GuildQueueStatistics<Meta = unknown> {
1559
- queue: GuildQueue<Meta>;
1560
- constructor(queue: GuildQueue<Meta>);
1540
+ get durationFormatted(): string;
1561
1541
  /**
1562
- * Generate statistics of this queue
1542
+ * JSON representation of this playlist
1543
+ * @param {boolean} [withTracks=true] If it should build json with tracks
1544
+ * @returns {PlaylistJSON}
1563
1545
  */
1564
- generate(): GuildQueueStatisticsMetadata;
1546
+ toJSON(withTracks?: boolean): PlaylistJSON;
1565
1547
  }
1566
1548
 
1567
1549
  interface SearchResultData {
@@ -2514,4 +2496,4 @@ declare function createHook<T extends HookDeclaration<(...args: any[]) => any>>(
2514
2496
 
2515
2497
  declare const version: string;
2516
2498
 
2517
- export { AFilterGraph, AsyncQueue, AsyncQueueAcquisitionOptions, AsyncQueueEntry, AudioFilters, BaseExtractor, CreateStreamOps, DiscordPlayerQueryResultCache, EqualizerConfigurationPreset, ExtractorExecutionContext, ExtractorExecutionEvents, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorSearchContext, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFMPEG_SRATE_REGEX, FFmpegFilterer, FFmpegStreamOptions, FilterGraph, FiltersName, GuildNodeCreateOptions, GuildNodeInit, GuildNodeManager, GuildQueue, GuildQueueAFiltersCache, GuildQueueAudioFilters, GuildQueueEvent, GuildQueueEvents, GuildQueueHistory, GuildQueuePlayerNode, HookDeclaration, HookDeclarationContext, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerEvent, PlayerEvents, PlayerEventsEmitter, PlayerInitOptions, PlayerNodeInitializationResult, PlayerNodeInitializerOptions, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheResolverContext, QueryExtractorSearch, QueryResolver, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, RawTrackInit, ResourcePlayOptions, SearchOptions, SearchQueryType, SearchResult, SearchResultData, StreamConfig, StreamDispatcher, TimeData, TimelineDispatcherOptions, Track, TrackJSON, TrackLike, TrackResolvable, TrackSource, TypeUtil, Util, VALIDATE_QUEUE_CAP, VoiceConnectConfig, VoiceEvents, VoiceReceiverNode, VoiceReceiverOptions, VoiceStateHandler, VoiceUtils, WithMetadata, createFFmpegStream, createHook, onAfterCreateStream, onBeforeCreateStream, useHistory, useMainPlayer, useMasterPlayer, useMetadata, usePlayer, useQueue, useTimeline, useVolume, version };
2499
+ export { AFilterGraph, AsyncQueue, AsyncQueueAcquisitionOptions, AsyncQueueEntry, AudioFilters, BaseExtractor, CreateStreamOps, DiscordPlayerQueryResultCache, EqualizerConfigurationPreset, ExtractorExecutionContext, ExtractorExecutionEvents, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorSearchContext, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFMPEG_SRATE_REGEX, FFmpegFilterer, FFmpegStreamOptions, FilterGraph, FiltersName, GuildNodeCreateOptions, GuildNodeInit, GuildNodeManager, GuildQueue, GuildQueueAFiltersCache, GuildQueueAudioFilters, GuildQueueEvent, GuildQueueEvents, GuildQueueHistory, GuildQueuePlayerNode, GuildQueueStatistics, GuildQueueStatisticsMetadata, HookDeclaration, HookDeclarationContext, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerEvent, PlayerEvents, PlayerEventsEmitter, PlayerInitOptions, PlayerNodeInitializationResult, PlayerNodeInitializerOptions, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheResolverContext, QueryExtractorSearch, QueryResolver, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, RawTrackInit, ResourcePlayOptions, SearchOptions, SearchQueryType, SearchResult, SearchResultData, StreamConfig, StreamDispatcher, TimeData, TimelineDispatcherOptions, Track, TrackJSON, TrackLike, TrackResolvable, TrackSource, TypeUtil, Util, VALIDATE_QUEUE_CAP, VoiceConnectConfig, VoiceEvents, VoiceReceiverNode, VoiceReceiverOptions, VoiceStateHandler, VoiceUtils, WithMetadata, createFFmpegStream, createHook, onAfterCreateStream, onBeforeCreateStream, useHistory, useMainPlayer, useMasterPlayer, useMetadata, usePlayer, useQueue, useTimeline, useVolume, version };