discord-player 6.2.0 → 6.3.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
@@ -4,2274 +4,2346 @@ import { User, VoiceChannel, StageChannel, UserResolvable, Guild, VoiceState, Vo
4
4
  import * as _discordjs_voice from '@discordjs/voice';
5
5
  import { AudioPlayerError, AudioResource, VoiceConnection, AudioPlayer, AudioPlayerStatus, StreamType, EndBehaviorType } from '@discordjs/voice';
6
6
  export { AudioPlayer, CreateAudioPlayerOptions, createAudioPlayer } from '@discordjs/voice';
7
- import { Readable, Duplex } from 'stream';
7
+ import * as stream from 'stream';
8
+ import { Readable, Duplex, DuplexOptions } from 'stream';
8
9
  import * as _discord_player_equalizer from '@discord-player/equalizer';
9
10
  import { PCMFilters, EqualizerBand, BiquadFilters, FiltersChain } from '@discord-player/equalizer';
10
11
  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';
11
12
  import { RequestOptions } from 'http';
12
13
  import { downloadOptions } from 'ytdl-core';
14
+ import childProcess from 'child_process';
13
15
 
14
- declare class PlayerEventsEmitter<L extends ListenerSignature<L> = DefaultListener> extends EventEmitter<L> {
15
- requiredEvents: Array<keyof L>;
16
- constructor(requiredEvents?: Array<keyof L>);
17
- emit<K extends keyof L>(name: K, ...args: Parameters<L[K]>): boolean;
16
+ declare class PlayerEventsEmitter<L extends ListenerSignature<L> = DefaultListener> extends EventEmitter<L> {
17
+ requiredEvents: Array<keyof L>;
18
+ constructor(requiredEvents?: Array<keyof L>);
19
+ emit<K extends keyof L>(name: K, ...args: Parameters<L[K]>): boolean;
18
20
  }
19
21
 
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;
35
- /**
36
- * Playlist constructor
37
- * @param {Player} player The player
38
- * @param {PlaylistInitData} data The data
39
- */
40
- constructor(player: Player, data: PlaylistInitData);
41
- [Symbol.iterator](): Generator<Track, void, undefined>;
42
- /**
43
- * Estimated duration of this playlist
44
- */
45
- get estimatedDuration(): number;
46
- /**
47
- * Formatted estimated duration of this playlist
48
- */
49
- get durationFormatted(): string;
50
- /**
51
- * JSON representation of this playlist
52
- * @param {boolean} [withTracks=true] If it should build json with tracks
53
- * @returns {PlaylistJSON}
54
- */
55
- toJSON(withTracks?: boolean): PlaylistJSON;
22
+ declare class Playlist {
23
+ readonly player: Player;
24
+ tracks: Track[];
25
+ title: string;
26
+ description: string;
27
+ thumbnail: string;
28
+ type: 'album' | 'playlist';
29
+ source: TrackSource;
30
+ author: {
31
+ name: string;
32
+ url: string;
33
+ };
34
+ id: string;
35
+ url: string;
36
+ readonly rawPlaylist?: any;
37
+ /**
38
+ * Playlist constructor
39
+ * @param {Player} player The player
40
+ * @param {PlaylistInitData} data The data
41
+ */
42
+ constructor(player: Player, data: PlaylistInitData);
43
+ [Symbol.iterator](): Generator<Track, void, undefined>;
44
+ /**
45
+ * Estimated duration of this playlist
46
+ */
47
+ get estimatedDuration(): number;
48
+ /**
49
+ * Formatted estimated duration of this playlist
50
+ */
51
+ get durationFormatted(): string;
52
+ /**
53
+ * JSON representation of this playlist
54
+ * @param {boolean} [withTracks=true] If it should build json with tracks
55
+ * @returns {PlaylistJSON}
56
+ */
57
+ toJSON(withTracks?: boolean): PlaylistJSON;
56
58
  }
57
59
 
58
- interface ExtractorExecutionEvents {
59
- /**
60
- * Emitted when a extractor is registered
61
- * @param context The context where extractor was registered
62
- * @param extractor The extractor that was registered
63
- */
64
- registered: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
65
- /**
66
- * Emitted when a extractor is unregistered
67
- * @param context The context where extractor was unregistered
68
- * @param extractor The extractor that was unregistered
69
- */
70
- unregistered: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
71
- /**
72
- * Emitted when a extractor is activated
73
- * @param context The context where this event occurred
74
- * @param extractor The extractor which was activated
75
- */
76
- activate: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
77
- /**
78
- * Emitted when a extractor is deactivated
79
- * @param context The context where this event occurred
80
- * @param extractor The extractor which was deactivated
81
- */
82
- deactivate: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
83
- /**
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
87
- */
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
- /**
95
- * Load default extractors from `@discord-player/extractor`
96
- */
97
- loadDefault(): Promise<{
98
- success: boolean;
99
- error: Error;
100
- } | {
101
- success: boolean;
102
- error: null;
103
- }>;
104
- /**
105
- * Validate if the given extractor is registered
106
- * @param identifier The extractor identifier
107
- */
108
- isRegistered(identifier: string): boolean;
109
- /**
110
- * The size of registered extractors
111
- */
112
- get size(): number;
113
- /**
114
- * Get single extractor
115
- * @param identifier The extractor to get
116
- */
117
- get(identifier: string): BaseExtractor<object> | undefined;
118
- /**
119
- * Register single extractor
120
- * @param _extractor The extractor to register
121
- * @param options Options supplied to the extractor
122
- */
123
- register<O extends object, T extends typeof BaseExtractor<O>>(_extractor: T, options: ConstructorParameters<T>['1']): Promise<void>;
124
- /**
125
- * Unregister single extractor
126
- * @param _extractor The extractor to unregister
127
- */
128
- unregister<K extends string | BaseExtractor>(_extractor: K): Promise<void>;
129
- /**
130
- * Unregister all extractors
131
- */
132
- unregisterAll(): Promise<void>;
133
- /**
134
- * Run all the extractors
135
- * @param fn The runner function
136
- * @param filterBlocked Filter blocked extractors
137
- */
138
- run<T = unknown>(fn: ExtractorExecutionFN<T>, filterBlocked?: boolean): Promise<ExtractorExecutionResult<T> | undefined>;
139
- }
140
- interface ExtractorExecutionResult<T = unknown> {
141
- extractor: BaseExtractor;
142
- error: Error | null;
143
- result: T;
144
- }
60
+ interface ExtractorExecutionEvents {
61
+ /**
62
+ * Emitted when a extractor is registered
63
+ * @param context The context where extractor was registered
64
+ * @param extractor The extractor that was registered
65
+ */
66
+ registered: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
67
+ /**
68
+ * Emitted when a extractor is unregistered
69
+ * @param context The context where extractor was unregistered
70
+ * @param extractor The extractor that was unregistered
71
+ */
72
+ unregistered: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
73
+ /**
74
+ * Emitted when a extractor is activated
75
+ * @param context The context where this event occurred
76
+ * @param extractor The extractor which was activated
77
+ */
78
+ activate: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
79
+ /**
80
+ * Emitted when a extractor is deactivated
81
+ * @param context The context where this event occurred
82
+ * @param extractor The extractor which was deactivated
83
+ */
84
+ deactivate: (context: ExtractorExecutionContext, extractor: BaseExtractor) => unknown;
85
+ /**
86
+ * Emitted when a extractor fails to activate/deactivate
87
+ * @param context The context where this event occurred
88
+ * @param extractor The extractor which was deactivated
89
+ */
90
+ error: (context: ExtractorExecutionContext, extractor: BaseExtractor, error: Error) => unknown;
91
+ }
92
+ declare class ExtractorExecutionContext extends PlayerEventsEmitter<ExtractorExecutionEvents> {
93
+ player: Player;
94
+ store: Collection<string, BaseExtractor<object>>;
95
+ constructor(player: Player);
96
+ /**
97
+ * Load default extractors from `@discord-player/extractor`
98
+ */
99
+ loadDefault(): Promise<{
100
+ success: boolean;
101
+ error: Error;
102
+ } | {
103
+ success: boolean;
104
+ error: null;
105
+ }>;
106
+ /**
107
+ * Validate if the given extractor is registered
108
+ * @param identifier The extractor identifier
109
+ */
110
+ isRegistered(identifier: string): boolean;
111
+ /**
112
+ * The size of registered extractors
113
+ */
114
+ get size(): number;
115
+ /**
116
+ * Get single extractor
117
+ * @param identifier The extractor to get
118
+ */
119
+ get(identifier: string): BaseExtractor<object> | undefined;
120
+ /**
121
+ * Register single extractor
122
+ * @param _extractor The extractor to register
123
+ * @param options Options supplied to the extractor
124
+ */
125
+ register<O extends object, T extends typeof BaseExtractor<O>>(_extractor: T, options: ConstructorParameters<T>['1']): Promise<void>;
126
+ /**
127
+ * Unregister single extractor
128
+ * @param _extractor The extractor to unregister
129
+ */
130
+ unregister<K extends string | BaseExtractor>(_extractor: K): Promise<void>;
131
+ /**
132
+ * Unregister all extractors
133
+ */
134
+ unregisterAll(): Promise<void>;
135
+ /**
136
+ * Run all the extractors
137
+ * @param fn The runner function
138
+ * @param filterBlocked Filter blocked extractors
139
+ */
140
+ run<T = unknown>(fn: ExtractorExecutionFN<T>, filterBlocked?: boolean): Promise<ExtractorExecutionResult<T> | ExtractorExecutionResult<false> | undefined>;
141
+ }
142
+ interface ExtractorExecutionResult<T = unknown> {
143
+ extractor: BaseExtractor;
144
+ error: Error | null;
145
+ result: T;
146
+ }
145
147
  type ExtractorExecutionFN<T = unknown> = (extractor: BaseExtractor) => Promise<T | boolean>;
146
148
 
147
- declare class BaseExtractor<T extends object = object> {
148
- context: ExtractorExecutionContext;
149
- options: T;
150
- /**
151
- * Identifier for this extractor
152
- */
153
- static identifier: string;
154
- /**
155
- * Extractor constructor
156
- * @param context Context that instantiated this extractor
157
- * @param options Initialization options for this extractor
158
- */
159
- constructor(context: ExtractorExecutionContext, options?: T);
160
- /**
161
- * Identifier of this extractor
162
- */
163
- get identifier(): string;
164
- /**
165
- * Reconfigures this extractor
166
- * @param options The new options to apply
167
- */
168
- reconfigure(options: T): Promise<void>;
169
- /**
170
- * This method will be executed when this extractor is activated
171
- */
172
- activate(): Promise<void>;
173
- /**
174
- * This method will be executed when this extractor is deactivated
175
- */
176
- deactivate(): Promise<void>;
177
- /**
178
- * Validate incoming query
179
- * @param query The query to validate
180
- */
181
- validate(query: string, type?: SearchQueryType | null): Promise<boolean>;
182
- /**
183
- * Stream the given track
184
- * @param info The track to stream
185
- */
186
- stream(info: Track): Promise<Readable | string>;
187
- /**
188
- * Handle the given query
189
- * @param query The query to handle
190
- */
191
- handle(query: string, context: ExtractorSearchContext): Promise<ExtractorInfo>;
192
- /**
193
- * Get related tracks for the given track
194
- * @param track The track source
195
- */
196
- getRelatedTracks(track: Track): Promise<ExtractorInfo>;
197
- /**
198
- * A stream middleware to handle streams before passing it to the player
199
- * @param stream The incoming stream
200
- * @param next The next function
201
- */
202
- handlePostStream(stream: Readable, next: NextFunction): void;
203
- /**
204
- * Dispatch an event to the player
205
- * @param event The event to dispatch
206
- * @param args The data to dispatch
207
- */
208
- emit<K extends keyof PlayerEvents>(event: K, ...args: Parameters<PlayerEvents[K]>): boolean;
209
- /**
210
- * Create extractor response
211
- * @param playlist The playlist
212
- * @param tracks The track array
213
- */
214
- createResponse(playlist?: Playlist | null, tracks?: Track[]): ExtractorInfo;
215
- /**
216
- * Write debug message
217
- * @param message The debug message
218
- */
219
- debug(message: string): boolean;
220
- }
221
- type NextFunction = (error?: Error | null, stream?: Readable) => void;
222
- interface ExtractorInfo {
223
- playlist: Playlist | null;
224
- tracks: Track[];
225
- }
226
- interface ExtractorSearchContext {
227
- type?: SearchQueryType | null;
228
- requestedBy?: User | null;
229
- requestOptions?: RequestOptions;
149
+ declare class BaseExtractor<T extends object = object> {
150
+ context: ExtractorExecutionContext;
151
+ options: T;
152
+ /**
153
+ * Identifier for this extractor
154
+ */
155
+ static identifier: string;
156
+ /**
157
+ * Extractor constructor
158
+ * @param context Context that instantiated this extractor
159
+ * @param options Initialization options for this extractor
160
+ */
161
+ constructor(context: ExtractorExecutionContext, options?: T);
162
+ /**
163
+ * Identifier of this extractor
164
+ */
165
+ get identifier(): string;
166
+ /**
167
+ * Reconfigures this extractor
168
+ * @param options The new options to apply
169
+ */
170
+ reconfigure(options: T): Promise<void>;
171
+ /**
172
+ * This method will be executed when this extractor is activated
173
+ */
174
+ activate(): Promise<void>;
175
+ /**
176
+ * This method will be executed when this extractor is deactivated
177
+ */
178
+ deactivate(): Promise<void>;
179
+ /**
180
+ * Validate incoming query
181
+ * @param query The query to validate
182
+ */
183
+ validate(query: string, type?: SearchQueryType | null): Promise<boolean>;
184
+ /**
185
+ * Stream the given track
186
+ * @param info The track to stream
187
+ */
188
+ stream(info: Track): Promise<Readable | string>;
189
+ /**
190
+ * Handle the given query
191
+ * @param query The query to handle
192
+ */
193
+ handle(query: string, context: ExtractorSearchContext): Promise<ExtractorInfo>;
194
+ /**
195
+ * Get related tracks for the given track
196
+ * @param track The track source
197
+ */
198
+ getRelatedTracks(track: Track): Promise<ExtractorInfo>;
199
+ /**
200
+ * A stream middleware to handle streams before passing it to the player
201
+ * @param stream The incoming stream
202
+ * @param next The next function
203
+ */
204
+ handlePostStream(stream: Readable, next: NextFunction): void;
205
+ /**
206
+ * Dispatch an event to the player
207
+ * @param event The event to dispatch
208
+ * @param args The data to dispatch
209
+ */
210
+ emit<K extends keyof PlayerEvents>(event: K, ...args: Parameters<PlayerEvents[K]>): boolean;
211
+ /**
212
+ * Create extractor response
213
+ * @param playlist The playlist
214
+ * @param tracks The track array
215
+ */
216
+ createResponse(playlist?: Playlist | null, tracks?: Track[]): ExtractorInfo;
217
+ /**
218
+ * Write debug message
219
+ * @param message The debug message
220
+ */
221
+ debug(message: string): boolean;
222
+ }
223
+ type NextFunction = (error?: Error | null, stream?: Readable) => void;
224
+ interface ExtractorInfo {
225
+ playlist: Playlist | null;
226
+ tracks: Track[];
227
+ }
228
+ interface ExtractorSearchContext {
229
+ type?: SearchQueryType | null;
230
+ requestedBy?: User | null;
231
+ requestOptions?: RequestOptions;
230
232
  }
231
233
 
232
- type TrackResolvable = Track | string | number;
233
- declare class Track {
234
- player: Player;
235
- title: string;
236
- description: string;
237
- author: string;
238
- url: string;
239
- thumbnail: string;
240
- duration: string;
241
- views: number;
242
- requestedBy: User | null;
243
- playlist?: Playlist;
244
- queryType: SearchQueryType | null | undefined;
245
- raw: RawTrackData;
246
- extractor: BaseExtractor | null;
247
- readonly id: string;
248
- /**
249
- * Track constructor
250
- * @param {Player} player The player that instantiated this Track
251
- * @param {RawTrackData} data Track data
252
- */
253
- constructor(player: Player, data: RawTrackData);
254
- private _patch;
255
- /**
256
- * The queue in which this track is located
257
- * @type {Queue}
258
- */
259
- get queue(): GuildQueue;
260
- /**
261
- * The track duration in millisecond
262
- * @type {number}
263
- */
264
- get durationMS(): number;
265
- /**
266
- * Returns source of this track
267
- * @type {TrackSource}
268
- */
269
- get source(): TrackSource;
270
- /**
271
- * String representation of this track
272
- * @returns {string}
273
- */
274
- toString(): string;
275
- /**
276
- * Raw JSON representation of this track
277
- * @returns {TrackJSON}
278
- */
279
- toJSON(hidePlaylist?: boolean): TrackJSON;
234
+ type TrackResolvable = Track | string | number;
235
+ declare class Track {
236
+ player: Player;
237
+ title: string;
238
+ description: string;
239
+ author: string;
240
+ url: string;
241
+ thumbnail: string;
242
+ duration: string;
243
+ views: number;
244
+ requestedBy: User | null;
245
+ playlist?: Playlist;
246
+ queryType: SearchQueryType | null | undefined;
247
+ raw: RawTrackData;
248
+ extractor: BaseExtractor | null;
249
+ readonly id: string;
250
+ /**
251
+ * Track constructor
252
+ * @param {Player} player The player that instantiated this Track
253
+ * @param {RawTrackData} data Track data
254
+ */
255
+ constructor(player: Player, data: RawTrackData);
256
+ private _patch;
257
+ /**
258
+ * The queue in which this track is located
259
+ * @type {Queue}
260
+ */
261
+ get queue(): GuildQueue;
262
+ /**
263
+ * The track duration in millisecond
264
+ * @type {number}
265
+ */
266
+ get durationMS(): number;
267
+ /**
268
+ * Returns source of this track
269
+ * @type {TrackSource}
270
+ */
271
+ get source(): TrackSource;
272
+ /**
273
+ * String representation of this track
274
+ * @returns {string}
275
+ */
276
+ toString(): string;
277
+ /**
278
+ * Raw JSON representation of this track
279
+ * @returns {TrackJSON}
280
+ */
281
+ toJSON(hidePlaylist?: boolean): TrackJSON;
280
282
  }
281
283
 
282
- interface CreateStreamOps {
283
- type?: StreamType;
284
- data?: any;
285
- disableVolume?: boolean;
286
- disableEqualizer?: boolean;
287
- disableBiquad?: boolean;
288
- eq?: EqualizerBand[];
289
- biquadFilter?: BiquadFilters;
290
- disableFilters?: boolean;
291
- defaultFilters?: PCMFilters[];
292
- volume?: number;
293
- disableResampler?: boolean;
294
- sampleRate?: number;
295
- }
296
- interface VoiceEvents {
297
- error: (error: AudioPlayerError) => any;
298
- debug: (message: string) => any;
299
- start: (resource: AudioResource<Track>) => any;
300
- finish: (resource: AudioResource<Track>) => any;
301
- dsp: (filters: PCMFilters[]) => any;
302
- eqBands: (filters: EqualizerBand[]) => any;
303
- sampleRate: (filters: number) => any;
304
- biquad: (filters: BiquadFilters) => any;
305
- volume: (volume: number) => any;
306
- }
307
- declare class StreamDispatcher extends EventEmitter<VoiceEvents> {
308
- queue: GuildQueue;
309
- readonly connectionTimeout: number;
310
- readonly voiceConnection: VoiceConnection;
311
- readonly audioPlayer: AudioPlayer;
312
- receiver: VoiceReceiverNode;
313
- channel: VoiceChannel | StageChannel;
314
- audioResource?: AudioResource<Track> | null;
315
- private readyLock;
316
- dsp: FiltersChain;
317
- /**
318
- * Creates new connection object
319
- * @param {VoiceConnection} connection The connection
320
- * @param {VoiceChannel|StageChannel} channel The connected channel
321
- * @private
322
- */
323
- constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel, queue: GuildQueue, connectionTimeout?: number, audioPlayer?: AudioPlayer);
324
- /**
325
- * Check if the player has been paused manually
326
- */
327
- get paused(): boolean;
328
- set paused(val: boolean);
329
- /**
330
- * Whether or not the player is currently paused automatically or manually.
331
- */
332
- isPaused(): boolean;
333
- /**
334
- * Whether or not the player is currently buffering
335
- */
336
- isBuffering(): boolean;
337
- /**
338
- * Whether or not the player is currently playing
339
- */
340
- isPlaying(): boolean;
341
- /**
342
- * Whether or not the player is currently idle
343
- */
344
- isIdle(): boolean;
345
- /**
346
- * Whether or not the voice connection has been destroyed
347
- */
348
- isDestroyed(): boolean;
349
- /**
350
- * Whether or not the voice connection has been destroyed
351
- */
352
- isDisconnected(): boolean;
353
- /**
354
- * Whether or not the voice connection is ready to play
355
- */
356
- isReady(): boolean;
357
- /**
358
- * Whether or not the voice connection is signalling
359
- */
360
- isSignalling(): boolean;
361
- /**
362
- * Whether or not the voice connection is connecting
363
- */
364
- isConnecting(): boolean;
365
- /**
366
- * Creates stream
367
- * @param {Readable} src The stream source
368
- * @param {object} [ops] Options
369
- * @returns {AudioResource}
370
- */
371
- createStream(src: Readable, ops?: CreateStreamOps): Promise<AudioResource<Track>>;
372
- get resampler(): _discord_player_equalizer.PCMResampler | null;
373
- get filters(): _discord_player_equalizer.AudioFilter | null;
374
- get biquad(): _discord_player_equalizer.BiquadStream | null;
375
- get equalizer(): _discord_player_equalizer.EqualizerStream | null;
376
- /**
377
- * The player status
378
- * @type {AudioPlayerStatus}
379
- */
380
- get status(): AudioPlayerStatus;
381
- /**
382
- * Disconnects from voice
383
- * @returns {void}
384
- */
385
- disconnect(): void;
386
- /**
387
- * Stops the player
388
- * @returns {void}
389
- */
390
- end(): void;
391
- /**
392
- * Pauses the stream playback
393
- * @param {boolean} [interpolateSilence=false] If true, the player will play 5 packets of silence after pausing to prevent audio glitches.
394
- * @returns {boolean}
395
- */
396
- pause(interpolateSilence?: boolean): boolean;
397
- /**
398
- * Resumes the stream playback
399
- * @returns {boolean}
400
- */
401
- resume(): boolean;
402
- /**
403
- * Play stream
404
- * @param {AudioResource<Track>} [resource=this.audioResource] The audio resource to play
405
- * @returns {Promise<StreamDispatcher>}
406
- */
407
- playStream(resource?: AudioResource<Track>): Promise<this | undefined>;
408
- /**
409
- * Sets playback volume
410
- * @param {number} value The volume amount
411
- * @returns {boolean}
412
- */
413
- setVolume(value: number): boolean;
414
- /**
415
- * The current volume
416
- * @type {number}
417
- */
418
- get volume(): number;
419
- /**
420
- * The playback time
421
- * @type {number}
422
- */
423
- get streamTime(): number;
284
+ interface CreateStreamOps {
285
+ type?: StreamType;
286
+ data?: any;
287
+ disableVolume?: boolean;
288
+ disableEqualizer?: boolean;
289
+ disableBiquad?: boolean;
290
+ eq?: EqualizerBand[];
291
+ biquadFilter?: BiquadFilters;
292
+ disableFilters?: boolean;
293
+ defaultFilters?: PCMFilters[];
294
+ volume?: number;
295
+ disableResampler?: boolean;
296
+ sampleRate?: number;
297
+ }
298
+ interface VoiceEvents {
299
+ error: (error: AudioPlayerError) => any;
300
+ debug: (message: string) => any;
301
+ start: (resource: AudioResource<Track>) => any;
302
+ finish: (resource: AudioResource<Track>) => any;
303
+ dsp: (filters: PCMFilters[]) => any;
304
+ eqBands: (filters: EqualizerBand[]) => any;
305
+ sampleRate: (filters: number) => any;
306
+ biquad: (filters: BiquadFilters) => any;
307
+ volume: (volume: number) => any;
308
+ }
309
+ declare class StreamDispatcher extends EventEmitter<VoiceEvents> {
310
+ queue: GuildQueue;
311
+ readonly connectionTimeout: number;
312
+ readonly voiceConnection: VoiceConnection;
313
+ readonly audioPlayer: AudioPlayer;
314
+ receiver: VoiceReceiverNode;
315
+ channel: VoiceChannel | StageChannel;
316
+ audioResource?: AudioResource<Track> | null;
317
+ private readyLock;
318
+ dsp: FiltersChain;
319
+ /**
320
+ * Creates new connection object
321
+ * @param {VoiceConnection} connection The connection
322
+ * @param {VoiceChannel|StageChannel} channel The connected channel
323
+ * @private
324
+ */
325
+ constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel, queue: GuildQueue, connectionTimeout?: number, audioPlayer?: AudioPlayer);
326
+ /**
327
+ * Check if the player has been paused manually
328
+ */
329
+ get paused(): boolean;
330
+ set paused(val: boolean);
331
+ /**
332
+ * Whether or not the player is currently paused automatically or manually.
333
+ */
334
+ isPaused(): boolean;
335
+ /**
336
+ * Whether or not the player is currently buffering
337
+ */
338
+ isBuffering(): boolean;
339
+ /**
340
+ * Whether or not the player is currently playing
341
+ */
342
+ isPlaying(): boolean;
343
+ /**
344
+ * Whether or not the player is currently idle
345
+ */
346
+ isIdle(): boolean;
347
+ /**
348
+ * Whether or not the voice connection has been destroyed
349
+ */
350
+ isDestroyed(): boolean;
351
+ /**
352
+ * Whether or not the voice connection has been destroyed
353
+ */
354
+ isDisconnected(): boolean;
355
+ /**
356
+ * Whether or not the voice connection is ready to play
357
+ */
358
+ isReady(): boolean;
359
+ /**
360
+ * Whether or not the voice connection is signalling
361
+ */
362
+ isSignalling(): boolean;
363
+ /**
364
+ * Whether or not the voice connection is connecting
365
+ */
366
+ isConnecting(): boolean;
367
+ /**
368
+ * Creates stream
369
+ * @param {Readable} src The stream source
370
+ * @param {object} [ops] Options
371
+ * @returns {AudioResource}
372
+ */
373
+ createStream(src: Readable, ops?: CreateStreamOps): Promise<AudioResource<Track>>;
374
+ get resampler(): _discord_player_equalizer.PCMResampler | null;
375
+ get filters(): _discord_player_equalizer.AudioFilter | null;
376
+ get biquad(): _discord_player_equalizer.BiquadStream | null;
377
+ get equalizer(): _discord_player_equalizer.EqualizerStream | null;
378
+ /**
379
+ * The player status
380
+ * @type {AudioPlayerStatus}
381
+ */
382
+ get status(): AudioPlayerStatus;
383
+ /**
384
+ * Disconnects from voice
385
+ * @returns {void}
386
+ */
387
+ disconnect(): void;
388
+ /**
389
+ * Stops the player
390
+ * @returns {void}
391
+ */
392
+ end(): void;
393
+ /**
394
+ * Pauses the stream playback
395
+ * @param {boolean} [interpolateSilence=false] If true, the player will play 5 packets of silence after pausing to prevent audio glitches.
396
+ * @returns {boolean}
397
+ */
398
+ pause(interpolateSilence?: boolean): boolean;
399
+ /**
400
+ * Resumes the stream playback
401
+ * @returns {boolean}
402
+ */
403
+ resume(): boolean;
404
+ /**
405
+ * Play stream
406
+ * @param {AudioResource<Track>} [resource=this.audioResource] The audio resource to play
407
+ * @returns {Promise<StreamDispatcher>}
408
+ */
409
+ playStream(resource?: AudioResource<Track>): Promise<this | undefined>;
410
+ /**
411
+ * Sets playback volume
412
+ * @param {number} value The volume amount
413
+ * @returns {boolean}
414
+ */
415
+ setVolume(value: number): boolean;
416
+ /**
417
+ * The current volume
418
+ * @type {number}
419
+ */
420
+ get volume(): number;
421
+ /**
422
+ * The playback time
423
+ * @type {number}
424
+ */
425
+ get streamTime(): number;
424
426
  }
425
427
 
426
- interface VoiceReceiverOptions {
427
- mode?: 'opus' | 'pcm';
428
- end?: EndBehaviorType;
429
- silenceDuration?: number;
430
- crc?: boolean;
431
- }
432
- type RawTrackInit = Partial<Omit<RawTrackData, 'author' | 'playlist' | 'source' | 'engine' | 'raw' | 'queryType' | 'description' | 'views'>>;
433
- declare class VoiceReceiverNode {
434
- dispatcher: StreamDispatcher;
435
- constructor(dispatcher: StreamDispatcher);
436
- createRawTrack(stream: Readable, data?: RawTrackInit): Track;
437
- /**
438
- * Merge multiple streams together
439
- * @param streams The array of streams to merge
440
- */
441
- mergeRecordings(streams: Readable[]): void;
442
- /**
443
- * Record a user in voice channel
444
- * @param user The user to record
445
- * @param options Recording options
446
- */
447
- recordUser(user: UserResolvable, options?: VoiceReceiverOptions): Readable;
428
+ interface VoiceReceiverOptions {
429
+ mode?: 'opus' | 'pcm';
430
+ end?: EndBehaviorType;
431
+ silenceDuration?: number;
432
+ crc?: boolean;
433
+ }
434
+ type RawTrackInit = Partial<Omit<RawTrackData, 'author' | 'playlist' | 'source' | 'engine' | 'raw' | 'queryType' | 'description' | 'views'>>;
435
+ declare class VoiceReceiverNode {
436
+ dispatcher: StreamDispatcher;
437
+ constructor(dispatcher: StreamDispatcher);
438
+ createRawTrack(stream: Readable, data?: RawTrackInit): Track;
439
+ /**
440
+ * Merge multiple streams together
441
+ * @param streams The array of streams to merge
442
+ */
443
+ mergeRecordings(streams: Readable[]): void;
444
+ /**
445
+ * Record a user in voice channel
446
+ * @param user The user to record
447
+ * @param options Recording options
448
+ */
449
+ recordUser(user: UserResolvable, options?: VoiceReceiverOptions): Readable;
448
450
  }
449
451
 
450
- declare class GuildQueueHistory<Meta = unknown> {
451
- queue: GuildQueue<Meta>;
452
- tracks: Queue<Track>;
453
- constructor(queue: GuildQueue<Meta>);
454
- /**
455
- * Current track in the queue
456
- */
457
- get currentTrack(): Track | null;
458
- /**
459
- * Next track in the queue
460
- */
461
- get nextTrack(): Track | null;
462
- /**
463
- * Previous track in the queue
464
- */
465
- get previousTrack(): Track | null;
466
- /**
467
- * If history is disabled
468
- */
469
- get disabled(): boolean;
470
- /**
471
- * Gets the size of the queue
472
- */
473
- get size(): number;
474
- getSize(): number;
475
- /**
476
- * If history is empty
477
- */
478
- isEmpty(): boolean;
479
- /**
480
- * Add track to track history
481
- * @param track The track to add
482
- */
483
- push(track: Track | Track[]): boolean;
484
- /**
485
- * Clear history
486
- */
487
- clear(): void;
488
- /**
489
- * Play the next track in the queue
490
- */
491
- next(): Promise<void>;
492
- /**
493
- * Play the previous track in the queue
494
- */
495
- previous(preserveCurrent?: boolean): Promise<void>;
496
- /**
497
- * Alias to [GuildQueueHistory].previous()
498
- */
499
- back(): Promise<void>;
452
+ declare class GuildQueueHistory<Meta = unknown> {
453
+ queue: GuildQueue<Meta>;
454
+ tracks: Queue<Track>;
455
+ constructor(queue: GuildQueue<Meta>);
456
+ /**
457
+ * Current track in the queue
458
+ */
459
+ get currentTrack(): Track | null;
460
+ /**
461
+ * Next track in the queue
462
+ */
463
+ get nextTrack(): Track | null;
464
+ /**
465
+ * Previous track in the queue
466
+ */
467
+ get previousTrack(): Track | null;
468
+ /**
469
+ * If history is disabled
470
+ */
471
+ get disabled(): boolean;
472
+ /**
473
+ * Gets the size of the queue
474
+ */
475
+ get size(): number;
476
+ getSize(): number;
477
+ /**
478
+ * If history is empty
479
+ */
480
+ isEmpty(): boolean;
481
+ /**
482
+ * Add track to track history
483
+ * @param track The track to add
484
+ */
485
+ push(track: Track | Track[]): boolean;
486
+ /**
487
+ * Clear history
488
+ */
489
+ clear(): void;
490
+ /**
491
+ * Play the next track in the queue
492
+ */
493
+ next(): Promise<void>;
494
+ /**
495
+ * Play the previous track in the queue
496
+ */
497
+ previous(preserveCurrent?: boolean): Promise<void>;
498
+ /**
499
+ * Alias to [GuildQueueHistory].previous()
500
+ */
501
+ back(): Promise<void>;
500
502
  }
501
503
 
502
- interface AsyncQueueAcquisitionOptions {
503
- /**
504
- * AbortSignal to cancel this entry
505
- */
506
- signal?: AbortSignal;
507
- }
508
- declare class AsyncQueue {
509
- /**
510
- * The queued entries
511
- */
512
- entries: Array<AsyncQueueEntry>;
513
- /**
514
- * Clear entries queue
515
- * @param consume Whether or not to consume all entries before clearing
516
- */
517
- clear(consume?: boolean): void;
518
- /**
519
- * The total number of entries in this queue. Returns `0` if no entries are available.
520
- */
521
- get size(): number;
522
- /**
523
- * Acquire an entry.
524
- *
525
- * ```typescript
526
- * // lock the queue
527
- * const entry = asyncQueue.acquire();
528
- * // wait until previous task is completed
529
- * await entry.getTask();
530
- * // do something expensive
531
- * await performSomethingExpensive();
532
- * // make sure to release the lock once done
533
- * asyncQueue.release();
534
- * ```
535
- */
536
- acquire(options?: AsyncQueueAcquisitionOptions): AsyncQueueEntry;
537
- /**
538
- * Release the current acquisition and move to next entry.
539
- */
540
- release(): void;
541
- /**
542
- * Cancel all entries
543
- */
544
- cancelAll(): void;
545
- /**
546
- * Remove the given entry from the queue
547
- * @param entry The entry to remove
548
- */
549
- removeEntry(entry: AsyncQueueEntry): boolean;
550
- }
551
- declare class AsyncQueueEntry {
552
- queue: AsyncQueue;
553
- options?: AsyncQueueAcquisitionOptions | undefined;
554
- readonly id: string;
555
- private readonly promise;
556
- signal: AbortSignal | null;
557
- onAbort: (() => void) | null;
558
- private resolve;
559
- private reject;
560
- constructor(queue: AsyncQueue, options?: AsyncQueueAcquisitionOptions | undefined);
561
- setAbortSignal(signal: AbortSignal): void;
562
- consume(): void;
563
- release(): void;
564
- cancel(): void;
565
- cleanup(): void;
566
- getTask(): Promise<void>;
504
+ interface AsyncQueueAcquisitionOptions {
505
+ /**
506
+ * AbortSignal to cancel this entry
507
+ */
508
+ signal?: AbortSignal;
509
+ }
510
+ declare class AsyncQueue {
511
+ /**
512
+ * The queued entries
513
+ */
514
+ entries: Array<AsyncQueueEntry>;
515
+ /**
516
+ * Clear entries queue
517
+ * @param consume Whether or not to consume all entries before clearing
518
+ */
519
+ clear(consume?: boolean): void;
520
+ /**
521
+ * The total number of entries in this queue. Returns `0` if no entries are available.
522
+ */
523
+ get size(): number;
524
+ /**
525
+ * Acquire an entry.
526
+ *
527
+ * ```typescript
528
+ * // lock the queue
529
+ * const entry = asyncQueue.acquire();
530
+ * // wait until previous task is completed
531
+ * await entry.getTask();
532
+ * // do something expensive
533
+ * await performSomethingExpensive();
534
+ * // make sure to release the lock once done
535
+ * asyncQueue.release();
536
+ * ```
537
+ */
538
+ acquire(options?: AsyncQueueAcquisitionOptions): AsyncQueueEntry;
539
+ /**
540
+ * Release the current acquisition and move to next entry.
541
+ */
542
+ release(): void;
543
+ /**
544
+ * Cancel all entries
545
+ */
546
+ cancelAll(): void;
547
+ /**
548
+ * Remove the given entry from the queue
549
+ * @param entry The entry to remove
550
+ */
551
+ removeEntry(entry: AsyncQueueEntry): boolean;
552
+ }
553
+ declare class AsyncQueueEntry {
554
+ queue: AsyncQueue;
555
+ options?: AsyncQueueAcquisitionOptions | undefined;
556
+ readonly id: string;
557
+ private readonly promise;
558
+ signal: AbortSignal | null;
559
+ onAbort: (() => void) | null;
560
+ private resolve;
561
+ private reject;
562
+ constructor(queue: AsyncQueue, options?: AsyncQueueAcquisitionOptions | undefined);
563
+ setAbortSignal(signal: AbortSignal): void;
564
+ consume(): void;
565
+ release(): void;
566
+ cancel(): void;
567
+ cleanup(): void;
568
+ getTask(): Promise<void>;
567
569
  }
568
570
 
569
- declare const FFMPEG_SRATE_REGEX: RegExp;
570
- interface ResourcePlayOptions {
571
- queue?: boolean;
572
- seek?: number;
573
- transitionMode?: boolean;
574
- }
575
- interface PlayerTimestamp {
576
- current: {
577
- label: string;
578
- value: number;
579
- };
580
- total: {
581
- label: string;
582
- value: number;
583
- };
584
- progress: number;
585
- }
586
- declare class GuildQueuePlayerNode<Meta = unknown> {
587
- #private;
588
- queue: GuildQueue<Meta>;
589
- tasksQueue: AsyncQueue;
590
- constructor(queue: GuildQueue<Meta>);
591
- /**
592
- * If the player is currently in idle mode
593
- */
594
- isIdle(): boolean;
595
- /**
596
- * If the player is currently buffering the track
597
- */
598
- isBuffering(): boolean;
599
- /**
600
- * If the player is currently playing a track
601
- */
602
- isPlaying(): boolean;
603
- /**
604
- * If the player is currently paused
605
- */
606
- isPaused(): boolean;
607
- /**
608
- * Reset progress history
609
- */
610
- resetProgress(): void;
611
- /**
612
- * Set player progress
613
- */
614
- setProgress(progress: number): void;
615
- /**
616
- * The stream time for current session
617
- */
618
- get streamTime(): number;
619
- /**
620
- * Current playback duration with history included
621
- */
622
- get playbackTime(): number;
623
- /**
624
- * Get duration multiplier
625
- */
626
- getDurationMultiplier(): number;
627
- /**
628
- * Estimated progress of the player
629
- */
630
- get estimatedPlaybackTime(): number;
631
- /**
632
- * Estimated total duration of the player
633
- */
634
- get estimatedDuration(): number;
635
- /**
636
- * Get stream progress
637
- * @param ignoreFilters Ignore filters
638
- */
639
- getTimestamp(ignoreFilters?: boolean): PlayerTimestamp | null;
640
- /**
641
- * Create progress bar for current progress
642
- * @param options Progress bar options
643
- */
644
- createProgressBar(options?: PlayerProgressbarOptions): string | null;
645
- /**
646
- * Seek the player
647
- * @param duration The duration to seek to
648
- */
649
- seek(duration: number): Promise<boolean>;
650
- /**
651
- * Current volume
652
- */
653
- get volume(): number;
654
- /**
655
- * Set volume
656
- * @param vol Volume amount to set
657
- */
658
- setVolume(vol: number): boolean;
659
- /**
660
- * Set bit rate
661
- * @param rate The bit rate to set
662
- */
663
- setBitrate(rate: number | 'auto'): void;
664
- /**
665
- * Set paused state
666
- * @param state The state
667
- */
668
- setPaused(state: boolean): boolean;
669
- /**
670
- * Pause the playback
671
- */
672
- pause(): boolean;
673
- /**
674
- * Resume the playback
675
- */
676
- resume(): boolean;
677
- /**
678
- * Skip current track
679
- */
680
- skip(): boolean;
681
- /**
682
- * Remove the given track from queue
683
- * @param track The track to remove
684
- */
685
- remove(track: TrackResolvable): Track | null;
686
- /**
687
- * Jump to specific track on the queue
688
- * @param track The track to jump to without removing other tracks
689
- */
690
- jump(track: TrackResolvable): boolean;
691
- /**
692
- * Get track position
693
- * @param track The track
694
- */
695
- getTrackPosition(track: TrackResolvable): number;
696
- /**
697
- * Skip to the given track, removing others on the way
698
- * @param track The track to skip to
699
- */
700
- skipTo(track: TrackResolvable): boolean;
701
- /**
702
- * Insert a track on the given position in queue
703
- * @param track The track to insert
704
- * @param index The position to insert to, defaults to 0.
705
- */
706
- insert(track: Track, index?: number): void;
707
- /**
708
- * Moves a track in the queue
709
- * @param from The track to move
710
- * @param to The position to move to
711
- */
712
- move(from: TrackResolvable, to: number): void;
713
- /**
714
- * Copy a track in the queue
715
- * @param from The track to clone
716
- * @param to The position to clone at
717
- */
718
- copy(from: TrackResolvable, to: number): void;
719
- /**
720
- * Swap two tracks in the queue
721
- * @param first The first track to swap
722
- * @param second The second track to swap
723
- */
724
- swap(first: TrackResolvable, second: TrackResolvable): void;
725
- /**
726
- * Stop the playback
727
- * @param force Whether or not to forcefully stop the playback
728
- */
729
- stop(force?: boolean): boolean;
730
- /**
731
- * Play raw audio resource
732
- * @param resource The audio resource to play
733
- */
734
- playRaw(resource: AudioResource): Promise<void>;
735
- /**
736
- * Play the given track
737
- * @param res The track to play
738
- * @param options Options for playing the track
739
- */
740
- play(res?: Track | null, options?: ResourcePlayOptions): Promise<void>;
571
+ declare const FFMPEG_SRATE_REGEX: RegExp;
572
+ interface ResourcePlayOptions {
573
+ queue?: boolean;
574
+ seek?: number;
575
+ transitionMode?: boolean;
576
+ }
577
+ interface PlayerTimestamp {
578
+ current: {
579
+ label: string;
580
+ value: number;
581
+ };
582
+ total: {
583
+ label: string;
584
+ value: number;
585
+ };
586
+ progress: number;
587
+ }
588
+ declare class GuildQueuePlayerNode<Meta = unknown> {
589
+ #private;
590
+ queue: GuildQueue<Meta>;
591
+ tasksQueue: AsyncQueue;
592
+ constructor(queue: GuildQueue<Meta>);
593
+ /**
594
+ * If the player is currently in idle mode
595
+ */
596
+ isIdle(): boolean;
597
+ /**
598
+ * If the player is currently buffering the track
599
+ */
600
+ isBuffering(): boolean;
601
+ /**
602
+ * If the player is currently playing a track
603
+ */
604
+ isPlaying(): boolean;
605
+ /**
606
+ * If the player is currently paused
607
+ */
608
+ isPaused(): boolean;
609
+ /**
610
+ * Reset progress history
611
+ */
612
+ resetProgress(): void;
613
+ /**
614
+ * Set player progress
615
+ */
616
+ setProgress(progress: number): void;
617
+ /**
618
+ * The stream time for current session
619
+ */
620
+ get streamTime(): number;
621
+ /**
622
+ * Current playback duration with history included
623
+ */
624
+ get playbackTime(): number;
625
+ /**
626
+ * Get duration multiplier
627
+ */
628
+ getDurationMultiplier(): number;
629
+ /**
630
+ * Estimated progress of the player
631
+ */
632
+ get estimatedPlaybackTime(): number;
633
+ /**
634
+ * Estimated total duration of the player
635
+ */
636
+ get estimatedDuration(): number;
637
+ /**
638
+ * Get stream progress
639
+ * @param ignoreFilters Ignore filters
640
+ */
641
+ getTimestamp(ignoreFilters?: boolean): PlayerTimestamp | null;
642
+ /**
643
+ * Create progress bar for current progress
644
+ * @param options Progress bar options
645
+ */
646
+ createProgressBar(options?: PlayerProgressbarOptions): string | null;
647
+ /**
648
+ * Seek the player
649
+ * @param duration The duration to seek to
650
+ */
651
+ seek(duration: number): Promise<boolean>;
652
+ /**
653
+ * Current volume
654
+ */
655
+ get volume(): number;
656
+ /**
657
+ * Set volume
658
+ * @param vol Volume amount to set
659
+ */
660
+ setVolume(vol: number): boolean;
661
+ /**
662
+ * Set bit rate
663
+ * @param rate The bit rate to set
664
+ */
665
+ setBitrate(rate: number | 'auto'): void;
666
+ /**
667
+ * Set paused state
668
+ * @param state The state
669
+ */
670
+ setPaused(state: boolean): boolean;
671
+ /**
672
+ * Pause the playback
673
+ */
674
+ pause(): boolean;
675
+ /**
676
+ * Resume the playback
677
+ */
678
+ resume(): boolean;
679
+ /**
680
+ * Skip current track
681
+ */
682
+ skip(): boolean;
683
+ /**
684
+ * Remove the given track from queue
685
+ * @param track The track to remove
686
+ */
687
+ remove(track: TrackResolvable): Track | null;
688
+ /**
689
+ * Jump to specific track on the queue
690
+ * @param track The track to jump to without removing other tracks
691
+ */
692
+ jump(track: TrackResolvable): boolean;
693
+ /**
694
+ * Get track position
695
+ * @param track The track
696
+ */
697
+ getTrackPosition(track: TrackResolvable): number;
698
+ /**
699
+ * Skip to the given track, removing others on the way
700
+ * @param track The track to skip to
701
+ */
702
+ skipTo(track: TrackResolvable): boolean;
703
+ /**
704
+ * Insert a track on the given position in queue
705
+ * @param track The track to insert
706
+ * @param index The position to insert to, defaults to 0.
707
+ */
708
+ insert(track: Track, index?: number): void;
709
+ /**
710
+ * Moves a track in the queue
711
+ * @param from The track to move
712
+ * @param to The position to move to
713
+ */
714
+ move(from: TrackResolvable, to: number): void;
715
+ /**
716
+ * Copy a track in the queue
717
+ * @param from The track to clone
718
+ * @param to The position to clone at
719
+ */
720
+ copy(from: TrackResolvable, to: number): void;
721
+ /**
722
+ * Swap two tracks in the queue
723
+ * @param first The first track to swap
724
+ * @param second The second track to swap
725
+ */
726
+ swap(first: TrackResolvable, second: TrackResolvable): void;
727
+ /**
728
+ * Stop the playback
729
+ * @param force Whether or not to forcefully stop the playback
730
+ */
731
+ stop(force?: boolean): boolean;
732
+ /**
733
+ * Play raw audio resource
734
+ * @param resource The audio resource to play
735
+ */
736
+ playRaw(resource: AudioResource): Promise<void>;
737
+ /**
738
+ * Play the given track
739
+ * @param res The track to play
740
+ * @param options Options for playing the track
741
+ */
742
+ play(res?: Track | null, options?: ResourcePlayOptions): Promise<void>;
741
743
  }
742
744
 
743
- interface FFmpegStreamOptions {
744
- fmt?: string;
745
- encoderArgs?: string[];
746
- seek?: number;
747
- skip?: boolean;
748
- cookies?: string;
749
- }
750
- declare function FFMPEG_ARGS_STRING(stream: string, fmt?: string, cookies?: string): string[];
751
- declare function FFMPEG_ARGS_PIPED(fmt?: string): string[];
752
- /**
753
- * Creates FFmpeg stream
754
- * @param stream The source stream
755
- * @param options FFmpeg stream options
756
- */
745
+ interface FFmpegStreamOptions {
746
+ fmt?: string;
747
+ encoderArgs?: string[];
748
+ seek?: number;
749
+ skip?: boolean;
750
+ cookies?: string;
751
+ }
752
+ declare function FFMPEG_ARGS_STRING(stream: string, fmt?: string, cookies?: string): string[];
753
+ declare function FFMPEG_ARGS_PIPED(fmt?: string): string[];
754
+ /**
755
+ * Creates FFmpeg stream
756
+ * @param stream The source stream
757
+ * @param options FFmpeg stream options
758
+ */
757
759
  declare function createFFmpegStream(stream: Readable | Duplex | string, options?: FFmpegStreamOptions): Readable;
758
760
 
759
- type Filters = keyof typeof AudioFilters.filters;
760
- declare const EqualizerConfigurationPreset: {
761
- readonly Flat: EqualizerBand[];
762
- readonly Classical: EqualizerBand[];
763
- readonly Club: EqualizerBand[];
764
- readonly Dance: EqualizerBand[];
765
- readonly FullBass: EqualizerBand[];
766
- readonly FullBassTreble: EqualizerBand[];
767
- readonly FullTreble: EqualizerBand[];
768
- readonly Headphones: EqualizerBand[];
769
- readonly LargeHall: EqualizerBand[];
770
- readonly Live: EqualizerBand[];
771
- readonly Party: EqualizerBand[];
772
- readonly Pop: EqualizerBand[];
773
- readonly Reggae: EqualizerBand[];
774
- readonly Rock: EqualizerBand[];
775
- readonly Ska: EqualizerBand[];
776
- readonly Soft: EqualizerBand[];
777
- readonly SoftRock: EqualizerBand[];
778
- readonly Techno: EqualizerBand[];
779
- };
780
- declare class FFmpegFilterer<Meta = unknown> {
781
- #private;
782
- af: GuildQueueAudioFilters<Meta>;
783
- constructor(af: GuildQueueAudioFilters<Meta>);
784
- /**
785
- * Create ffmpeg stream
786
- * @param source The stream source
787
- * @param options The stream options
788
- */
789
- createStream(source: string | Readable, options: FFmpegStreamOptions): Readable;
790
- /**
791
- * Set ffmpeg filters
792
- * @param filters The filters
793
- */
794
- setFilters(filters: Filters[] | Record<Filters, boolean> | boolean): Promise<boolean>;
795
- /**
796
- * Currently active ffmpeg filters
797
- */
798
- get filters(): Filters[];
799
- set filters(filters: Filters[]);
800
- /**
801
- * Toggle given ffmpeg filter(s)
802
- * @param filters The filter(s)
803
- */
804
- toggle(filters: Filters[] | Filters): Promise<boolean>;
805
- /**
806
- * Set default filters
807
- * @param ff Filters list
808
- */
809
- setDefaults(ff: Filters[]): void;
810
- /**
811
- * Get list of enabled filters
812
- */
813
- getFiltersEnabled(): (keyof QueueFilters)[];
814
- /**
815
- * Get list of disabled filters
816
- */
817
- getFiltersDisabled(): (keyof QueueFilters)[];
818
- /**
819
- * Check if the given filter is enabled
820
- * @param filter The filter
821
- */
822
- isEnabled<T extends Filters>(filter: T): boolean;
823
- /**
824
- * Check if the given filter is disabled
825
- * @param filter The filter
826
- */
827
- isDisabled<T extends Filters>(filter: T): boolean;
828
- /**
829
- * Check if the given filter is a valid filter
830
- * @param filter The filter to test
831
- */
832
- isValidFilter(filter: string): filter is FiltersName;
833
- /**
834
- * Convert current filters to array
835
- */
836
- toArray(): string[];
837
- /**
838
- * Convert current filters to JSON object
839
- */
840
- toJSON(): Record<keyof QueueFilters, string>;
841
- /**
842
- * String representation of current filters
843
- */
844
- toString(): string;
845
- }
846
- interface GuildQueueAFiltersCache {
847
- equalizer: EqualizerBand[];
848
- biquad: BiquadFilters | null;
849
- filters: PCMFilters[];
850
- volume: number;
851
- sampleRate: number;
852
- }
853
- declare class GuildQueueAudioFilters<Meta = unknown> {
854
- queue: GuildQueue<Meta>;
855
- graph: AFilterGraph<Meta>;
856
- ffmpeg: FFmpegFilterer<Meta>;
857
- equalizerPresets: {
858
- readonly Flat: EqualizerBand[];
859
- readonly Classical: EqualizerBand[];
860
- readonly Club: EqualizerBand[];
861
- readonly Dance: EqualizerBand[];
862
- readonly FullBass: EqualizerBand[];
863
- readonly FullBassTreble: EqualizerBand[];
864
- readonly FullTreble: EqualizerBand[];
865
- readonly Headphones: EqualizerBand[];
866
- readonly LargeHall: EqualizerBand[];
867
- readonly Live: EqualizerBand[];
868
- readonly Party: EqualizerBand[];
869
- readonly Pop: EqualizerBand[];
870
- readonly Reggae: EqualizerBand[];
871
- readonly Rock: EqualizerBand[];
872
- readonly Ska: EqualizerBand[];
873
- readonly Soft: EqualizerBand[];
874
- readonly SoftRock: EqualizerBand[];
875
- readonly Techno: EqualizerBand[];
876
- };
877
- _lastFiltersCache: GuildQueueAFiltersCache;
878
- constructor(queue: GuildQueue<Meta>);
879
- /**
880
- * Volume transformer
881
- */
882
- get volume(): _discord_player_equalizer.VolumeTransformer | null;
883
- /**
884
- * 15 Band Equalizer
885
- */
886
- get equalizer(): _discord_player_equalizer.EqualizerStream | null;
887
- /**
888
- * Digital biquad filters
889
- */
890
- get biquad(): _discord_player_equalizer.BiquadStream | null;
891
- /**
892
- * DSP filters
893
- */
894
- get filters(): _discord_player_equalizer.AudioFilter | null;
895
- /**
896
- * Audio resampler
897
- */
898
- get resampler(): _discord_player_equalizer.PCMResampler | null;
899
- /**
900
- * Replay current track in transition mode
901
- * @param seek The duration to seek to
902
- */
903
- triggerReplay(seek?: number): Promise<boolean>;
904
- }
905
- declare class AFilterGraph<Meta = unknown> {
906
- af: GuildQueueAudioFilters<Meta>;
907
- constructor(af: GuildQueueAudioFilters<Meta>);
908
- get ffmpeg(): (keyof QueueFilters)[];
909
- get equalizer(): EqualizerBand[];
910
- get biquad(): null;
911
- get filters(): ("8D" | "Tremolo" | "Vibrato")[];
912
- get volume(): _discord_player_equalizer.VolumeTransformer | null;
913
- get resampler(): _discord_player_equalizer.PCMResampler | null;
914
- dump(): FilterGraph;
915
- }
916
- interface FilterGraph {
917
- ffmpeg: Filters[];
918
- equalizer: EqualizerBand[];
919
- biquad: Exclude<BiquadFilters, number> | null;
920
- filters: PCMFilters[];
921
- volume: number;
922
- sampleRate: number;
761
+ type Filters = keyof typeof AudioFilters.filters;
762
+ declare const EqualizerConfigurationPreset: {
763
+ readonly Flat: EqualizerBand[];
764
+ readonly Classical: EqualizerBand[];
765
+ readonly Club: EqualizerBand[];
766
+ readonly Dance: EqualizerBand[];
767
+ readonly FullBass: EqualizerBand[];
768
+ readonly FullBassTreble: EqualizerBand[];
769
+ readonly FullTreble: EqualizerBand[];
770
+ readonly Headphones: EqualizerBand[];
771
+ readonly LargeHall: EqualizerBand[];
772
+ readonly Live: EqualizerBand[];
773
+ readonly Party: EqualizerBand[];
774
+ readonly Pop: EqualizerBand[];
775
+ readonly Reggae: EqualizerBand[];
776
+ readonly Rock: EqualizerBand[];
777
+ readonly Ska: EqualizerBand[];
778
+ readonly Soft: EqualizerBand[];
779
+ readonly SoftRock: EqualizerBand[];
780
+ readonly Techno: EqualizerBand[];
781
+ };
782
+ declare class FFmpegFilterer<Meta = unknown> {
783
+ #private;
784
+ af: GuildQueueAudioFilters<Meta>;
785
+ constructor(af: GuildQueueAudioFilters<Meta>);
786
+ /**
787
+ * Create ffmpeg stream
788
+ * @param source The stream source
789
+ * @param options The stream options
790
+ */
791
+ createStream(source: string | Readable, options: FFmpegStreamOptions): Readable;
792
+ /**
793
+ * Set ffmpeg filters
794
+ * @param filters The filters
795
+ */
796
+ setFilters(filters: Filters[] | Record<Filters, boolean> | boolean): Promise<boolean>;
797
+ /**
798
+ * Currently active ffmpeg filters
799
+ */
800
+ get filters(): Filters[];
801
+ set filters(filters: Filters[]);
802
+ /**
803
+ * Toggle given ffmpeg filter(s)
804
+ * @param filters The filter(s)
805
+ */
806
+ toggle(filters: Filters[] | Filters): Promise<boolean>;
807
+ /**
808
+ * Set default filters
809
+ * @param ff Filters list
810
+ */
811
+ setDefaults(ff: Filters[]): void;
812
+ /**
813
+ * Get list of enabled filters
814
+ */
815
+ getFiltersEnabled(): (keyof QueueFilters)[];
816
+ /**
817
+ * Get list of disabled filters
818
+ */
819
+ getFiltersDisabled(): (keyof QueueFilters)[];
820
+ /**
821
+ * Check if the given filter is enabled
822
+ * @param filter The filter
823
+ */
824
+ isEnabled<T extends Filters>(filter: T): boolean;
825
+ /**
826
+ * Check if the given filter is disabled
827
+ * @param filter The filter
828
+ */
829
+ isDisabled<T extends Filters>(filter: T): boolean;
830
+ /**
831
+ * Check if the given filter is a valid filter
832
+ * @param filter The filter to test
833
+ */
834
+ isValidFilter(filter: string): filter is FiltersName;
835
+ /**
836
+ * Convert current filters to array
837
+ */
838
+ toArray(): string[];
839
+ /**
840
+ * Convert current filters to JSON object
841
+ */
842
+ toJSON(): Record<keyof QueueFilters, string>;
843
+ /**
844
+ * String representation of current filters
845
+ */
846
+ toString(): string;
847
+ }
848
+ interface GuildQueueAFiltersCache {
849
+ equalizer: EqualizerBand[];
850
+ biquad: BiquadFilters | null;
851
+ filters: PCMFilters[];
852
+ volume: number;
853
+ sampleRate: number;
854
+ }
855
+ declare class GuildQueueAudioFilters<Meta = unknown> {
856
+ queue: GuildQueue<Meta>;
857
+ graph: AFilterGraph<Meta>;
858
+ ffmpeg: FFmpegFilterer<Meta>;
859
+ equalizerPresets: {
860
+ readonly Flat: EqualizerBand[];
861
+ readonly Classical: EqualizerBand[];
862
+ readonly Club: EqualizerBand[];
863
+ readonly Dance: EqualizerBand[];
864
+ readonly FullBass: EqualizerBand[];
865
+ readonly FullBassTreble: EqualizerBand[];
866
+ readonly FullTreble: EqualizerBand[];
867
+ readonly Headphones: EqualizerBand[];
868
+ readonly LargeHall: EqualizerBand[];
869
+ readonly Live: EqualizerBand[];
870
+ readonly Party: EqualizerBand[];
871
+ readonly Pop: EqualizerBand[];
872
+ readonly Reggae: EqualizerBand[];
873
+ readonly Rock: EqualizerBand[];
874
+ readonly Ska: EqualizerBand[];
875
+ readonly Soft: EqualizerBand[];
876
+ readonly SoftRock: EqualizerBand[];
877
+ readonly Techno: EqualizerBand[];
878
+ };
879
+ _lastFiltersCache: GuildQueueAFiltersCache;
880
+ constructor(queue: GuildQueue<Meta>);
881
+ /**
882
+ * Volume transformer
883
+ */
884
+ get volume(): _discord_player_equalizer.VolumeTransformer | null;
885
+ /**
886
+ * 15 Band Equalizer
887
+ */
888
+ get equalizer(): _discord_player_equalizer.EqualizerStream | null;
889
+ /**
890
+ * Digital biquad filters
891
+ */
892
+ get biquad(): _discord_player_equalizer.BiquadStream | null;
893
+ /**
894
+ * DSP filters
895
+ */
896
+ get filters(): _discord_player_equalizer.AudioFilter | null;
897
+ /**
898
+ * Audio resampler
899
+ */
900
+ get resampler(): _discord_player_equalizer.PCMResampler | null;
901
+ /**
902
+ * Replay current track in transition mode
903
+ * @param seek The duration to seek to
904
+ */
905
+ triggerReplay(seek?: number): Promise<boolean>;
906
+ }
907
+ declare class AFilterGraph<Meta = unknown> {
908
+ af: GuildQueueAudioFilters<Meta>;
909
+ constructor(af: GuildQueueAudioFilters<Meta>);
910
+ get ffmpeg(): (keyof QueueFilters)[];
911
+ get equalizer(): EqualizerBand[];
912
+ get biquad(): null;
913
+ get filters(): ("8D" | "Tremolo" | "Vibrato")[];
914
+ get volume(): _discord_player_equalizer.VolumeTransformer | null;
915
+ get resampler(): _discord_player_equalizer.PCMResampler | null;
916
+ dump(): FilterGraph;
917
+ }
918
+ interface FilterGraph {
919
+ ffmpeg: Filters[];
920
+ equalizer: EqualizerBand[];
921
+ biquad: Exclude<BiquadFilters, number> | null;
922
+ filters: PCMFilters[];
923
+ volume: number;
924
+ sampleRate: number;
923
925
  }
924
926
 
925
- interface GuildNodeInit<Meta = unknown> {
926
- guild: Guild;
927
- queueStrategy: QueueStrategy;
928
- equalizer: EqualizerBand[] | boolean;
929
- volume: number | boolean;
930
- biquad: BiquadFilters | boolean | undefined;
931
- resampler: number | boolean;
932
- filterer: PCMFilters[] | boolean;
933
- ffmpegFilters: FiltersName[];
934
- disableHistory: boolean;
935
- skipOnNoStream: boolean;
936
- onBeforeCreateStream?: OnBeforeCreateStreamHandler;
937
- onAfterCreateStream?: OnAfterCreateStreamHandler;
938
- repeatMode?: QueueRepeatMode;
939
- leaveOnEmpty: boolean;
940
- leaveOnEmptyCooldown: number;
941
- leaveOnEnd: boolean;
942
- leaveOnEndCooldown: number;
943
- leaveOnStop: boolean;
944
- leaveOnStopCooldown: number;
945
- connectionTimeout: number;
946
- selfDeaf?: boolean;
947
- metadata?: Meta | null;
948
- bufferingTimeout: number;
949
- noEmitInsert: boolean;
950
- }
951
- interface VoiceConnectConfig {
952
- deaf?: boolean;
953
- timeout?: number;
954
- audioPlayer?: AudioPlayer;
955
- }
956
- interface PostProcessedResult {
957
- stream: Readable;
958
- type: StreamType;
959
- }
960
- type OnBeforeCreateStreamHandler = (track: Track, queryType: SearchQueryType, queue: GuildQueue) => Promise<Readable | null>;
961
- type OnAfterCreateStreamHandler = (stream: Readable, queue: GuildQueue) => Promise<PostProcessedResult | null>;
962
- type PlayerTriggeredReason = 'filters' | 'normal';
963
- declare enum GuildQueueEvent {
964
- /**
965
- * Emitted when audio track is added to the queue
966
- */
967
- audioTrackAdd = "audioTrackadd",
968
- /**
969
- * Emitted when audio tracks were added to the queue
970
- */
971
- audioTracksAdd = "audioTracksAdd",
972
- /**
973
- * Emitted when audio track is removed from the queue
974
- */
975
- audioTrackRemove = "audioTrackRemove",
976
- /**
977
- * Emitted when audio tracks are removed from the queue
978
- */
979
- audioTracksRemove = "audioTracksRemove",
980
- /**
981
- * Emitted when a connection is created
982
- */
983
- connection = "connection",
984
- /**
985
- * Emitted when the bot is disconnected from the channel
986
- */
987
- disconnect = "disconnect",
988
- /**
989
- * Emitted when the queue sends a debug info
990
- */
991
- debug = "debug",
992
- /**
993
- * Emitted when the queue encounters error
994
- */
995
- error = "error",
996
- /**
997
- * Emitted when the voice channel is empty
998
- */
999
- emptyChannel = "emptyChannel",
1000
- /**
1001
- * Emitted when the queue is empty
1002
- */
1003
- emptyQueue = "emptyQueue",
1004
- /**
1005
- * Emitted when the audio player starts streaming audio track
1006
- */
1007
- playerStart = "playerStart",
1008
- /**
1009
- * Emitted when the audio player errors while streaming audio track
1010
- */
1011
- playerError = "playerError",
1012
- /**
1013
- * Emitted when the audio player finishes streaming audio track
1014
- */
1015
- playerFinish = "playerFinish",
1016
- /**
1017
- * Emitted when the audio player skips current track
1018
- */
1019
- playerSkip = "playerSkip",
1020
- /**
1021
- * Emitted when the audio player is triggered
1022
- */
1023
- playerTrigger = "playerTrigger",
1024
- /**
1025
- * Emitted when the voice state is updated. Consuming this event may disable default voice state update handler if `Player.isVoiceStateHandlerLocked()` returns `false`.
1026
- */
1027
- voiceStateUpdate = "voiceStateUpdate",
1028
- /**
1029
- * Emitted when volume is updated
1030
- */
1031
- volumeChange = "volumeChange",
1032
- /**
1033
- * Emitted when player is paused
1034
- */
1035
- playerPause = "playerPause",
1036
- /**
1037
- * Emitted when player is resumed
1038
- */
1039
- playerResume = "playerResume",
1040
- /**
1041
- * Biquad Filters Update
1042
- */
1043
- biquadFiltersUpdate = "biquadFiltersUpdate",
1044
- /**
1045
- * Equalizer Update
1046
- */
1047
- equalizerUpdate = "equalizerUpdate",
1048
- /**
1049
- * DSP update
1050
- */
1051
- dspUpdate = "dspUpdate",
1052
- /**
1053
- * Audio Filters Update
1054
- */
1055
- audioFiltersUpdate = "audioFiltersUpdate"
1056
- }
1057
- interface GuildQueueEvents<Meta = unknown> {
1058
- /**
1059
- * Emitted when audio track is added to the queue
1060
- * @param queue The queue where this event occurred
1061
- * @param track The track
1062
- */
1063
- audioTrackAdd: (queue: GuildQueue<Meta>, track: Track) => unknown;
1064
- /**
1065
- * Emitted when audio tracks were added to the queue
1066
- * @param queue The queue where this event occurred
1067
- * @param tracks The tracks array
1068
- */
1069
- audioTracksAdd: (queue: GuildQueue<Meta>, track: Track[]) => unknown;
1070
- /**
1071
- * Emitted when audio track is removed from the queue
1072
- * @param queue The queue where this event occurred
1073
- * @param track The track
1074
- */
1075
- audioTrackRemove: (queue: GuildQueue<Meta>, track: Track) => unknown;
1076
- /**
1077
- * Emitted when audio tracks are removed from the queue
1078
- * @param queue The queue where this event occurred
1079
- * @param track The track
1080
- */
1081
- audioTracksRemove: (queue: GuildQueue<Meta>, track: Track[]) => unknown;
1082
- /**
1083
- * Emitted when a connection is created
1084
- * @param queue The queue where this event occurred
1085
- */
1086
- connection: (queue: GuildQueue<Meta>) => unknown;
1087
- /**
1088
- * Emitted when the bot is disconnected from the channel
1089
- * @param queue The queue where this event occurred
1090
- */
1091
- disconnect: (queue: GuildQueue<Meta>) => unknown;
1092
- /**
1093
- * Emitted when the queue sends a debug info
1094
- * @param queue The queue where this event occurred
1095
- * @param message The debug message
1096
- */
1097
- debug: (queue: GuildQueue<Meta>, message: string) => unknown;
1098
- /**
1099
- * Emitted when the queue encounters error
1100
- * @param queue The queue where this event occurred
1101
- * @param error The error
1102
- */
1103
- error: (queue: GuildQueue<Meta>, error: Error) => unknown;
1104
- /**
1105
- * Emitted when the voice channel is empty
1106
- * @param queue The queue where this event occurred
1107
- */
1108
- emptyChannel: (queue: GuildQueue<Meta>) => unknown;
1109
- /**
1110
- * Emitted when the queue is empty
1111
- * @param queue The queue where this event occurred
1112
- */
1113
- emptyQueue: (queue: GuildQueue<Meta>) => unknown;
1114
- /**
1115
- * Emitted when the audio player starts streaming audio track
1116
- * @param queue The queue where this event occurred
1117
- * @param track The track that is being streamed
1118
- */
1119
- playerStart: (queue: GuildQueue<Meta>, track: Track) => unknown;
1120
- /**
1121
- * Emitted when the audio player errors while streaming audio track
1122
- * @param queue The queue where this event occurred
1123
- * @param error The error
1124
- * @param track The track that is being streamed
1125
- */
1126
- playerError: (queue: GuildQueue<Meta>, error: Error, track: Track) => unknown;
1127
- /**
1128
- * Emitted when the audio player finishes streaming audio track
1129
- * @param queue The queue where this event occurred
1130
- * @param track The track that was being streamed
1131
- */
1132
- playerFinish: (queue: GuildQueue<Meta>, track: Track) => unknown;
1133
- /**
1134
- * Emitted when the audio player skips current track
1135
- * @param queue The queue where this event occurred
1136
- * @param track The track that was skipped
1137
- */
1138
- playerSkip: (queue: GuildQueue<Meta>, track: Track) => unknown;
1139
- /**
1140
- * Emitted when the audio player is triggered
1141
- * @param queue The queue where this event occurred
1142
- * @param track The track which was played in this event
1143
- */
1144
- playerTrigger: (queue: GuildQueue<Meta>, track: Track, reason: PlayerTriggeredReason) => unknown;
1145
- /**
1146
- * Emitted when the voice state is updated. Consuming this event may disable default voice state update handler if `Player.isVoiceStateHandlerLocked()` returns `false`.
1147
- * @param queue The queue where this event occurred
1148
- * @param oldState The old voice state
1149
- * @param newState The new voice state
1150
- */
1151
- voiceStateUpdate: (queue: GuildQueue<Meta>, oldState: VoiceState, newState: VoiceState) => unknown;
1152
- /**
1153
- * Emitted when audio player is paused
1154
- * @param queue The queue where this event occurred
1155
- */
1156
- playerPause: (queue: GuildQueue<Meta>) => unknown;
1157
- /**
1158
- * Emitted when audio player is resumed
1159
- * @param queue The queue where this event occurred
1160
- */
1161
- playerResume: (queue: GuildQueue<Meta>) => unknown;
1162
- /**
1163
- * Emitted when audio player's volume is changed
1164
- * @param queue The queue where this event occurred
1165
- * @param oldVolume The old volume
1166
- * @param newVolume The updated volume
1167
- */
1168
- volumeChange: (queue: GuildQueue<Meta>, oldVolume: number, newVolume: number) => unknown;
1169
- /**
1170
- * Emitted when equalizer config is updated
1171
- * @param queue The queue where this event occurred
1172
- * @param oldFilters Old filters
1173
- * @param newFilters New filters
1174
- */
1175
- equalizerUpdate: (queue: GuildQueue<Meta>, oldFilters: EqualizerBand[], newFilters: EqualizerBand[]) => unknown;
1176
- /**
1177
- * Emitted when biquad filters is updated
1178
- * @param queue The queue where this event occurred
1179
- * @param oldFilters Old filters
1180
- * @param newFilters New filters
1181
- */
1182
- biquadFiltersUpdate: (queue: GuildQueue<Meta>, oldFilters: BiquadFilters | null, newFilters: BiquadFilters | null) => unknown;
1183
- /**
1184
- * Emitted when dsp filters is updated
1185
- * @param queue The queue where this event occurred
1186
- * @param oldFilters Old filters
1187
- * @param newFilters New filters
1188
- */
1189
- dspUpdate: (queue: GuildQueue<Meta>, oldFilters: PCMFilters[], newFilters: PCMFilters[]) => unknown;
1190
- /**
1191
- * Emitted when ffmpeg audio filters is updated
1192
- * @param queue The queue where this event occurred
1193
- * @param oldFilters Old filters
1194
- * @param newFilters New filters
1195
- */
1196
- audioFiltersUpdate: (queue: GuildQueue<Meta>, oldFilters: FiltersName[], newFilters: FiltersName[]) => unknown;
1197
- }
1198
- declare class GuildQueue<Meta = unknown> {
1199
- #private;
1200
- player: Player;
1201
- options: GuildNodeInit<Meta>;
1202
- private __current;
1203
- tracks: Queue<Track>;
1204
- history: GuildQueueHistory<Meta>;
1205
- dispatcher: StreamDispatcher | null;
1206
- node: GuildQueuePlayerNode<Meta>;
1207
- filters: GuildQueueAudioFilters<Meta>;
1208
- onBeforeCreateStream: OnBeforeCreateStreamHandler;
1209
- onAfterCreateStream: OnAfterCreateStreamHandler;
1210
- repeatMode: QueueRepeatMode;
1211
- timeouts: Collection<string, NodeJS.Timeout>;
1212
- stats: GuildQueueStatistics<Meta>;
1213
- tasksQueue: AsyncQueue;
1214
- constructor(player: Player, options: GuildNodeInit<Meta>);
1215
- /**
1216
- * Estimated duration of this queue in ms
1217
- */
1218
- get estimatedDuration(): number;
1219
- /**
1220
- * Formatted duration of this queue
1221
- */
1222
- get durationFormatted(): string;
1223
- /**
1224
- * The voice receiver for this queue
1225
- */
1226
- get voiceReceiver(): VoiceReceiverNode | null;
1227
- /**
1228
- * Write a debug message to this queue
1229
- * @param m The message to write
1230
- */
1231
- debug(m: string): void;
1232
- /**
1233
- * The metadata of this queue
1234
- */
1235
- get metadata(): Meta;
1236
- set metadata(m: Meta);
1237
- /**
1238
- * Set metadata for this queue
1239
- * @param m Metadata to set
1240
- */
1241
- setMetadata(m: Meta): void;
1242
- /**
1243
- * Indicates current track of this queue
1244
- */
1245
- get currentTrack(): Track | null;
1246
- /**
1247
- * Indicates if this queue was deleted previously
1248
- */
1249
- get deleted(): boolean;
1250
- /**
1251
- * The voice channel of this queue
1252
- */
1253
- get channel(): VoiceBasedChannel | null;
1254
- set channel(c: VoiceBasedChannel | null);
1255
- /**
1256
- * The voice connection of this queue
1257
- */
1258
- get connection(): _discordjs_voice.VoiceConnection | null;
1259
- /**
1260
- * The guild this queue belongs to
1261
- */
1262
- get guild(): Guild;
1263
- /**
1264
- * The id of this queue
1265
- */
1266
- get id(): string;
1267
- /**
1268
- * Set transition mode for this queue
1269
- * @param state The state to set
1270
- */
1271
- setTransitioning(state: boolean): void;
1272
- /**
1273
- * if this queue is currently under transition mode
1274
- */
1275
- isTransitioning(): boolean;
1276
- /**
1277
- * Set repeat mode for this queue
1278
- * @param mode The repeat mode to apply
1279
- */
1280
- setRepeatMode(mode: QueueRepeatMode): void;
1281
- /**
1282
- * Gets the size of the queue
1283
- */
1284
- get size(): number;
1285
- /**
1286
- * The size of this queue
1287
- */
1288
- getSize(): number;
1289
- /**
1290
- * Clear this queue
1291
- */
1292
- clear(): void;
1293
- /**
1294
- * Check if this queue has no tracks left in it
1295
- */
1296
- isEmpty(): boolean;
1297
- /**
1298
- * Check if this queue currently holds active audio resource
1299
- */
1300
- isPlaying(): boolean;
1301
- /**
1302
- * Add track to the queue. This will emit `audioTracksAdd` when multiple tracks are added, otherwise `audioTrackAdd`.
1303
- * @param track Track or playlist or array of tracks to add
1304
- */
1305
- addTrack(track: Track | Track[] | Playlist): void;
1306
- /**
1307
- * Remove a track from queue
1308
- * @param track The track to remove
1309
- */
1310
- removeTrack(track: TrackResolvable): Track | null;
1311
- /**
1312
- * Inserts the track to the given index
1313
- * @param track The track to insert
1314
- * @param index The index to insert the track at (defaults to 0)
1315
- */
1316
- insertTrack(track: Track, index?: number): void;
1317
- /**
1318
- * Moves a track in the queue
1319
- * @param from The track to move
1320
- * @param to The position to move to
1321
- */
1322
- moveTrack(track: TrackResolvable, index?: number): void;
1323
- /**
1324
- * Copy a track in the queue
1325
- * @param from The track to clone
1326
- * @param to The position to clone at
1327
- */
1328
- copyTrack(track: TrackResolvable, index?: number): void;
1329
- /**
1330
- * Swap two tracks in the queue
1331
- * @param src The first track to swap
1332
- * @param dest The second track to swap
1333
- */
1334
- swapTracks(src: TrackResolvable, dest: TrackResolvable): void;
1335
- /**
1336
- * Connect to a voice channel
1337
- * @param channelResolvable The voice channel to connect to
1338
- * @param options Join config
1339
- */
1340
- connect(channelResolvable: GuildVoiceChannelResolvable, options?: VoiceConnectConfig): Promise<this>;
1341
- /**
1342
- * The voice connection latency of this queue
1343
- */
1344
- get ping(): number;
1345
- /**
1346
- * Delete this queue
1347
- */
1348
- delete(): void;
1349
- /**
1350
- * Revives this queue
1351
- * @returns
1352
- */
1353
- revive(): void;
1354
- /**
1355
- * Set self deaf
1356
- * @param mode On/Off state
1357
- * @param reason Reason
1358
- */
1359
- setSelfDeaf(mode?: boolean, reason?: string): Promise<discord_js.GuildMember>;
1360
- /**
1361
- * Set self mute
1362
- * @param mode On/Off state
1363
- * @param reason Reason
1364
- */
1365
- setSelfMute(mode?: boolean, reason?: string): Promise<discord_js.GuildMember>;
927
+ interface GuildNodeInit<Meta = unknown> {
928
+ guild: Guild;
929
+ queueStrategy: QueueStrategy;
930
+ equalizer: EqualizerBand[] | boolean;
931
+ volume: number | boolean;
932
+ biquad: BiquadFilters | boolean | undefined;
933
+ resampler: number | boolean;
934
+ filterer: PCMFilters[] | boolean;
935
+ ffmpegFilters: FiltersName[];
936
+ disableHistory: boolean;
937
+ skipOnNoStream: boolean;
938
+ onBeforeCreateStream?: OnBeforeCreateStreamHandler;
939
+ onAfterCreateStream?: OnAfterCreateStreamHandler;
940
+ repeatMode?: QueueRepeatMode;
941
+ leaveOnEmpty: boolean;
942
+ leaveOnEmptyCooldown: number;
943
+ leaveOnEnd: boolean;
944
+ leaveOnEndCooldown: number;
945
+ leaveOnStop: boolean;
946
+ leaveOnStopCooldown: number;
947
+ connectionTimeout: number;
948
+ selfDeaf?: boolean;
949
+ metadata?: Meta | null;
950
+ bufferingTimeout: number;
951
+ noEmitInsert: boolean;
952
+ }
953
+ interface VoiceConnectConfig {
954
+ deaf?: boolean;
955
+ timeout?: number;
956
+ audioPlayer?: AudioPlayer;
957
+ }
958
+ interface PostProcessedResult {
959
+ stream: Readable;
960
+ type: StreamType;
961
+ }
962
+ type OnBeforeCreateStreamHandler = (track: Track, queryType: SearchQueryType, queue: GuildQueue) => Promise<Readable | null>;
963
+ type OnAfterCreateStreamHandler = (stream: Readable, queue: GuildQueue) => Promise<PostProcessedResult | null>;
964
+ type PlayerTriggeredReason = 'filters' | 'normal';
965
+ declare enum GuildQueueEvent {
966
+ /**
967
+ * Emitted when audio track is added to the queue
968
+ */
969
+ audioTrackAdd = "audioTrackadd",
970
+ /**
971
+ * Emitted when audio tracks were added to the queue
972
+ */
973
+ audioTracksAdd = "audioTracksAdd",
974
+ /**
975
+ * Emitted when audio track is removed from the queue
976
+ */
977
+ audioTrackRemove = "audioTrackRemove",
978
+ /**
979
+ * Emitted when audio tracks are removed from the queue
980
+ */
981
+ audioTracksRemove = "audioTracksRemove",
982
+ /**
983
+ * Emitted when a connection is created
984
+ */
985
+ connection = "connection",
986
+ /**
987
+ * Emitted when the bot is disconnected from the channel
988
+ */
989
+ disconnect = "disconnect",
990
+ /**
991
+ * Emitted when the queue sends a debug info
992
+ */
993
+ debug = "debug",
994
+ /**
995
+ * Emitted when the queue encounters error
996
+ */
997
+ error = "error",
998
+ /**
999
+ * Emitted when the voice channel is empty
1000
+ */
1001
+ emptyChannel = "emptyChannel",
1002
+ /**
1003
+ * Emitted when the queue is empty
1004
+ */
1005
+ emptyQueue = "emptyQueue",
1006
+ /**
1007
+ * Emitted when the audio player starts streaming audio track
1008
+ */
1009
+ playerStart = "playerStart",
1010
+ /**
1011
+ * Emitted when the audio player errors while streaming audio track
1012
+ */
1013
+ playerError = "playerError",
1014
+ /**
1015
+ * Emitted when the audio player finishes streaming audio track
1016
+ */
1017
+ playerFinish = "playerFinish",
1018
+ /**
1019
+ * Emitted when the audio player skips current track
1020
+ */
1021
+ playerSkip = "playerSkip",
1022
+ /**
1023
+ * Emitted when the audio player is triggered
1024
+ */
1025
+ playerTrigger = "playerTrigger",
1026
+ /**
1027
+ * Emitted when the voice state is updated. Consuming this event may disable default voice state update handler if `Player.isVoiceStateHandlerLocked()` returns `false`.
1028
+ */
1029
+ voiceStateUpdate = "voiceStateUpdate",
1030
+ /**
1031
+ * Emitted when volume is updated
1032
+ */
1033
+ volumeChange = "volumeChange",
1034
+ /**
1035
+ * Emitted when player is paused
1036
+ */
1037
+ playerPause = "playerPause",
1038
+ /**
1039
+ * Emitted when player is resumed
1040
+ */
1041
+ playerResume = "playerResume",
1042
+ /**
1043
+ * Biquad Filters Update
1044
+ */
1045
+ biquadFiltersUpdate = "biquadFiltersUpdate",
1046
+ /**
1047
+ * Equalizer Update
1048
+ */
1049
+ equalizerUpdate = "equalizerUpdate",
1050
+ /**
1051
+ * DSP update
1052
+ */
1053
+ dspUpdate = "dspUpdate",
1054
+ /**
1055
+ * Audio Filters Update
1056
+ */
1057
+ audioFiltersUpdate = "audioFiltersUpdate"
1058
+ }
1059
+ interface GuildQueueEvents<Meta = unknown> {
1060
+ /**
1061
+ * Emitted when audio track is added to the queue
1062
+ * @param queue The queue where this event occurred
1063
+ * @param track The track
1064
+ */
1065
+ audioTrackAdd: (queue: GuildQueue<Meta>, track: Track) => unknown;
1066
+ /**
1067
+ * Emitted when audio tracks were added to the queue
1068
+ * @param queue The queue where this event occurred
1069
+ * @param tracks The tracks array
1070
+ */
1071
+ audioTracksAdd: (queue: GuildQueue<Meta>, track: Track[]) => unknown;
1072
+ /**
1073
+ * Emitted when audio track is removed from the queue
1074
+ * @param queue The queue where this event occurred
1075
+ * @param track The track
1076
+ */
1077
+ audioTrackRemove: (queue: GuildQueue<Meta>, track: Track) => unknown;
1078
+ /**
1079
+ * Emitted when audio tracks are removed from the queue
1080
+ * @param queue The queue where this event occurred
1081
+ * @param track The track
1082
+ */
1083
+ audioTracksRemove: (queue: GuildQueue<Meta>, track: Track[]) => unknown;
1084
+ /**
1085
+ * Emitted when a connection is created
1086
+ * @param queue The queue where this event occurred
1087
+ */
1088
+ connection: (queue: GuildQueue<Meta>) => unknown;
1089
+ /**
1090
+ * Emitted when the bot is disconnected from the channel
1091
+ * @param queue The queue where this event occurred
1092
+ */
1093
+ disconnect: (queue: GuildQueue<Meta>) => unknown;
1094
+ /**
1095
+ * Emitted when the queue sends a debug info
1096
+ * @param queue The queue where this event occurred
1097
+ * @param message The debug message
1098
+ */
1099
+ debug: (queue: GuildQueue<Meta>, message: string) => unknown;
1100
+ /**
1101
+ * Emitted when the queue encounters error
1102
+ * @param queue The queue where this event occurred
1103
+ * @param error The error
1104
+ */
1105
+ error: (queue: GuildQueue<Meta>, error: Error) => unknown;
1106
+ /**
1107
+ * Emitted when the voice channel is empty
1108
+ * @param queue The queue where this event occurred
1109
+ */
1110
+ emptyChannel: (queue: GuildQueue<Meta>) => unknown;
1111
+ /**
1112
+ * Emitted when the queue is empty
1113
+ * @param queue The queue where this event occurred
1114
+ */
1115
+ emptyQueue: (queue: GuildQueue<Meta>) => unknown;
1116
+ /**
1117
+ * Emitted when the audio player starts streaming audio track
1118
+ * @param queue The queue where this event occurred
1119
+ * @param track The track that is being streamed
1120
+ */
1121
+ playerStart: (queue: GuildQueue<Meta>, track: Track) => unknown;
1122
+ /**
1123
+ * Emitted when the audio player errors while streaming audio track
1124
+ * @param queue The queue where this event occurred
1125
+ * @param error The error
1126
+ * @param track The track that is being streamed
1127
+ */
1128
+ playerError: (queue: GuildQueue<Meta>, error: Error, track: Track) => unknown;
1129
+ /**
1130
+ * Emitted when the audio player finishes streaming audio track
1131
+ * @param queue The queue where this event occurred
1132
+ * @param track The track that was being streamed
1133
+ */
1134
+ playerFinish: (queue: GuildQueue<Meta>, track: Track) => unknown;
1135
+ /**
1136
+ * Emitted when the audio player skips current track
1137
+ * @param queue The queue where this event occurred
1138
+ * @param track The track that was skipped
1139
+ */
1140
+ playerSkip: (queue: GuildQueue<Meta>, track: Track) => unknown;
1141
+ /**
1142
+ * Emitted when the audio player is triggered
1143
+ * @param queue The queue where this event occurred
1144
+ * @param track The track which was played in this event
1145
+ */
1146
+ playerTrigger: (queue: GuildQueue<Meta>, track: Track, reason: PlayerTriggeredReason) => unknown;
1147
+ /**
1148
+ * Emitted when the voice state is updated. Consuming this event may disable default voice state update handler if `Player.isVoiceStateHandlerLocked()` returns `false`.
1149
+ * @param queue The queue where this event occurred
1150
+ * @param oldState The old voice state
1151
+ * @param newState The new voice state
1152
+ */
1153
+ voiceStateUpdate: (queue: GuildQueue<Meta>, oldState: VoiceState, newState: VoiceState) => unknown;
1154
+ /**
1155
+ * Emitted when audio player is paused
1156
+ * @param queue The queue where this event occurred
1157
+ */
1158
+ playerPause: (queue: GuildQueue<Meta>) => unknown;
1159
+ /**
1160
+ * Emitted when audio player is resumed
1161
+ * @param queue The queue where this event occurred
1162
+ */
1163
+ playerResume: (queue: GuildQueue<Meta>) => unknown;
1164
+ /**
1165
+ * Emitted when audio player's volume is changed
1166
+ * @param queue The queue where this event occurred
1167
+ * @param oldVolume The old volume
1168
+ * @param newVolume The updated volume
1169
+ */
1170
+ volumeChange: (queue: GuildQueue<Meta>, oldVolume: number, newVolume: number) => unknown;
1171
+ /**
1172
+ * Emitted when equalizer config is updated
1173
+ * @param queue The queue where this event occurred
1174
+ * @param oldFilters Old filters
1175
+ * @param newFilters New filters
1176
+ */
1177
+ equalizerUpdate: (queue: GuildQueue<Meta>, oldFilters: EqualizerBand[], newFilters: EqualizerBand[]) => unknown;
1178
+ /**
1179
+ * Emitted when biquad filters is updated
1180
+ * @param queue The queue where this event occurred
1181
+ * @param oldFilters Old filters
1182
+ * @param newFilters New filters
1183
+ */
1184
+ biquadFiltersUpdate: (queue: GuildQueue<Meta>, oldFilters: BiquadFilters | null, newFilters: BiquadFilters | null) => unknown;
1185
+ /**
1186
+ * Emitted when dsp filters is updated
1187
+ * @param queue The queue where this event occurred
1188
+ * @param oldFilters Old filters
1189
+ * @param newFilters New filters
1190
+ */
1191
+ dspUpdate: (queue: GuildQueue<Meta>, oldFilters: PCMFilters[], newFilters: PCMFilters[]) => unknown;
1192
+ /**
1193
+ * Emitted when ffmpeg audio filters is updated
1194
+ * @param queue The queue where this event occurred
1195
+ * @param oldFilters Old filters
1196
+ * @param newFilters New filters
1197
+ */
1198
+ audioFiltersUpdate: (queue: GuildQueue<Meta>, oldFilters: FiltersName[], newFilters: FiltersName[]) => unknown;
1199
+ }
1200
+ declare class GuildQueue<Meta = unknown> {
1201
+ #private;
1202
+ player: Player;
1203
+ options: GuildNodeInit<Meta>;
1204
+ private __current;
1205
+ tracks: Queue<Track>;
1206
+ history: GuildQueueHistory<Meta>;
1207
+ dispatcher: StreamDispatcher | null;
1208
+ node: GuildQueuePlayerNode<Meta>;
1209
+ filters: GuildQueueAudioFilters<Meta>;
1210
+ onBeforeCreateStream: OnBeforeCreateStreamHandler;
1211
+ onAfterCreateStream: OnAfterCreateStreamHandler;
1212
+ repeatMode: QueueRepeatMode;
1213
+ timeouts: Collection<string, NodeJS.Timeout>;
1214
+ stats: GuildQueueStatistics<Meta>;
1215
+ tasksQueue: AsyncQueue;
1216
+ constructor(player: Player, options: GuildNodeInit<Meta>);
1217
+ /**
1218
+ * Estimated duration of this queue in ms
1219
+ */
1220
+ get estimatedDuration(): number;
1221
+ /**
1222
+ * Formatted duration of this queue
1223
+ */
1224
+ get durationFormatted(): string;
1225
+ /**
1226
+ * The voice receiver for this queue
1227
+ */
1228
+ get voiceReceiver(): VoiceReceiverNode | null;
1229
+ /**
1230
+ * Write a debug message to this queue
1231
+ * @param m The message to write
1232
+ */
1233
+ debug(m: string): void;
1234
+ /**
1235
+ * The metadata of this queue
1236
+ */
1237
+ get metadata(): Meta;
1238
+ set metadata(m: Meta);
1239
+ /**
1240
+ * Set metadata for this queue
1241
+ * @param m Metadata to set
1242
+ */
1243
+ setMetadata(m: Meta): void;
1244
+ /**
1245
+ * Indicates current track of this queue
1246
+ */
1247
+ get currentTrack(): Track | null;
1248
+ /**
1249
+ * Indicates if this queue was deleted previously
1250
+ */
1251
+ get deleted(): boolean;
1252
+ /**
1253
+ * The voice channel of this queue
1254
+ */
1255
+ get channel(): VoiceBasedChannel | null;
1256
+ set channel(c: VoiceBasedChannel | null);
1257
+ /**
1258
+ * The voice connection of this queue
1259
+ */
1260
+ get connection(): _discordjs_voice.VoiceConnection | null;
1261
+ /**
1262
+ * The guild this queue belongs to
1263
+ */
1264
+ get guild(): Guild;
1265
+ /**
1266
+ * The id of this queue
1267
+ */
1268
+ get id(): string;
1269
+ /**
1270
+ * Set transition mode for this queue
1271
+ * @param state The state to set
1272
+ */
1273
+ setTransitioning(state: boolean): void;
1274
+ /**
1275
+ * if this queue is currently under transition mode
1276
+ */
1277
+ isTransitioning(): boolean;
1278
+ /**
1279
+ * Set repeat mode for this queue
1280
+ * @param mode The repeat mode to apply
1281
+ */
1282
+ setRepeatMode(mode: QueueRepeatMode): void;
1283
+ /**
1284
+ * Gets the size of the queue
1285
+ */
1286
+ get size(): number;
1287
+ /**
1288
+ * The size of this queue
1289
+ */
1290
+ getSize(): number;
1291
+ /**
1292
+ * Clear this queue
1293
+ */
1294
+ clear(): void;
1295
+ /**
1296
+ * Check if this queue has no tracks left in it
1297
+ */
1298
+ isEmpty(): boolean;
1299
+ /**
1300
+ * Check if this queue currently holds active audio resource
1301
+ */
1302
+ isPlaying(): boolean;
1303
+ /**
1304
+ * Add track to the queue. This will emit `audioTracksAdd` when multiple tracks are added, otherwise `audioTrackAdd`.
1305
+ * @param track Track or playlist or array of tracks to add
1306
+ */
1307
+ addTrack(track: Track | Track[] | Playlist): void;
1308
+ /**
1309
+ * Remove a track from queue
1310
+ * @param track The track to remove
1311
+ */
1312
+ removeTrack(track: TrackResolvable): Track | null;
1313
+ /**
1314
+ * Inserts the track to the given index
1315
+ * @param track The track to insert
1316
+ * @param index The index to insert the track at (defaults to 0)
1317
+ */
1318
+ insertTrack(track: Track, index?: number): void;
1319
+ /**
1320
+ * Moves a track in the queue
1321
+ * @param from The track to move
1322
+ * @param to The position to move to
1323
+ */
1324
+ moveTrack(track: TrackResolvable, index?: number): void;
1325
+ /**
1326
+ * Copy a track in the queue
1327
+ * @param from The track to clone
1328
+ * @param to The position to clone at
1329
+ */
1330
+ copyTrack(track: TrackResolvable, index?: number): void;
1331
+ /**
1332
+ * Swap two tracks in the queue
1333
+ * @param src The first track to swap
1334
+ * @param dest The second track to swap
1335
+ */
1336
+ swapTracks(src: TrackResolvable, dest: TrackResolvable): void;
1337
+ /**
1338
+ * Connect to a voice channel
1339
+ * @param channelResolvable The voice channel to connect to
1340
+ * @param options Join config
1341
+ */
1342
+ connect(channelResolvable: GuildVoiceChannelResolvable, options?: VoiceConnectConfig): Promise<this>;
1343
+ /**
1344
+ * The voice connection latency of this queue
1345
+ */
1346
+ get ping(): number;
1347
+ /**
1348
+ * Delete this queue
1349
+ */
1350
+ delete(): void;
1351
+ /**
1352
+ * Revives this queue
1353
+ * @returns
1354
+ */
1355
+ revive(): void;
1356
+ /**
1357
+ * Set self deaf
1358
+ * @param mode On/Off state
1359
+ * @param reason Reason
1360
+ */
1361
+ setSelfDeaf(mode?: boolean, reason?: string): Promise<discord_js.GuildMember>;
1362
+ /**
1363
+ * Set self mute
1364
+ * @param mode On/Off state
1365
+ * @param reason Reason
1366
+ */
1367
+ setSelfMute(mode?: boolean, reason?: string): Promise<discord_js.GuildMember>;
1366
1368
  }
1367
1369
 
1368
- interface GuildQueueStatisticsMetadata {
1369
- latency: {
1370
- eventLoop: number;
1371
- voiceConnection: number;
1372
- };
1373
- status: {
1374
- buffering: boolean;
1375
- playing: boolean;
1376
- paused: boolean;
1377
- idle: boolean;
1378
- };
1379
- tracksCount: number;
1380
- historySize: number;
1381
- extractors: number;
1382
- listeners: number;
1383
- memoryUsage: NodeJS.MemoryUsage;
1384
- versions: {
1385
- node: string;
1386
- player: string;
1387
- };
1388
- }
1389
- declare class GuildQueueStatistics<Meta = unknown> {
1390
- queue: GuildQueue<Meta>;
1391
- constructor(queue: GuildQueue<Meta>);
1392
- /**
1393
- * Generate statistics of this queue
1394
- */
1395
- generate(): GuildQueueStatisticsMetadata;
1370
+ interface GuildQueueStatisticsMetadata {
1371
+ latency: {
1372
+ eventLoop: number;
1373
+ voiceConnection: number;
1374
+ };
1375
+ status: {
1376
+ buffering: boolean;
1377
+ playing: boolean;
1378
+ paused: boolean;
1379
+ idle: boolean;
1380
+ };
1381
+ tracksCount: number;
1382
+ historySize: number;
1383
+ extractors: number;
1384
+ listeners: number;
1385
+ memoryUsage: NodeJS.MemoryUsage;
1386
+ versions: {
1387
+ node: string;
1388
+ player: string;
1389
+ };
1390
+ }
1391
+ declare class GuildQueueStatistics<Meta = unknown> {
1392
+ queue: GuildQueue<Meta>;
1393
+ constructor(queue: GuildQueue<Meta>);
1394
+ /**
1395
+ * Generate statistics of this queue
1396
+ */
1397
+ generate(): GuildQueueStatisticsMetadata;
1396
1398
  }
1397
1399
 
1398
- declare class VoiceUtils {
1399
- player: Player;
1400
- cache: Collection<Snowflake, StreamDispatcher>;
1401
- /**
1402
- * The voice utils
1403
- * @private
1404
- */
1405
- constructor(player: Player);
1406
- /**
1407
- * Joins a voice channel, creating basic stream dispatch manager
1408
- * @param {StageChannel|VoiceChannel} channel The voice channel
1409
- * @param {object} [options] Join options
1410
- * @returns {Promise<StreamDispatcher>}
1411
- */
1412
- connect(channel: VoiceChannel | StageChannel, options?: {
1413
- deaf?: boolean;
1414
- maxTime?: number;
1415
- queue: GuildQueue;
1416
- audioPlayer?: AudioPlayer;
1417
- }): Promise<StreamDispatcher>;
1418
- /**
1419
- * Joins a voice channel
1420
- * @param {StageChannel|VoiceChannel} [channel] The voice/stage channel to join
1421
- * @param {object} [options] Join options
1422
- * @returns {VoiceConnection}
1423
- */
1424
- join(channel: VoiceChannel | StageChannel, options?: {
1425
- deaf?: boolean;
1426
- maxTime?: number;
1427
- }): Promise<VoiceConnection>;
1428
- /**
1429
- * Disconnects voice connection
1430
- * @param {VoiceConnection} connection The voice connection
1431
- * @returns {void}
1432
- */
1433
- disconnect(connection: VoiceConnection | StreamDispatcher): void;
1434
- /**
1435
- * Returns Discord Player voice connection
1436
- * @param {Snowflake} guild The guild id
1437
- * @returns {StreamDispatcher}
1438
- */
1439
- getConnection(guild: Snowflake): StreamDispatcher | VoiceConnection | undefined;
1400
+ declare class VoiceUtils {
1401
+ player: Player;
1402
+ cache: Collection<Snowflake, StreamDispatcher>;
1403
+ /**
1404
+ * The voice utils
1405
+ * @private
1406
+ */
1407
+ constructor(player: Player);
1408
+ /**
1409
+ * Joins a voice channel, creating basic stream dispatch manager
1410
+ * @param {StageChannel|VoiceChannel} channel The voice channel
1411
+ * @param {object} [options] Join options
1412
+ * @returns {Promise<StreamDispatcher>}
1413
+ */
1414
+ connect(channel: VoiceChannel | StageChannel, options?: {
1415
+ deaf?: boolean;
1416
+ maxTime?: number;
1417
+ queue: GuildQueue;
1418
+ audioPlayer?: AudioPlayer;
1419
+ }): Promise<StreamDispatcher>;
1420
+ /**
1421
+ * Joins a voice channel
1422
+ * @param {StageChannel|VoiceChannel} [channel] The voice/stage channel to join
1423
+ * @param {object} [options] Join options
1424
+ * @returns {VoiceConnection}
1425
+ */
1426
+ join(channel: VoiceChannel | StageChannel, options?: {
1427
+ deaf?: boolean;
1428
+ maxTime?: number;
1429
+ }): Promise<VoiceConnection>;
1430
+ /**
1431
+ * Disconnects voice connection
1432
+ * @param {VoiceConnection} connection The voice connection
1433
+ * @returns {void}
1434
+ */
1435
+ disconnect(connection: VoiceConnection | StreamDispatcher): void;
1436
+ /**
1437
+ * Returns Discord Player voice connection
1438
+ * @param {Snowflake} guild The guild id
1439
+ * @returns {StreamDispatcher}
1440
+ */
1441
+ getConnection(guild: Snowflake): StreamDispatcher | VoiceConnection | undefined;
1440
1442
  }
1441
1443
 
1442
- interface SearchResultData {
1443
- query: string;
1444
- queryType?: SearchQueryType | QueryExtractorSearch | null;
1445
- extractor?: BaseExtractor | null;
1446
- playlist?: Playlist | null;
1447
- tracks?: Track[];
1448
- requestedBy?: User | null;
1449
- }
1450
- declare class SearchResult {
1451
- player: Player;
1452
- private _data;
1453
- constructor(player: Player, _data: SearchResultData);
1454
- setQueryType(type: SearchQueryType | QueryExtractorSearch): this;
1455
- setRequestedBy(user: User): this;
1456
- setExtractor(extractor: BaseExtractor): this;
1457
- setTracks(tracks: Track[]): this;
1458
- setQuery(query: string): this;
1459
- setPlaylist(playlist: Playlist): this;
1460
- /**
1461
- * The search query
1462
- */
1463
- get query(): string;
1464
- /**
1465
- * The search query type
1466
- */
1467
- get queryType(): SearchQueryType | `ext:${string}`;
1468
- /**
1469
- * The extractor
1470
- */
1471
- get extractor(): BaseExtractor<object> | null;
1472
- /**
1473
- * Playlist result
1474
- */
1475
- get playlist(): Playlist | null | undefined;
1476
- /**
1477
- * Tracks result
1478
- */
1479
- get tracks(): Track[];
1480
- /**
1481
- * Requested by
1482
- */
1483
- get requestedBy(): User | null;
1484
- /**
1485
- * Re-execute this search
1486
- */
1487
- execute(): Promise<SearchResult>;
1488
- /**
1489
- * If this search result is empty
1490
- */
1491
- isEmpty(): boolean;
1492
- /**
1493
- * If this search result has playlist
1494
- */
1495
- hasPlaylist(): boolean;
1496
- /**
1497
- * If this search result has tracks
1498
- */
1499
- hasTracks(): boolean;
1500
- /**
1501
- * JSON representation of this search
1502
- */
1503
- toJSON(): {
1504
- query: string;
1505
- queryType: SearchQueryType | `ext:${string}`;
1506
- playlist: PlaylistJSON | null;
1507
- tracks: TrackJSON[];
1508
- extractor: string | null;
1509
- requestedBy: {} | null;
1510
- };
1444
+ interface SearchResultData {
1445
+ query: string;
1446
+ queryType?: SearchQueryType | QueryExtractorSearch | null;
1447
+ extractor?: BaseExtractor | null;
1448
+ playlist?: Playlist | null;
1449
+ tracks?: Track[];
1450
+ requestedBy?: User | null;
1451
+ }
1452
+ declare class SearchResult {
1453
+ player: Player;
1454
+ private _data;
1455
+ constructor(player: Player, _data: SearchResultData);
1456
+ setQueryType(type: SearchQueryType | QueryExtractorSearch): this;
1457
+ setRequestedBy(user: User): this;
1458
+ setExtractor(extractor: BaseExtractor): this;
1459
+ setTracks(tracks: Track[]): this;
1460
+ setQuery(query: string): this;
1461
+ setPlaylist(playlist: Playlist): this;
1462
+ /**
1463
+ * The search query
1464
+ */
1465
+ get query(): string;
1466
+ /**
1467
+ * The search query type
1468
+ */
1469
+ get queryType(): SearchQueryType | `ext:${string}`;
1470
+ /**
1471
+ * The extractor
1472
+ */
1473
+ get extractor(): BaseExtractor<object> | null;
1474
+ /**
1475
+ * Playlist result
1476
+ */
1477
+ get playlist(): Playlist | null | undefined;
1478
+ /**
1479
+ * Tracks result
1480
+ */
1481
+ get tracks(): Track[];
1482
+ /**
1483
+ * Requested by
1484
+ */
1485
+ get requestedBy(): User | null;
1486
+ /**
1487
+ * Re-execute this search
1488
+ */
1489
+ execute(): Promise<SearchResult>;
1490
+ /**
1491
+ * If this search result is empty
1492
+ */
1493
+ isEmpty(): boolean;
1494
+ /**
1495
+ * If this search result has playlist
1496
+ */
1497
+ hasPlaylist(): boolean;
1498
+ /**
1499
+ * If this search result has tracks
1500
+ */
1501
+ hasTracks(): boolean;
1502
+ /**
1503
+ * JSON representation of this search
1504
+ */
1505
+ toJSON(): {
1506
+ query: string;
1507
+ queryType: SearchQueryType | `ext:${string}`;
1508
+ playlist: PlaylistJSON | null;
1509
+ tracks: TrackJSON[];
1510
+ extractor: string | null;
1511
+ requestedBy: {} | null;
1512
+ };
1511
1513
  }
1512
1514
 
1513
- interface QueryCacheOptions {
1514
- checkInterval?: number;
1515
- }
1516
- declare class QueryCache {
1517
- #private;
1518
- player: Player;
1519
- options: QueryCacheOptions;
1520
- timer: NodeJS.Timer;
1521
- constructor(player: Player, options?: QueryCacheOptions);
1522
- get checkInterval(): number;
1523
- cleanup(): Promise<void>;
1524
- clear(): Promise<void>;
1525
- getData(): Promise<DiscordPlayerQueryResultCache<Track>[]>;
1526
- addData(data: SearchResult): Promise<void>;
1527
- resolve(context: QueryCacheResolverContext): Promise<SearchResult>;
1528
- }
1529
- declare class DiscordPlayerQueryResultCache<T = unknown> {
1530
- data: T;
1531
- expireAfter: number;
1532
- constructor(data: T, expireAfter?: number);
1533
- hasExpired(): boolean;
1534
- }
1535
- interface QueryCacheResolverContext {
1536
- query: string;
1537
- requestedBy?: User;
1538
- queryType?: SearchQueryType | `ext:${string}`;
1515
+ interface QueryCacheOptions {
1516
+ checkInterval?: number;
1517
+ }
1518
+ declare class QueryCache {
1519
+ #private;
1520
+ player: Player;
1521
+ options: QueryCacheOptions;
1522
+ timer: NodeJS.Timer;
1523
+ constructor(player: Player, options?: QueryCacheOptions);
1524
+ get checkInterval(): number;
1525
+ cleanup(): Promise<void>;
1526
+ clear(): Promise<void>;
1527
+ getData(): Promise<DiscordPlayerQueryResultCache<Track>[]>;
1528
+ addData(data: SearchResult): Promise<void>;
1529
+ resolve(context: QueryCacheResolverContext): Promise<SearchResult>;
1530
+ }
1531
+ declare class DiscordPlayerQueryResultCache<T = unknown> {
1532
+ data: T;
1533
+ expireAfter: number;
1534
+ constructor(data: T, expireAfter?: number);
1535
+ hasExpired(): boolean;
1536
+ }
1537
+ interface QueryCacheResolverContext {
1538
+ query: string;
1539
+ requestedBy?: User;
1540
+ queryType?: SearchQueryType | `ext:${string}`;
1539
1541
  }
1540
1542
 
1541
- interface PlayerNodeInitializationResult<T = unknown> {
1542
- track: Track;
1543
- extractor: BaseExtractor | null;
1544
- searchResult: SearchResult;
1545
- queue: GuildQueue<T>;
1546
- }
1547
- declare class Player extends PlayerEventsEmitter<PlayerEvents> {
1548
- #private;
1549
- static _singletonKey: symbol;
1550
- readonly id: string;
1551
- readonly client: Client;
1552
- readonly options: PlayerInitOptions;
1553
- nodes: GuildNodeManager<unknown>;
1554
- readonly voiceUtils: VoiceUtils;
1555
- extractors: ExtractorExecutionContext;
1556
- events: PlayerEventsEmitter<GuildQueueEvents<unknown>>;
1557
- /**
1558
- * Creates new Discord Player
1559
- * @param {Client} client The Discord Client
1560
- * @param {PlayerInitOptions} [options] The player init options
1561
- */
1562
- constructor(client: Client, options?: PlayerInitOptions);
1563
- debug(m: string): boolean;
1564
- /**
1565
- * Creates discord-player singleton instance.
1566
- * @param client The client that instantiated player
1567
- * @param options Player initializer options
1568
- */
1569
- static singleton(client: Client, options?: PlayerInitOptions): Player;
1570
- /**
1571
- * Get all active master player instances
1572
- */
1573
- static getAllPlayers(): Player[];
1574
- /**
1575
- * Clear all master player instances
1576
- */
1577
- static clearAllPlayers(): void;
1578
- /**
1579
- * The current query cache provider in use
1580
- */
1581
- get queryCache(): QueryCache | null;
1582
- /**
1583
- * Alias to `Player.nodes`.
1584
- */
1585
- get queues(): GuildNodeManager<unknown>;
1586
- /**
1587
- * Event loop latency in ms. If your bot is laggy and this returns a number above 20ms for example,
1588
- * some expensive task is being executed on the current thread which is slowing down the event loop.
1589
- * @type {number}
1590
- */
1591
- get eventLoopLag(): number;
1592
- /**
1593
- * Generates statistics that could be useful. Statistics generator is still experimental.
1594
- * @example ```typescript
1595
- * const stats = player.generateStatistics();
1596
- *
1597
- * console.log(stats);
1598
- *
1599
- * // outputs something like
1600
- * // {
1601
- * // instances: number,
1602
- * // queuesCount: number,
1603
- * // queryCacheEnabled: boolean,
1604
- * // queues: [
1605
- * // GuildQueueStatisticsMetadata,
1606
- * // GuildQueueStatisticsMetadata,
1607
- * // GuildQueueStatisticsMetadata,
1608
- * // ...
1609
- * // ]
1610
- * // }
1611
- * ```
1612
- */
1613
- generateStatistics(): {
1614
- instances: number;
1615
- queuesCount: number;
1616
- queryCacheEnabled: boolean;
1617
- queues: GuildQueueStatisticsMetadata[];
1618
- };
1619
- /**
1620
- * Destroy every single queues managed by this master player instance
1621
- * @example ```typescript
1622
- * // use me when you want to immediately terminate every single queues in existence 🔪
1623
- * await player.destroy();
1624
- * ```
1625
- */
1626
- destroy(): Promise<void>;
1627
- private _handleVoiceState;
1628
- /**
1629
- * Handles voice state update
1630
- * @param {VoiceState} oldState The old voice state
1631
- * @param {VoiceState} newState The new voice state
1632
- * @returns {void}
1633
- * @example ```typescript
1634
- * // passing voice state update data to this method will trigger voice state handler
1635
- *
1636
- * client.on('voiceStateUpdate', (oldState, newState) => {
1637
- * // this is definitely a rocket science, right here
1638
- * player.handleVoiceState(oldState, newState);
1639
- * });
1640
- * ```
1641
- */
1642
- handleVoiceState(oldState: VoiceState, newState: VoiceState): void;
1643
- /**
1644
- * Lock voice state handler. When this method is called, discord-player will keep using the default voice state update handler, even if custom implementation exists.
1645
- */
1646
- lockVoiceStateHandler(): void;
1647
- /**
1648
- * Unlock voice state handler. When this method is called, discord-player will stop using the default voice state update handler if custom implementation exists.
1649
- */
1650
- unlockVoiceStateHandler(): void;
1651
- /**
1652
- * Checks if voice state handler is locked.
1653
- */
1654
- isVoiceStateHandlerLocked(): boolean;
1655
- /**
1656
- * Initiate audio player
1657
- * @param channel The voice channel on which the music should be played
1658
- * @param query The track or source to play
1659
- * @param options Options for player
1660
- * @example ```typescript
1661
- * // no need to worry about queue management, just use this method 😄
1662
- * const query = 'this is my super cool search query that I want to play';
1663
- *
1664
- * try {
1665
- * const { track } = await player.play(voiceChannel, query);
1666
- * console.log(`🎉 I am playing ${track.title} 🎉`);
1667
- * } catch(e) {
1668
- * console.log(`😭 Failed to play error oh no:\n\n${e}`);
1669
- * }
1670
- * ```
1671
- */
1672
- play<T = unknown>(channel: GuildVoiceChannelResolvable, query: string | Track | SearchResult | Track[] | Playlist, options?: SearchOptions & {
1673
- nodeOptions?: GuildNodeCreateOptions<T>;
1674
- connectionOptions?: VoiceConnectConfig;
1675
- afterSearch?: (result: SearchResult) => Promise<SearchResult>;
1676
- }): Promise<PlayerNodeInitializationResult<T>>;
1677
- /**
1678
- * Search tracks
1679
- * @param {string | Track | Track[] | Playlist | SearchResult} query The search query
1680
- * @param {SearchOptions} options The search options
1681
- * @returns {Promise<SearchResult>}
1682
- * @example ```typescript
1683
- * const searchQuery = 'pass url or text or discord-player track constructable objects, we got you covered 😎';
1684
- * const result = await player.search(searchQuery);
1685
- *
1686
- * console.log(result); // Logs `SearchResult` object
1687
- * ```
1688
- */
1689
- search(query: string | Track | Track[] | Playlist | SearchResult, options?: SearchOptions): Promise<SearchResult>;
1690
- /**
1691
- * Generates a report of the dependencies used by the `@discordjs/voice` module. Useful for debugging.
1692
- * @example ```typescript
1693
- * console.log(player.scanDeps());
1694
- * // -> logs dependencies report
1695
- * ```
1696
- * @returns {string}
1697
- */
1698
- scanDeps(): string;
1699
- [Symbol.iterator](): Generator<GuildQueue<unknown>, void, undefined>;
1700
- /**
1701
- * Creates `Playlist` instance
1702
- * @param data The data to initialize a playlist
1703
- */
1704
- createPlaylist(data: PlaylistInitData): Playlist;
1543
+ interface PlayerNodeInitializationResult<T = unknown> {
1544
+ track: Track;
1545
+ extractor: BaseExtractor | null;
1546
+ searchResult: SearchResult;
1547
+ queue: GuildQueue<T>;
1548
+ }
1549
+ declare class Player extends PlayerEventsEmitter<PlayerEvents> {
1550
+ #private;
1551
+ static readonly version: string;
1552
+ static _singletonKey: symbol;
1553
+ readonly id: string;
1554
+ readonly client: Client;
1555
+ readonly options: PlayerInitOptions;
1556
+ nodes: GuildNodeManager<unknown>;
1557
+ readonly voiceUtils: VoiceUtils;
1558
+ extractors: ExtractorExecutionContext;
1559
+ events: PlayerEventsEmitter<GuildQueueEvents<unknown>>;
1560
+ /**
1561
+ * Creates new Discord Player
1562
+ * @param {Client} client The Discord Client
1563
+ * @param {PlayerInitOptions} [options] The player init options
1564
+ */
1565
+ constructor(client: Client, options?: PlayerInitOptions);
1566
+ debug(m: string): boolean;
1567
+ /**
1568
+ * Creates discord-player singleton instance.
1569
+ * @param client The client that instantiated player
1570
+ * @param options Player initializer options
1571
+ */
1572
+ static singleton(client: Client, options?: PlayerInitOptions): Player;
1573
+ /**
1574
+ * Get all active master player instances
1575
+ */
1576
+ static getAllPlayers(): Player[];
1577
+ /**
1578
+ * Clear all master player instances
1579
+ */
1580
+ static clearAllPlayers(): void;
1581
+ /**
1582
+ * The current query cache provider in use
1583
+ */
1584
+ get queryCache(): QueryCache | null;
1585
+ /**
1586
+ * Alias to `Player.nodes`.
1587
+ */
1588
+ get queues(): GuildNodeManager<unknown>;
1589
+ /**
1590
+ * Event loop latency in ms. If your bot is laggy and this returns a number above 20ms for example,
1591
+ * some expensive task is being executed on the current thread which is slowing down the event loop.
1592
+ * @type {number}
1593
+ */
1594
+ get eventLoopLag(): number;
1595
+ /**
1596
+ * Generates statistics that could be useful. Statistics generator is still experimental.
1597
+ * @example ```typescript
1598
+ * const stats = player.generateStatistics();
1599
+ *
1600
+ * console.log(stats);
1601
+ *
1602
+ * // outputs something like
1603
+ * // {
1604
+ * // instances: number,
1605
+ * // queuesCount: number,
1606
+ * // queryCacheEnabled: boolean,
1607
+ * // queues: [
1608
+ * // GuildQueueStatisticsMetadata,
1609
+ * // GuildQueueStatisticsMetadata,
1610
+ * // GuildQueueStatisticsMetadata,
1611
+ * // ...
1612
+ * // ]
1613
+ * // }
1614
+ * ```
1615
+ */
1616
+ generateStatistics(): {
1617
+ instances: number;
1618
+ queuesCount: number;
1619
+ queryCacheEnabled: boolean;
1620
+ queues: GuildQueueStatisticsMetadata[];
1621
+ };
1622
+ /**
1623
+ * Destroy every single queues managed by this master player instance
1624
+ * @example ```typescript
1625
+ * // use me when you want to immediately terminate every single queues in existence 🔪
1626
+ * await player.destroy();
1627
+ * ```
1628
+ */
1629
+ destroy(): Promise<void>;
1630
+ private _handleVoiceState;
1631
+ /**
1632
+ * Handles voice state update
1633
+ * @param {VoiceState} oldState The old voice state
1634
+ * @param {VoiceState} newState The new voice state
1635
+ * @returns {void}
1636
+ * @example ```typescript
1637
+ * // passing voice state update data to this method will trigger voice state handler
1638
+ *
1639
+ * client.on('voiceStateUpdate', (oldState, newState) => {
1640
+ * // this is definitely a rocket science, right here
1641
+ * player.handleVoiceState(oldState, newState);
1642
+ * });
1643
+ * ```
1644
+ */
1645
+ handleVoiceState(oldState: VoiceState, newState: VoiceState): void;
1646
+ /**
1647
+ * Lock voice state handler. When this method is called, discord-player will keep using the default voice state update handler, even if custom implementation exists.
1648
+ */
1649
+ lockVoiceStateHandler(): void;
1650
+ /**
1651
+ * Unlock voice state handler. When this method is called, discord-player will stop using the default voice state update handler if custom implementation exists.
1652
+ */
1653
+ unlockVoiceStateHandler(): void;
1654
+ /**
1655
+ * Checks if voice state handler is locked.
1656
+ */
1657
+ isVoiceStateHandlerLocked(): boolean;
1658
+ /**
1659
+ * Initiate audio player
1660
+ * @param channel The voice channel on which the music should be played
1661
+ * @param query The track or source to play
1662
+ * @param options Options for player
1663
+ * @example ```typescript
1664
+ * // no need to worry about queue management, just use this method 😄
1665
+ * const query = 'this is my super cool search query that I want to play';
1666
+ *
1667
+ * try {
1668
+ * const { track } = await player.play(voiceChannel, query);
1669
+ * console.log(`🎉 I am playing ${track.title} 🎉`);
1670
+ * } catch(e) {
1671
+ * console.log(`😭 Failed to play error oh no:\n\n${e}`);
1672
+ * }
1673
+ * ```
1674
+ */
1675
+ play<T = unknown>(channel: GuildVoiceChannelResolvable, query: string | Track | SearchResult | Track[] | Playlist, options?: SearchOptions & {
1676
+ nodeOptions?: GuildNodeCreateOptions<T>;
1677
+ connectionOptions?: VoiceConnectConfig;
1678
+ afterSearch?: (result: SearchResult) => Promise<SearchResult>;
1679
+ }): Promise<PlayerNodeInitializationResult<T>>;
1680
+ /**
1681
+ * Search tracks
1682
+ * @param {string | Track | Track[] | Playlist | SearchResult} query The search query
1683
+ * @param {SearchOptions} options The search options
1684
+ * @returns {Promise<SearchResult>}
1685
+ * @example ```typescript
1686
+ * const searchQuery = 'pass url or text or discord-player track constructable objects, we got you covered 😎';
1687
+ * const result = await player.search(searchQuery);
1688
+ *
1689
+ * console.log(result); // Logs `SearchResult` object
1690
+ * ```
1691
+ */
1692
+ search(query: string | Track | Track[] | Playlist | SearchResult, options?: SearchOptions): Promise<SearchResult>;
1693
+ /**
1694
+ * Generates a report of the dependencies used by the `@discordjs/voice` module. Useful for debugging.
1695
+ * @example ```typescript
1696
+ * console.log(player.scanDeps());
1697
+ * // -> logs dependencies report
1698
+ * ```
1699
+ * @returns {string}
1700
+ */
1701
+ scanDeps(): string;
1702
+ [Symbol.iterator](): Generator<GuildQueue<unknown>, void, undefined>;
1703
+ /**
1704
+ * Creates `Playlist` instance
1705
+ * @param data The data to initialize a playlist
1706
+ */
1707
+ createPlaylist(data: PlaylistInitData): Playlist;
1705
1708
  }
1706
1709
 
1707
- interface GuildNodeCreateOptions<T = unknown> {
1708
- strategy?: QueueStrategy;
1709
- volume?: number | boolean;
1710
- equalizer?: EqualizerBand[] | boolean;
1711
- a_filter?: PCMFilters[] | boolean;
1712
- biquad?: BiquadFilters | boolean;
1713
- resampler?: number | boolean;
1714
- disableHistory?: boolean;
1715
- skipOnNoStream?: boolean;
1716
- onBeforeCreateStream?: OnBeforeCreateStreamHandler;
1717
- onAfterCreateStream?: OnAfterCreateStreamHandler;
1718
- repeatMode?: QueueRepeatMode;
1719
- leaveOnEmpty?: boolean;
1720
- leaveOnEmptyCooldown?: number;
1721
- leaveOnEnd?: boolean;
1722
- leaveOnEndCooldown?: number;
1723
- leaveOnStop?: boolean;
1724
- leaveOnStopCooldown?: number;
1725
- metadata?: T | null;
1726
- selfDeaf?: boolean;
1727
- connectionTimeout?: number;
1728
- defaultFFmpegFilters?: FiltersName[];
1729
- bufferingTimeout?: number;
1730
- noEmitInsert?: boolean;
1731
- }
1732
- type NodeResolvable = GuildQueue | GuildResolvable;
1733
- declare class GuildNodeManager<Meta = unknown> {
1734
- player: Player;
1735
- cache: Collection<string, GuildQueue<unknown>>;
1736
- constructor(player: Player);
1737
- /**
1738
- * Create guild queue if it does not exist
1739
- * @param guild The guild which will be the owner of the queue
1740
- * @param options Queue initializer options
1741
- */
1742
- create<T = Meta>(guild: GuildResolvable, options?: GuildNodeCreateOptions<T>): GuildQueue<T>;
1743
- /**
1744
- * Get existing queue
1745
- * @param node Queue resolvable
1746
- */
1747
- get<T = Meta>(node: NodeResolvable): GuildQueue<T> | null;
1748
- /**
1749
- * Check if a queue exists
1750
- * @param node Queue resolvable
1751
- */
1752
- has(node: NodeResolvable): boolean;
1753
- /**
1754
- * Delete queue
1755
- * @param node Queue resolvable
1756
- */
1757
- delete(node: NodeResolvable): boolean;
1758
- /**
1759
- * Resolve queue
1760
- * @param node Queue resolvable
1761
- */
1762
- resolve<T = Meta>(node: NodeResolvable): GuildQueue<unknown> | undefined;
1763
- /**
1764
- * Resolve queue id
1765
- * @param node Queue resolvable
1766
- */
1767
- resolveId(node: NodeResolvable): string | null;
1710
+ interface GuildNodeCreateOptions<T = unknown> {
1711
+ strategy?: QueueStrategy;
1712
+ volume?: number | boolean;
1713
+ equalizer?: EqualizerBand[] | boolean;
1714
+ a_filter?: PCMFilters[] | boolean;
1715
+ biquad?: BiquadFilters | boolean;
1716
+ resampler?: number | boolean;
1717
+ disableHistory?: boolean;
1718
+ skipOnNoStream?: boolean;
1719
+ onBeforeCreateStream?: OnBeforeCreateStreamHandler;
1720
+ onAfterCreateStream?: OnAfterCreateStreamHandler;
1721
+ repeatMode?: QueueRepeatMode;
1722
+ leaveOnEmpty?: boolean;
1723
+ leaveOnEmptyCooldown?: number;
1724
+ leaveOnEnd?: boolean;
1725
+ leaveOnEndCooldown?: number;
1726
+ leaveOnStop?: boolean;
1727
+ leaveOnStopCooldown?: number;
1728
+ metadata?: T | null;
1729
+ selfDeaf?: boolean;
1730
+ connectionTimeout?: number;
1731
+ defaultFFmpegFilters?: FiltersName[];
1732
+ bufferingTimeout?: number;
1733
+ noEmitInsert?: boolean;
1734
+ }
1735
+ type NodeResolvable = GuildQueue | GuildResolvable;
1736
+ declare class GuildNodeManager<Meta = unknown> {
1737
+ player: Player;
1738
+ cache: Collection<string, GuildQueue<unknown>>;
1739
+ constructor(player: Player);
1740
+ /**
1741
+ * Create guild queue if it does not exist
1742
+ * @param guild The guild which will be the owner of the queue
1743
+ * @param options Queue initializer options
1744
+ */
1745
+ create<T = Meta>(guild: GuildResolvable, options?: GuildNodeCreateOptions<T>): GuildQueue<T>;
1746
+ /**
1747
+ * Get existing queue
1748
+ * @param node Queue resolvable
1749
+ */
1750
+ get<T = Meta>(node: NodeResolvable): GuildQueue<T> | null;
1751
+ /**
1752
+ * Check if a queue exists
1753
+ * @param node Queue resolvable
1754
+ */
1755
+ has(node: NodeResolvable): boolean;
1756
+ /**
1757
+ * Delete queue
1758
+ * @param node Queue resolvable
1759
+ */
1760
+ delete(node: NodeResolvable): boolean;
1761
+ /**
1762
+ * Resolve queue
1763
+ * @param node Queue resolvable
1764
+ */
1765
+ resolve<T = Meta>(node: NodeResolvable): GuildQueue<unknown> | undefined;
1766
+ /**
1767
+ * Resolve queue id
1768
+ * @param node Queue resolvable
1769
+ */
1770
+ resolveId(node: NodeResolvable): string | null;
1768
1771
  }
1769
1772
 
1770
- declare enum ErrorStatusCode {
1771
- STREAM_ERROR = "StreamError",
1772
- AUDIO_PLAYER_ERROR = "AudioPlayerError",
1773
- PLAYER_ERROR = "PlayerError",
1774
- NO_AUDIO_RESOURCE = "NoAudioResource",
1775
- UNKNOWN_GUILD = "UnknownGuild",
1776
- INVALID_ARG_TYPE = "InvalidArgType",
1777
- UNKNOWN_EXTRACTOR = "UnknownExtractor",
1778
- INVALID_EXTRACTOR = "InvalidExtractor",
1779
- INVALID_CHANNEL_TYPE = "InvalidChannelType",
1780
- INVALID_TRACK = "InvalidTrack",
1781
- UNKNOWN_REPEAT_MODE = "UnknownRepeatMode",
1782
- TRACK_NOT_FOUND = "TrackNotFound",
1783
- NO_CONNECTION = "NoConnection",
1784
- DESTROYED_QUEUE = "DestroyedQueue"
1785
- }
1786
- declare class PlayerError extends Error {
1787
- message: string;
1788
- statusCode: ErrorStatusCode;
1789
- createdAt: Date;
1790
- constructor(message: string, code?: ErrorStatusCode);
1791
- get createdTimestamp(): number;
1792
- valueOf(): ErrorStatusCode;
1793
- toJSON(): {
1794
- stack: string | undefined;
1795
- code: ErrorStatusCode;
1796
- message: string;
1797
- created: number;
1798
- };
1799
- toString(): string | undefined;
1773
+ declare enum ErrorStatusCode {
1774
+ STREAM_ERROR = "StreamError",
1775
+ AUDIO_PLAYER_ERROR = "AudioPlayerError",
1776
+ PLAYER_ERROR = "PlayerError",
1777
+ NO_AUDIO_RESOURCE = "NoAudioResource",
1778
+ UNKNOWN_GUILD = "UnknownGuild",
1779
+ INVALID_ARG_TYPE = "InvalidArgType",
1780
+ UNKNOWN_EXTRACTOR = "UnknownExtractor",
1781
+ INVALID_EXTRACTOR = "InvalidExtractor",
1782
+ INVALID_CHANNEL_TYPE = "InvalidChannelType",
1783
+ INVALID_TRACK = "InvalidTrack",
1784
+ UNKNOWN_REPEAT_MODE = "UnknownRepeatMode",
1785
+ TRACK_NOT_FOUND = "TrackNotFound",
1786
+ NO_CONNECTION = "NoConnection",
1787
+ DESTROYED_QUEUE = "DestroyedQueue"
1788
+ }
1789
+ declare class PlayerError extends Error {
1790
+ message: string;
1791
+ statusCode: ErrorStatusCode;
1792
+ createdAt: Date;
1793
+ constructor(message: string, code?: ErrorStatusCode);
1794
+ get createdTimestamp(): number;
1795
+ valueOf(): ErrorStatusCode;
1796
+ toJSON(): {
1797
+ stack: string | undefined;
1798
+ code: ErrorStatusCode;
1799
+ message: string;
1800
+ created: number;
1801
+ };
1802
+ toString(): string | undefined;
1800
1803
  }
1801
1804
 
1802
- type FiltersName = keyof QueueFilters;
1803
- interface PlayerSearchResult {
1804
- playlist: Playlist | null;
1805
- tracks: Track[];
1806
- }
1807
- /**
1808
- * @typedef {AudioFilters} QueueFilters
1809
- */
1810
- interface QueueFilters {
1811
- bassboost_low?: boolean;
1812
- bassboost?: boolean;
1813
- bassboost_high?: boolean;
1814
- '8D'?: boolean;
1815
- vaporwave?: boolean;
1816
- nightcore?: boolean;
1817
- phaser?: boolean;
1818
- tremolo?: boolean;
1819
- vibrato?: boolean;
1820
- reverse?: boolean;
1821
- treble?: boolean;
1822
- normalizer?: boolean;
1823
- normalizer2?: boolean;
1824
- surrounding?: boolean;
1825
- pulsator?: boolean;
1826
- subboost?: boolean;
1827
- karaoke?: boolean;
1828
- flanger?: boolean;
1829
- gate?: boolean;
1830
- haas?: boolean;
1831
- mcompand?: boolean;
1832
- mono?: boolean;
1833
- mstlr?: boolean;
1834
- mstrr?: boolean;
1835
- compressor?: boolean;
1836
- expander?: boolean;
1837
- softlimiter?: boolean;
1838
- chorus?: boolean;
1839
- chorus2d?: boolean;
1840
- chorus3d?: boolean;
1841
- fadein?: boolean;
1842
- dim?: boolean;
1843
- earrape?: boolean;
1844
- lofi?: boolean;
1845
- }
1846
- /**
1847
- * The track source:
1848
- * - soundcloud
1849
- * - youtube
1850
- * - spotify
1851
- * - apple_music
1852
- * - arbitrary
1853
- * @typedef {string} TrackSource
1854
- */
1855
- type TrackSource = 'soundcloud' | 'youtube' | 'spotify' | 'apple_music' | 'arbitrary';
1856
- /**
1857
- * @typedef {object} RawTrackData
1858
- * @property {string} title The title
1859
- * @property {string} description The description
1860
- * @property {string} author The author
1861
- * @property {string} url The url
1862
- * @property {string} thumbnail The thumbnail
1863
- * @property {string} duration The duration
1864
- * @property {number} views The views
1865
- * @property {User} requestedBy The user who requested this track
1866
- * @property {Playlist} [playlist] The playlist
1867
- * @property {TrackSource} [source="arbitrary"] The source
1868
- * @property {any} [engine] The engine
1869
- * @property {boolean} [live] If this track is live
1870
- * @property {any} [raw] The raw data
1871
- */
1872
- interface RawTrackData {
1873
- title: string;
1874
- description: string;
1875
- author: string;
1876
- url: string;
1877
- thumbnail: string;
1878
- duration: string;
1879
- views: number;
1880
- requestedBy?: User | null;
1881
- playlist?: Playlist;
1882
- source?: TrackSource;
1883
- engine?: any;
1884
- live?: boolean;
1885
- raw?: any;
1886
- queryType?: SearchQueryType;
1887
- }
1888
- /**
1889
- * @typedef {object} TimeData
1890
- * @property {number} days Time in days
1891
- * @property {number} hours Time in hours
1892
- * @property {number} minutes Time in minutes
1893
- * @property {number} seconds Time in seconds
1894
- */
1895
- interface TimeData {
1896
- days: number;
1897
- hours: number;
1898
- minutes: number;
1899
- seconds: number;
1900
- }
1901
- /**
1902
- * @typedef {object} PlayerProgressbarOptions
1903
- * @property {boolean} [timecodes] If it should render time codes
1904
- * @property {boolean} [queue] If it should create progress bar for the whole queue
1905
- * @property {number} [length] The bar length
1906
- * @property {string} [line] The bar track
1907
- * @property {string} [indicator] The indicator
1908
- */
1909
- interface PlayerProgressbarOptions {
1910
- timecodes?: boolean;
1911
- length?: number;
1912
- line?: string;
1913
- indicator?: string;
1914
- queue?: boolean;
1915
- }
1916
- /**
1917
- * The search query type
1918
- * This can be one of:
1919
- * - AUTO
1920
- * - YOUTUBE
1921
- * - YOUTUBE_PLAYLIST
1922
- * - SOUNDCLOUD_TRACK
1923
- * - SOUNDCLOUD_PLAYLIST
1924
- * - SOUNDCLOUD
1925
- * - SPOTIFY_SONG
1926
- * - SPOTIFY_ALBUM
1927
- * - SPOTIFY_PLAYLIST
1928
- * - SPOTIFY_SEARCH
1929
- * - FACEBOOK
1930
- * - VIMEO
1931
- * - ARBITRARY
1932
- * - REVERBNATION
1933
- * - YOUTUBE_SEARCH
1934
- * - YOUTUBE_VIDEO
1935
- * - SOUNDCLOUD_SEARCH
1936
- * - APPLE_MUSIC_SONG
1937
- * - APPLE_MUSIC_ALBUM
1938
- * - APPLE_MUSIC_PLAYLIST
1939
- * - APPLE_MUSIC_SEARCH
1940
- * - FILE
1941
- * - AUTO_SEARCH
1942
- * @typedef {string} QueryType
1943
- */
1944
- declare const QueryType: {
1945
- readonly AUTO: "auto";
1946
- readonly YOUTUBE: "youtube";
1947
- readonly YOUTUBE_PLAYLIST: "youtubePlaylist";
1948
- readonly SOUNDCLOUD_TRACK: "soundcloudTrack";
1949
- readonly SOUNDCLOUD_PLAYLIST: "soundcloudPlaylist";
1950
- readonly SOUNDCLOUD: "soundcloud";
1951
- readonly SPOTIFY_SONG: "spotifySong";
1952
- readonly SPOTIFY_ALBUM: "spotifyAlbum";
1953
- readonly SPOTIFY_PLAYLIST: "spotifyPlaylist";
1954
- readonly SPOTIFY_SEARCH: "spotifySearch";
1955
- readonly FACEBOOK: "facebook";
1956
- readonly VIMEO: "vimeo";
1957
- readonly ARBITRARY: "arbitrary";
1958
- readonly REVERBNATION: "reverbnation";
1959
- readonly YOUTUBE_SEARCH: "youtubeSearch";
1960
- readonly YOUTUBE_VIDEO: "youtubeVideo";
1961
- readonly SOUNDCLOUD_SEARCH: "soundcloudSearch";
1962
- readonly APPLE_MUSIC_SONG: "appleMusicSong";
1963
- readonly APPLE_MUSIC_ALBUM: "appleMusicAlbum";
1964
- readonly APPLE_MUSIC_PLAYLIST: "appleMusicPlaylist";
1965
- readonly APPLE_MUSIC_SEARCH: "appleMusicSearch";
1966
- readonly FILE: "file";
1967
- readonly AUTO_SEARCH: "autoSearch";
1968
- };
1969
- type SearchQueryType = keyof typeof QueryType | (typeof QueryType)[keyof typeof QueryType];
1970
- interface PlayerEvents {
1971
- debug: (message: string) => any;
1972
- error: (error: Error) => any;
1973
- voiceStateUpdate: (queue: GuildQueue, oldState: VoiceState, newState: VoiceState) => any;
1974
- }
1975
- declare enum PlayerEvent {
1976
- debug = "debug",
1977
- error = "error",
1978
- voiceStateUpdate = "voiceStateUpdate"
1979
- }
1980
- /**
1981
- * @typedef {object} PlayOptions
1982
- * @property {boolean} [filtersUpdate=false] If this play was triggered for filters update
1983
- * @property {string[]} [encoderArgs=[]] FFmpeg args passed to encoder
1984
- * @property {number} [seek] Time to seek to before playing
1985
- * @property {boolean} [immediate=false] If it should start playing the provided track immediately
1986
- */
1987
- interface PlayOptions {
1988
- filtersUpdate?: boolean;
1989
- encoderArgs?: string[];
1990
- seek?: number;
1991
- immediate?: boolean;
1992
- }
1993
- type QueryExtractorSearch = `ext:${string}`;
1994
- /**
1995
- * @typedef {object} SearchOptions
1996
- * @property {UserResolvable} requestedBy The user who requested this search
1997
- * @property {typeof QueryType|string} [searchEngine='auto'] The query search engine, can be extractor name to target specific one (custom)
1998
- * @property {string[]} [blockExtractors[]] List of the extractors to block
1999
- * @property {boolean} [ignoreCache] If it should ignore query cache lookup
2000
- * @property {SearchQueryType} [fallbackSearchEngine='autoSearch'] Fallback search engine to use
2001
- */
2002
- interface SearchOptions {
2003
- requestedBy?: UserResolvable;
2004
- searchEngine?: SearchQueryType | QueryExtractorSearch;
2005
- blockExtractors?: string[];
2006
- ignoreCache?: boolean;
2007
- fallbackSearchEngine?: (typeof QueryType)[keyof typeof QueryType];
2008
- }
2009
- /**
2010
- * The queue repeat mode. This can be one of:
2011
- * - OFF
2012
- * - TRACK
2013
- * - QUEUE
2014
- * - AUTOPLAY
2015
- * @typedef {number} QueueRepeatMode
2016
- */
2017
- declare enum QueueRepeatMode {
2018
- OFF = 0,
2019
- TRACK = 1,
2020
- QUEUE = 2,
2021
- AUTOPLAY = 3
2022
- }
2023
- /**
2024
- * @typedef {object} PlaylistInitData
2025
- * @property {Track[]} tracks The tracks of this playlist
2026
- * @property {string} title The playlist title
2027
- * @property {string} description The description
2028
- * @property {string} thumbnail The thumbnail
2029
- * @property {album|playlist} type The playlist type: `album` | `playlist`
2030
- * @property {TrackSource} source The playlist source
2031
- * @property {object} author The playlist author
2032
- * @property {string} [author.name] The author name
2033
- * @property {string} [author.url] The author url
2034
- * @property {string} id The playlist id
2035
- * @property {string} url The playlist url
2036
- * @property {any} [rawPlaylist] The raw playlist data
2037
- */
2038
- interface PlaylistInitData {
2039
- tracks: Track[];
2040
- title: string;
2041
- description: string;
2042
- thumbnail: string;
2043
- type: 'album' | 'playlist';
2044
- source: TrackSource;
2045
- author: {
2046
- name: string;
2047
- url: string;
2048
- };
2049
- id: string;
2050
- url: string;
2051
- rawPlaylist?: any;
2052
- }
2053
- /**
2054
- * @typedef {object} TrackJSON
2055
- * @property {string} title The track title
2056
- * @property {string} description The track description
2057
- * @property {string} author The author
2058
- * @property {string} url The url
2059
- * @property {string} thumbnail The thumbnail
2060
- * @property {string} duration The duration
2061
- * @property {number} durationMS The duration in ms
2062
- * @property {number} views The views count
2063
- * @property {Snowflake} requestedBy The id of the user who requested this track
2064
- * @property {PlaylistJSON} [playlist] The playlist info (if any)
2065
- */
2066
- interface TrackJSON {
2067
- id: Snowflake;
2068
- title: string;
2069
- description: string;
2070
- author: string;
2071
- url: string;
2072
- thumbnail: string;
2073
- duration: string;
2074
- durationMS: number;
2075
- views: number;
2076
- requestedBy: Snowflake;
2077
- playlist?: PlaylistJSON;
2078
- }
2079
- /**
2080
- * @typedef {object} PlaylistJSON
2081
- * @property {string} id The playlist id
2082
- * @property {string} url The playlist url
2083
- * @property {string} title The playlist title
2084
- * @property {string} description The playlist description
2085
- * @property {string} thumbnail The thumbnail
2086
- * @property {album|playlist} type The playlist type: `album` | `playlist`
2087
- * @property {TrackSource} source The track source
2088
- * @property {object} author The playlist author
2089
- * @property {string} [author.name] The author name
2090
- * @property {string} [author.url] The author url
2091
- * @property {TrackJSON[]} tracks The tracks data (if any)
2092
- */
2093
- interface PlaylistJSON {
2094
- id: string;
2095
- url: string;
2096
- title: string;
2097
- description: string;
2098
- thumbnail: string;
2099
- type: 'album' | 'playlist';
2100
- source: TrackSource;
2101
- author: {
2102
- name: string;
2103
- url: string;
2104
- };
2105
- tracks: TrackJSON[];
2106
- }
2107
- /**
2108
- * @typedef {object} PlayerInitOptions
2109
- * @property {boolean} [autoRegisterExtractor=true] If it should automatically register `@discord-player/extractor`
2110
- * @property {YTDLDownloadOptions} [ytdlOptions] The options passed to `ytdl-core`
2111
- * @property {number} [connectionTimeout=20000] The voice connection timeout
2112
- * @property {boolean} [smoothVolume=true] Toggle smooth volume transition
2113
- * @property {boolean} [lagMonitor=30000] Time in ms to re-monitor event loop lag
2114
- * @property {boolean} [lockVoiceStateHandler] Prevent voice state handler from being overridden
2115
- * @property {string[]} [blockExtractors] List of extractors to disable querying metadata from
2116
- * @property {string[]} [blockStreamFrom] List of extractors to disable streaming from
2117
- * @property {QueryCache | null} [queryCache] Query cache provider
2118
- * @property {boolean} [ignoreInstance] Ignore player instance
2119
- */
2120
- interface PlayerInitOptions {
2121
- autoRegisterExtractor?: boolean;
2122
- ytdlOptions?: downloadOptions;
2123
- connectionTimeout?: number;
2124
- smoothVolume?: boolean;
2125
- lagMonitor?: number;
2126
- lockVoiceStateHandler?: boolean;
2127
- blockExtractors?: string[];
2128
- blockStreamFrom?: string[];
2129
- queryCache?: QueryCache | null;
2130
- ignoreInstance?: boolean;
1805
+ type FiltersName = keyof QueueFilters;
1806
+ interface PlayerSearchResult {
1807
+ playlist: Playlist | null;
1808
+ tracks: Track[];
1809
+ }
1810
+ /**
1811
+ * @typedef {AudioFilters} QueueFilters
1812
+ */
1813
+ interface QueueFilters {
1814
+ bassboost_low?: boolean;
1815
+ bassboost?: boolean;
1816
+ bassboost_high?: boolean;
1817
+ '8D'?: boolean;
1818
+ vaporwave?: boolean;
1819
+ nightcore?: boolean;
1820
+ phaser?: boolean;
1821
+ tremolo?: boolean;
1822
+ vibrato?: boolean;
1823
+ reverse?: boolean;
1824
+ treble?: boolean;
1825
+ normalizer?: boolean;
1826
+ normalizer2?: boolean;
1827
+ surrounding?: boolean;
1828
+ pulsator?: boolean;
1829
+ subboost?: boolean;
1830
+ karaoke?: boolean;
1831
+ flanger?: boolean;
1832
+ gate?: boolean;
1833
+ haas?: boolean;
1834
+ mcompand?: boolean;
1835
+ mono?: boolean;
1836
+ mstlr?: boolean;
1837
+ mstrr?: boolean;
1838
+ compressor?: boolean;
1839
+ expander?: boolean;
1840
+ softlimiter?: boolean;
1841
+ chorus?: boolean;
1842
+ chorus2d?: boolean;
1843
+ chorus3d?: boolean;
1844
+ fadein?: boolean;
1845
+ dim?: boolean;
1846
+ earrape?: boolean;
1847
+ lofi?: boolean;
1848
+ }
1849
+ /**
1850
+ * The track source:
1851
+ * - soundcloud
1852
+ * - youtube
1853
+ * - spotify
1854
+ * - apple_music
1855
+ * - arbitrary
1856
+ * @typedef {string} TrackSource
1857
+ */
1858
+ type TrackSource = 'soundcloud' | 'youtube' | 'spotify' | 'apple_music' | 'arbitrary';
1859
+ /**
1860
+ * @typedef {object} RawTrackData
1861
+ * @property {string} title The title
1862
+ * @property {string} description The description
1863
+ * @property {string} author The author
1864
+ * @property {string} url The url
1865
+ * @property {string} thumbnail The thumbnail
1866
+ * @property {string} duration The duration
1867
+ * @property {number} views The views
1868
+ * @property {User} requestedBy The user who requested this track
1869
+ * @property {Playlist} [playlist] The playlist
1870
+ * @property {TrackSource} [source="arbitrary"] The source
1871
+ * @property {any} [engine] The engine
1872
+ * @property {boolean} [live] If this track is live
1873
+ * @property {any} [raw] The raw data
1874
+ */
1875
+ interface RawTrackData {
1876
+ title: string;
1877
+ description: string;
1878
+ author: string;
1879
+ url: string;
1880
+ thumbnail: string;
1881
+ duration: string;
1882
+ views: number;
1883
+ requestedBy?: User | null;
1884
+ playlist?: Playlist;
1885
+ source?: TrackSource;
1886
+ engine?: any;
1887
+ live?: boolean;
1888
+ raw?: any;
1889
+ queryType?: SearchQueryType;
1890
+ }
1891
+ /**
1892
+ * @typedef {object} TimeData
1893
+ * @property {number} days Time in days
1894
+ * @property {number} hours Time in hours
1895
+ * @property {number} minutes Time in minutes
1896
+ * @property {number} seconds Time in seconds
1897
+ */
1898
+ interface TimeData {
1899
+ days: number;
1900
+ hours: number;
1901
+ minutes: number;
1902
+ seconds: number;
1903
+ }
1904
+ /**
1905
+ * @typedef {object} PlayerProgressbarOptions
1906
+ * @property {boolean} [timecodes] If it should render time codes
1907
+ * @property {boolean} [queue] If it should create progress bar for the whole queue
1908
+ * @property {number} [length] The bar length
1909
+ * @property {string} [line] The bar track
1910
+ * @property {string} [indicator] The indicator
1911
+ */
1912
+ interface PlayerProgressbarOptions {
1913
+ timecodes?: boolean;
1914
+ length?: number;
1915
+ line?: string;
1916
+ indicator?: string;
1917
+ queue?: boolean;
1918
+ }
1919
+ /**
1920
+ * The search query type
1921
+ * This can be one of:
1922
+ * - AUTO
1923
+ * - YOUTUBE
1924
+ * - YOUTUBE_PLAYLIST
1925
+ * - SOUNDCLOUD_TRACK
1926
+ * - SOUNDCLOUD_PLAYLIST
1927
+ * - SOUNDCLOUD
1928
+ * - SPOTIFY_SONG
1929
+ * - SPOTIFY_ALBUM
1930
+ * - SPOTIFY_PLAYLIST
1931
+ * - SPOTIFY_SEARCH
1932
+ * - FACEBOOK
1933
+ * - VIMEO
1934
+ * - ARBITRARY
1935
+ * - REVERBNATION
1936
+ * - YOUTUBE_SEARCH
1937
+ * - YOUTUBE_VIDEO
1938
+ * - SOUNDCLOUD_SEARCH
1939
+ * - APPLE_MUSIC_SONG
1940
+ * - APPLE_MUSIC_ALBUM
1941
+ * - APPLE_MUSIC_PLAYLIST
1942
+ * - APPLE_MUSIC_SEARCH
1943
+ * - FILE
1944
+ * - AUTO_SEARCH
1945
+ * @typedef {string} QueryType
1946
+ */
1947
+ declare const QueryType: {
1948
+ readonly AUTO: "auto";
1949
+ readonly YOUTUBE: "youtube";
1950
+ readonly YOUTUBE_PLAYLIST: "youtubePlaylist";
1951
+ readonly SOUNDCLOUD_TRACK: "soundcloudTrack";
1952
+ readonly SOUNDCLOUD_PLAYLIST: "soundcloudPlaylist";
1953
+ readonly SOUNDCLOUD: "soundcloud";
1954
+ readonly SPOTIFY_SONG: "spotifySong";
1955
+ readonly SPOTIFY_ALBUM: "spotifyAlbum";
1956
+ readonly SPOTIFY_PLAYLIST: "spotifyPlaylist";
1957
+ readonly SPOTIFY_SEARCH: "spotifySearch";
1958
+ readonly FACEBOOK: "facebook";
1959
+ readonly VIMEO: "vimeo";
1960
+ readonly ARBITRARY: "arbitrary";
1961
+ readonly REVERBNATION: "reverbnation";
1962
+ readonly YOUTUBE_SEARCH: "youtubeSearch";
1963
+ readonly YOUTUBE_VIDEO: "youtubeVideo";
1964
+ readonly SOUNDCLOUD_SEARCH: "soundcloudSearch";
1965
+ readonly APPLE_MUSIC_SONG: "appleMusicSong";
1966
+ readonly APPLE_MUSIC_ALBUM: "appleMusicAlbum";
1967
+ readonly APPLE_MUSIC_PLAYLIST: "appleMusicPlaylist";
1968
+ readonly APPLE_MUSIC_SEARCH: "appleMusicSearch";
1969
+ readonly FILE: "file";
1970
+ readonly AUTO_SEARCH: "autoSearch";
1971
+ };
1972
+ type SearchQueryType = keyof typeof QueryType | (typeof QueryType)[keyof typeof QueryType];
1973
+ interface PlayerEvents {
1974
+ debug: (message: string) => any;
1975
+ error: (error: Error) => any;
1976
+ voiceStateUpdate: (queue: GuildQueue, oldState: VoiceState, newState: VoiceState) => any;
1977
+ }
1978
+ declare enum PlayerEvent {
1979
+ debug = "debug",
1980
+ error = "error",
1981
+ voiceStateUpdate = "voiceStateUpdate"
1982
+ }
1983
+ /**
1984
+ * @typedef {object} PlayOptions
1985
+ * @property {boolean} [filtersUpdate=false] If this play was triggered for filters update
1986
+ * @property {string[]} [encoderArgs=[]] FFmpeg args passed to encoder
1987
+ * @property {number} [seek] Time to seek to before playing
1988
+ * @property {boolean} [immediate=false] If it should start playing the provided track immediately
1989
+ */
1990
+ interface PlayOptions {
1991
+ filtersUpdate?: boolean;
1992
+ encoderArgs?: string[];
1993
+ seek?: number;
1994
+ immediate?: boolean;
1995
+ }
1996
+ type QueryExtractorSearch = `ext:${string}`;
1997
+ /**
1998
+ * @typedef {object} SearchOptions
1999
+ * @property {UserResolvable} requestedBy The user who requested this search
2000
+ * @property {typeof QueryType|string} [searchEngine='auto'] The query search engine, can be extractor name to target specific one (custom)
2001
+ * @property {string[]} [blockExtractors[]] List of the extractors to block
2002
+ * @property {boolean} [ignoreCache] If it should ignore query cache lookup
2003
+ * @property {SearchQueryType} [fallbackSearchEngine='autoSearch'] Fallback search engine to use
2004
+ */
2005
+ interface SearchOptions {
2006
+ requestedBy?: UserResolvable;
2007
+ searchEngine?: SearchQueryType | QueryExtractorSearch;
2008
+ blockExtractors?: string[];
2009
+ ignoreCache?: boolean;
2010
+ fallbackSearchEngine?: (typeof QueryType)[keyof typeof QueryType];
2011
+ }
2012
+ /**
2013
+ * The queue repeat mode. This can be one of:
2014
+ * - OFF
2015
+ * - TRACK
2016
+ * - QUEUE
2017
+ * - AUTOPLAY
2018
+ * @typedef {number} QueueRepeatMode
2019
+ */
2020
+ declare enum QueueRepeatMode {
2021
+ OFF = 0,
2022
+ TRACK = 1,
2023
+ QUEUE = 2,
2024
+ AUTOPLAY = 3
2025
+ }
2026
+ /**
2027
+ * @typedef {object} PlaylistInitData
2028
+ * @property {Track[]} tracks The tracks of this playlist
2029
+ * @property {string} title The playlist title
2030
+ * @property {string} description The description
2031
+ * @property {string} thumbnail The thumbnail
2032
+ * @property {album|playlist} type The playlist type: `album` | `playlist`
2033
+ * @property {TrackSource} source The playlist source
2034
+ * @property {object} author The playlist author
2035
+ * @property {string} [author.name] The author name
2036
+ * @property {string} [author.url] The author url
2037
+ * @property {string} id The playlist id
2038
+ * @property {string} url The playlist url
2039
+ * @property {any} [rawPlaylist] The raw playlist data
2040
+ */
2041
+ interface PlaylistInitData {
2042
+ tracks: Track[];
2043
+ title: string;
2044
+ description: string;
2045
+ thumbnail: string;
2046
+ type: 'album' | 'playlist';
2047
+ source: TrackSource;
2048
+ author: {
2049
+ name: string;
2050
+ url: string;
2051
+ };
2052
+ id: string;
2053
+ url: string;
2054
+ rawPlaylist?: any;
2055
+ }
2056
+ /**
2057
+ * @typedef {object} TrackJSON
2058
+ * @property {string} title The track title
2059
+ * @property {string} description The track description
2060
+ * @property {string} author The author
2061
+ * @property {string} url The url
2062
+ * @property {string} thumbnail The thumbnail
2063
+ * @property {string} duration The duration
2064
+ * @property {number} durationMS The duration in ms
2065
+ * @property {number} views The views count
2066
+ * @property {Snowflake} requestedBy The id of the user who requested this track
2067
+ * @property {PlaylistJSON} [playlist] The playlist info (if any)
2068
+ */
2069
+ interface TrackJSON {
2070
+ id: Snowflake;
2071
+ title: string;
2072
+ description: string;
2073
+ author: string;
2074
+ url: string;
2075
+ thumbnail: string;
2076
+ duration: string;
2077
+ durationMS: number;
2078
+ views: number;
2079
+ requestedBy: Snowflake;
2080
+ playlist?: PlaylistJSON;
2081
+ }
2082
+ /**
2083
+ * @typedef {object} PlaylistJSON
2084
+ * @property {string} id The playlist id
2085
+ * @property {string} url The playlist url
2086
+ * @property {string} title The playlist title
2087
+ * @property {string} description The playlist description
2088
+ * @property {string} thumbnail The thumbnail
2089
+ * @property {album|playlist} type The playlist type: `album` | `playlist`
2090
+ * @property {TrackSource} source The track source
2091
+ * @property {object} author The playlist author
2092
+ * @property {string} [author.name] The author name
2093
+ * @property {string} [author.url] The author url
2094
+ * @property {TrackJSON[]} tracks The tracks data (if any)
2095
+ */
2096
+ interface PlaylistJSON {
2097
+ id: string;
2098
+ url: string;
2099
+ title: string;
2100
+ description: string;
2101
+ thumbnail: string;
2102
+ type: 'album' | 'playlist';
2103
+ source: TrackSource;
2104
+ author: {
2105
+ name: string;
2106
+ url: string;
2107
+ };
2108
+ tracks: TrackJSON[];
2109
+ }
2110
+ /**
2111
+ * @typedef {object} PlayerInitOptions
2112
+ * @property {YTDLDownloadOptions} [ytdlOptions] The options passed to `ytdl-core`
2113
+ * @property {number} [connectionTimeout=20000] The voice connection timeout
2114
+ * @property {boolean} [lagMonitor=30000] Time in ms to re-monitor event loop lag
2115
+ * @property {boolean} [lockVoiceStateHandler] Prevent voice state handler from being overridden
2116
+ * @property {string[]} [blockExtractors] List of extractors to disable querying metadata from
2117
+ * @property {string[]} [blockStreamFrom] List of extractors to disable streaming from
2118
+ * @property {QueryCache | null} [queryCache] Query cache provider
2119
+ * @property {boolean} [ignoreInstance] Ignore player instance
2120
+ */
2121
+ interface PlayerInitOptions {
2122
+ ytdlOptions?: downloadOptions;
2123
+ connectionTimeout?: number;
2124
+ lagMonitor?: number;
2125
+ lockVoiceStateHandler?: boolean;
2126
+ blockExtractors?: string[];
2127
+ blockStreamFrom?: string[];
2128
+ queryCache?: QueryCache | null;
2129
+ ignoreInstance?: boolean;
2131
2130
  }
2132
2131
 
2133
- declare class AudioFilters {
2134
- constructor();
2135
- static filters: Record<FiltersName, string>;
2136
- static get<K extends FiltersName>(name: K): Record<keyof QueueFilters, string>[K];
2137
- static has<K extends FiltersName>(name: K): boolean;
2138
- static [Symbol.iterator](): IterableIterator<{
2139
- name: FiltersName;
2140
- value: string;
2141
- }>;
2142
- static get names(): (keyof QueueFilters)[];
2143
- static get length(): number;
2144
- static toString(): string;
2145
- /**
2146
- * Create ffmpeg args from the specified filters name
2147
- * @param filter The filter name
2148
- * @returns
2149
- */
2150
- static create<K extends FiltersName>(filters?: K[]): string;
2151
- /**
2152
- * Defines audio filter
2153
- * @param filterName The name of the filter
2154
- * @param value The ffmpeg args
2155
- */
2156
- static define(filterName: string, value: string): void;
2157
- /**
2158
- * Defines multiple audio filters
2159
- * @param filtersArray Array of filters containing the filter name and ffmpeg args
2160
- */
2161
- static defineBulk(filtersArray: {
2162
- name: string;
2163
- value: string;
2164
- }[]): void;
2132
+ declare class AudioFilters {
2133
+ constructor();
2134
+ static filters: Record<FiltersName, string>;
2135
+ static get<K extends FiltersName>(name: K): Record<keyof QueueFilters, string>[K];
2136
+ static has<K extends FiltersName>(name: K): boolean;
2137
+ static [Symbol.iterator](): IterableIterator<{
2138
+ name: FiltersName;
2139
+ value: string;
2140
+ }>;
2141
+ static get names(): (keyof QueueFilters)[];
2142
+ static get length(): number;
2143
+ static toString(): string;
2144
+ /**
2145
+ * Create ffmpeg args from the specified filters name
2146
+ * @param filter The filter name
2147
+ * @returns
2148
+ */
2149
+ static create<K extends FiltersName>(filters?: K[]): string;
2150
+ /**
2151
+ * Defines audio filter
2152
+ * @param filterName The name of the filter
2153
+ * @param value The ffmpeg args
2154
+ */
2155
+ static define(filterName: string, value: string): void;
2156
+ /**
2157
+ * Defines multiple audio filters
2158
+ * @param filtersArray Array of filters containing the filter name and ffmpeg args
2159
+ */
2160
+ static defineBulk(filtersArray: {
2161
+ name: string;
2162
+ value: string;
2163
+ }[]): void;
2165
2164
  }
2166
2165
 
2167
- declare class Util {
2168
- /**
2169
- * Utils
2170
- */
2171
- private constructor();
2172
- /**
2173
- * Creates duration string
2174
- * @param {object} durObj The duration object
2175
- * @returns {string}
2176
- */
2177
- static durationString(durObj: Record<string, number>): string;
2178
- /**
2179
- * Parses milliseconds to consumable time object
2180
- * @param {number} milliseconds The time in ms
2181
- * @returns {TimeData}
2182
- */
2183
- static parseMS(milliseconds: number): TimeData;
2184
- /**
2185
- * Builds time code
2186
- * @param {TimeData} duration The duration object
2187
- * @returns {string}
2188
- */
2189
- static buildTimeCode(duration: TimeData): string;
2190
- /**
2191
- * Picks last item of the given array
2192
- * @param {any[]} arr The array
2193
- * @returns {any}
2194
- */
2195
- static last<T = any>(arr: T[]): T;
2196
- /**
2197
- * Checks if the voice channel is empty
2198
- * @param {VoiceChannel|StageChannel} channel The voice channel
2199
- * @returns {boolean}
2200
- */
2201
- static isVoiceEmpty(channel: VoiceChannel | StageChannel): boolean;
2202
- /**
2203
- * Safer require
2204
- * @param {string} id Node require id
2205
- * @returns {any}
2206
- */
2207
- static require(id: string): {
2208
- module: any;
2209
- error: null;
2210
- } | {
2211
- module: null;
2212
- error: unknown;
2213
- };
2214
- static import(id: string): Promise<{
2215
- module: any;
2216
- error: null;
2217
- } | {
2218
- module: null;
2219
- error: unknown;
2220
- }>;
2221
- /**
2222
- * Asynchronous timeout
2223
- * @param {number} time The time in ms to wait
2224
- * @returns {Promise<unknown>}
2225
- */
2226
- static wait(time: number): Promise<undefined>;
2227
- static noop(): void;
2228
- static getFetch(): Promise<any>;
2229
- static warn(message: string, code?: string, detail?: string): void;
2230
- static randomChoice<T>(src: T[]): T;
2166
+ declare class Util {
2167
+ /**
2168
+ * Utils
2169
+ */
2170
+ private constructor();
2171
+ /**
2172
+ * Creates duration string
2173
+ * @param {object} durObj The duration object
2174
+ * @returns {string}
2175
+ */
2176
+ static durationString(durObj: Record<string, number>): string;
2177
+ /**
2178
+ * Parses milliseconds to consumable time object
2179
+ * @param {number} milliseconds The time in ms
2180
+ * @returns {TimeData}
2181
+ */
2182
+ static parseMS(milliseconds: number): TimeData;
2183
+ /**
2184
+ * Builds time code
2185
+ * @param {TimeData} duration The duration object
2186
+ * @returns {string}
2187
+ */
2188
+ static buildTimeCode(duration: TimeData): string;
2189
+ /**
2190
+ * Picks last item of the given array
2191
+ * @param {any[]} arr The array
2192
+ * @returns {any}
2193
+ */
2194
+ static last<T = any>(arr: T[]): T;
2195
+ /**
2196
+ * Checks if the voice channel is empty
2197
+ * @param {VoiceChannel|StageChannel} channel The voice channel
2198
+ * @returns {boolean}
2199
+ */
2200
+ static isVoiceEmpty(channel: VoiceChannel | StageChannel): boolean;
2201
+ /**
2202
+ * Safer require
2203
+ * @param {string} id Node require id
2204
+ * @returns {any}
2205
+ */
2206
+ static require(id: string): {
2207
+ module: any;
2208
+ error: null;
2209
+ } | {
2210
+ module: null;
2211
+ error: unknown;
2212
+ };
2213
+ static import(id: string): Promise<{
2214
+ module: any;
2215
+ error: null;
2216
+ } | {
2217
+ module: null;
2218
+ error: unknown;
2219
+ }>;
2220
+ /**
2221
+ * Asynchronous timeout
2222
+ * @param {number} time The time in ms to wait
2223
+ * @returns {Promise<unknown>}
2224
+ */
2225
+ static wait(time: number): Promise<undefined>;
2226
+ static noop(): void;
2227
+ static getFetch(): Promise<any>;
2228
+ static warn(message: string, code?: string, detail?: string): void;
2229
+ static randomChoice<T>(src: T[]): T;
2231
2230
  }
2232
2231
 
2233
- declare class TypeUtil {
2234
- private constructor();
2235
- static isFunction(t: unknown): t is Function;
2236
- static isNumber(t: unknown): t is number;
2237
- static isString(t: unknown): t is string;
2238
- static isBoolean(t: unknown): t is boolean;
2239
- static isNullish(t: unknown): t is null | undefined;
2240
- static isArray(t: unknown): t is unknown[];
2241
- static isError(t: unknown): t is Error;
2232
+ declare class TypeUtil {
2233
+ private constructor();
2234
+ static isFunction(t: unknown): t is Function;
2235
+ static isNumber(t: unknown): t is number;
2236
+ static isString(t: unknown): t is string;
2237
+ static isBoolean(t: unknown): t is boolean;
2238
+ static isNullish(t: unknown): t is null | undefined;
2239
+ static isArray(t: unknown): t is unknown[];
2240
+ static isError(t: unknown): t is Error;
2242
2241
  }
2243
2242
 
2244
- declare class QueryResolver {
2245
- /**
2246
- * Query resolver
2247
- */
2248
- private constructor();
2249
- static get regex(): {
2250
- spotifyAlbumRegex: RegExp;
2251
- spotifyPlaylistRegex: RegExp;
2252
- spotifySongRegex: RegExp;
2253
- vimeoRegex: RegExp;
2254
- reverbnationRegex: RegExp;
2255
- attachmentRegex: RegExp;
2256
- appleMusicAlbumRegex: RegExp;
2257
- appleMusicPlaylistRegex: RegExp;
2258
- appleMusicSongRegex: RegExp;
2259
- };
2260
- /**
2261
- * Resolves the given search query
2262
- * @param {string} query The query
2263
- */
2264
- static resolve(query: string, fallbackSearchEngine?: (typeof QueryType)[keyof typeof QueryType]): (typeof QueryType)[keyof typeof QueryType];
2265
- /**
2266
- * Parses vimeo id from url
2267
- * @param {string} query The query
2268
- * @returns {string}
2269
- */
2270
- static getVimeoID(query: string): string | null | undefined;
2271
- static validateId(q: string): boolean;
2272
- static validateURL(q: string): boolean;
2243
+ declare class QueryResolver {
2244
+ /**
2245
+ * Query resolver
2246
+ */
2247
+ private constructor();
2248
+ static get regex(): {
2249
+ spotifyAlbumRegex: RegExp;
2250
+ spotifyPlaylistRegex: RegExp;
2251
+ spotifySongRegex: RegExp;
2252
+ vimeoRegex: RegExp;
2253
+ reverbnationRegex: RegExp;
2254
+ attachmentRegex: RegExp;
2255
+ appleMusicAlbumRegex: RegExp;
2256
+ appleMusicPlaylistRegex: RegExp;
2257
+ appleMusicSongRegex: RegExp;
2258
+ };
2259
+ /**
2260
+ * Resolves the given search query
2261
+ * @param {string} query The query
2262
+ */
2263
+ static resolve(query: string, fallbackSearchEngine?: (typeof QueryType)[keyof typeof QueryType]): (typeof QueryType)[keyof typeof QueryType];
2264
+ /**
2265
+ * Parses vimeo id from url
2266
+ * @param {string} query The query
2267
+ * @returns {string}
2268
+ */
2269
+ static getVimeoID(query: string): string | null | undefined;
2270
+ static validateId(q: string): boolean;
2271
+ static validateURL(q: string): boolean;
2273
2272
  }
2274
2273
 
2274
+ type Callback<Args extends Array<unknown>> = (...args: Args) => unknown;
2275
+ interface FFmpegInfo {
2276
+ command: string | null;
2277
+ metadata: string | null;
2278
+ version: string | null;
2279
+ isStatic: boolean;
2280
+ }
2281
+ interface FFmpegOptions extends DuplexOptions {
2282
+ args?: string[];
2283
+ shell?: boolean;
2284
+ }
2285
+ declare class FFmpeg extends Duplex {
2286
+ /**
2287
+ * FFmpeg version regex
2288
+ */
2289
+ static VersionRegex: RegExp;
2290
+ /**
2291
+ * Spawns ffmpeg process
2292
+ * @param options Spawn options
2293
+ */
2294
+ static spawn({ args, shell }?: {
2295
+ args?: string[] | undefined;
2296
+ shell?: boolean | undefined;
2297
+ }): childProcess.ChildProcessWithoutNullStreams;
2298
+ /**
2299
+ * Check if ffmpeg is available
2300
+ */
2301
+ static isAvailable(): boolean;
2302
+ /**
2303
+ * Safe locate ffmpeg
2304
+ * @param force if it should relocate the command
2305
+ */
2306
+ static locateSafe(force?: boolean): FFmpegInfo | null | undefined;
2307
+ /**
2308
+ * Locate ffmpeg command. Throws error if ffmpeg is not found.
2309
+ * @param force Forcefully reload
2310
+ */
2311
+ static locate(force?: boolean): FFmpegInfo | undefined;
2312
+ /**
2313
+ * Current FFmpeg process
2314
+ */
2315
+ process: childProcess.ChildProcessWithoutNullStreams;
2316
+ /**
2317
+ * Create FFmpeg duplex stream
2318
+ * @param options Options to initialize ffmpeg
2319
+ * @example ```typescript
2320
+ * const ffmpeg = new FFmpeg({
2321
+ * args: [
2322
+ * '-analyzeduration', '0',
2323
+ * '-loglevel', '0',
2324
+ * '-f', 's16le',
2325
+ * '-ar', '48000',
2326
+ * '-ac', '2',
2327
+ * '-af', 'bass=g=10,acompressor'
2328
+ * ]
2329
+ * });
2330
+ *
2331
+ * const pcm = input.pipe(ffmpeg);
2332
+ *
2333
+ * pcm.pipe(fs.createWriteStream('./audio.pcm'));
2334
+ * ```
2335
+ */
2336
+ constructor(options?: FFmpegOptions);
2337
+ get _reader(): stream.Readable;
2338
+ get _writer(): stream.Writable;
2339
+ private _copy;
2340
+ _destroy(err: Error | null, cb: Callback<[Error | null]>): unknown;
2341
+ _final(cb: Callback<[]>): void;
2342
+ private _cleanup;
2343
+ toString(): string;
2344
+ }
2345
+ declare const findFFmpeg: typeof FFmpeg.locate;
2346
+
2275
2347
  declare function useHistory<Meta = unknown>(node: NodeResolvable): GuildQueueHistory<Meta> | null;
2276
2348
 
2277
2349
  declare function usePlayer<Meta = unknown>(node: NodeResolvable): GuildQueuePlayerNode<Meta> | null;
@@ -2280,20 +2352,21 @@ declare function useQueue<Meta = unknown>(node: NodeResolvable): GuildQueue<Meta
2280
2352
 
2281
2353
  declare function useMasterPlayer(): Player | null;
2282
2354
 
2283
- type SetterFN<T, P> = (previous: P) => T;
2355
+ type SetterFN<T, P> = (previous: P) => T;
2284
2356
  declare function useMetadata<T = unknown>(node: NodeResolvable): readonly [() => T, (metadata: T | SetterFN<T, T>) => void];
2285
2357
 
2286
- interface TimelineDispatcherOptions {
2287
- ignoreFilters: boolean;
2288
- }
2289
- declare function useTimeline(node: NodeResolvable, options?: Partial<TimelineDispatcherOptions>): {
2290
- readonly timestamp: PlayerTimestamp;
2291
- readonly volume: number;
2292
- readonly paused: boolean;
2293
- pause(): boolean;
2294
- resume(): boolean;
2295
- setVolume(vol: number): boolean;
2296
- setPosition(time: number): Promise<boolean>;
2358
+ interface TimelineDispatcherOptions {
2359
+ ignoreFilters: boolean;
2360
+ }
2361
+ declare function useTimeline(node: NodeResolvable, options?: Partial<TimelineDispatcherOptions>): {
2362
+ readonly timestamp: PlayerTimestamp;
2363
+ readonly volume: number;
2364
+ readonly paused: boolean;
2365
+ readonly track: Track | null;
2366
+ pause(): boolean;
2367
+ resume(): boolean;
2368
+ setVolume(vol: number): boolean;
2369
+ setPosition(time: number): Promise<boolean>;
2297
2370
  } | null;
2298
2371
 
2299
2372
  declare function onAfterCreateStream(handler: OnAfterCreateStreamHandler): void;
@@ -2302,4 +2375,4 @@ declare function onBeforeCreateStream(handler: OnBeforeCreateStreamHandler): voi
2302
2375
 
2303
2376
  declare const version: string;
2304
2377
 
2305
- export { AFilterGraph, AsyncQueue, AsyncQueueAcquisitionOptions, AsyncQueueEntry, AudioFilters, BaseExtractor, DiscordPlayerQueryResultCache, EqualizerConfigurationPreset, ErrorStatusCode, 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, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerError, PlayerEvent, PlayerEvents, PlayerEventsEmitter, PlayerInitOptions, PlayerNodeInitializationResult, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheResolverContext, QueryExtractorSearch, QueryResolver, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, RawTrackInit, ResourcePlayOptions, SearchOptions, SearchQueryType, SearchResult, SearchResultData, StreamDispatcher, TimeData, TimelineDispatcherOptions, Track, TrackJSON, TrackResolvable, TrackSource, TypeUtil, Util, VoiceConnectConfig, VoiceEvents, VoiceReceiverNode, VoiceReceiverOptions, VoiceUtils, createFFmpegStream, onAfterCreateStream, onBeforeCreateStream, useHistory, useMasterPlayer, useMetadata, usePlayer, useQueue, useTimeline, version };
2378
+ export { AFilterGraph, AsyncQueue, AsyncQueueAcquisitionOptions, AsyncQueueEntry, AudioFilters, BaseExtractor, DiscordPlayerQueryResultCache, EqualizerConfigurationPreset, ErrorStatusCode, ExtractorExecutionContext, ExtractorExecutionEvents, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorSearchContext, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFMPEG_SRATE_REGEX, FFmpeg, FFmpegFilterer, FFmpegInfo, FFmpegOptions, FFmpegStreamOptions, FilterGraph, FiltersName, GuildNodeCreateOptions, GuildNodeInit, GuildNodeManager, GuildQueue, GuildQueueAFiltersCache, GuildQueueAudioFilters, GuildQueueEvent, GuildQueueEvents, GuildQueueHistory, GuildQueuePlayerNode, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerError, PlayerEvent, PlayerEvents, PlayerEventsEmitter, PlayerInitOptions, PlayerNodeInitializationResult, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheResolverContext, QueryExtractorSearch, QueryResolver, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, RawTrackInit, ResourcePlayOptions, SearchOptions, SearchQueryType, SearchResult, SearchResultData, StreamDispatcher, TimeData, TimelineDispatcherOptions, Track, TrackJSON, TrackResolvable, TrackSource, TypeUtil, Util, VoiceConnectConfig, VoiceEvents, VoiceReceiverNode, VoiceReceiverOptions, VoiceUtils, createFFmpegStream, findFFmpeg, onAfterCreateStream, onBeforeCreateStream, useHistory, useMasterPlayer, useMetadata, usePlayer, useQueue, useTimeline, version };