discord-player 6.0.0-dev.1 → 6.0.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -24
- package/dist/index.d.ts +586 -729
- package/dist/index.js +1533 -2003
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1542 -2014
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { User, VoiceChannel, StageChannel, Guild, VoiceState, VoiceBasedChannel, GuildVoiceChannelResolvable,
|
|
2
|
-
import
|
|
1
|
+
import { User, VoiceChannel, StageChannel, Guild, VoiceState, VoiceBasedChannel, GuildVoiceChannelResolvable, Snowflake, Client, GuildResolvable, UserResolvable } from 'discord.js';
|
|
2
|
+
import * as _discordjs_voice from '@discordjs/voice';
|
|
3
|
+
import { AudioPlayerError, AudioResource, VoiceConnection, AudioPlayer, AudioPlayerStatus, StreamType } from '@discordjs/voice';
|
|
3
4
|
import * as _discord_player_equalizer from '@discord-player/equalizer';
|
|
4
5
|
import { PCMFilters, EqualizerBand, BiquadFilters, FiltersChain } from '@discord-player/equalizer';
|
|
5
6
|
export { AF_NIGHTCORE_RATE, AF_VAPORWAVE_RATE, BASS_EQ_BANDS, FilterType as BiquadFilterType, BiquadFilters, FiltersChain, AudioFilters as PCMAudioFilters, PCMFilters, Q_BUTTERWORTH, VolumeTransformer } from '@discord-player/equalizer';
|
|
6
|
-
import { EventEmitter, Queue
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import { EventEmitter, Queue, QueueStrategy, Collection } from '@discord-player/utils';
|
|
8
|
+
import { Readable, Duplex } from 'stream';
|
|
9
|
+
import Fuse from 'fuse.js';
|
|
9
10
|
import { downloadOptions } from 'ytdl-core';
|
|
10
11
|
|
|
11
12
|
declare class Playlist {
|
|
@@ -64,7 +65,7 @@ declare class Track {
|
|
|
64
65
|
* The queue in which this track is located
|
|
65
66
|
* @type {Queue}
|
|
66
67
|
*/
|
|
67
|
-
get queue():
|
|
68
|
+
get queue(): GuildQueue;
|
|
68
69
|
/**
|
|
69
70
|
* The track duration in millisecond
|
|
70
71
|
* @type {number}
|
|
@@ -113,6 +114,7 @@ interface VoiceEvents {
|
|
|
113
114
|
volume: (volume: number) => any;
|
|
114
115
|
}
|
|
115
116
|
declare class StreamDispatcher extends EventEmitter<VoiceEvents> {
|
|
117
|
+
queue: GuildQueue;
|
|
116
118
|
readonly connectionTimeout: number;
|
|
117
119
|
readonly voiceConnection: VoiceConnection;
|
|
118
120
|
readonly audioPlayer: AudioPlayer;
|
|
@@ -126,7 +128,7 @@ declare class StreamDispatcher extends EventEmitter<VoiceEvents> {
|
|
|
126
128
|
* @param {VoiceChannel|StageChannel} channel The connected channel
|
|
127
129
|
* @private
|
|
128
130
|
*/
|
|
129
|
-
constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel, connectionTimeout?: number);
|
|
131
|
+
constructor(connection: VoiceConnection, channel: VoiceChannel | StageChannel, queue: GuildQueue, connectionTimeout?: number);
|
|
130
132
|
/**
|
|
131
133
|
* Check if the player has been paused manually
|
|
132
134
|
*/
|
|
@@ -150,11 +152,11 @@ declare class StreamDispatcher extends EventEmitter<VoiceEvents> {
|
|
|
150
152
|
isIdle(): boolean;
|
|
151
153
|
/**
|
|
152
154
|
* Creates stream
|
|
153
|
-
* @param {Readable
|
|
155
|
+
* @param {Readable} src The stream source
|
|
154
156
|
* @param {object} [ops] Options
|
|
155
157
|
* @returns {AudioResource}
|
|
156
158
|
*/
|
|
157
|
-
createStream(src: Readable
|
|
159
|
+
createStream(src: Readable, ops?: CreateStreamOps): Promise<AudioResource<Track>>;
|
|
158
160
|
get resampler(): _discord_player_equalizer.PCMResampler | null;
|
|
159
161
|
get filters(): _discord_player_equalizer.AudioFilter | null;
|
|
160
162
|
get biquad(): _discord_player_equalizer.BiquadStream | null;
|
|
@@ -211,19 +213,48 @@ declare class StreamDispatcher extends EventEmitter<VoiceEvents> {
|
|
|
211
213
|
|
|
212
214
|
declare class GuildQueueHistory<Meta = unknown> {
|
|
213
215
|
queue: GuildQueue<Meta>;
|
|
214
|
-
tracks: Queue
|
|
216
|
+
tracks: Queue<Track>;
|
|
215
217
|
constructor(queue: GuildQueue<Meta>);
|
|
218
|
+
/**
|
|
219
|
+
* Current track in the queue
|
|
220
|
+
*/
|
|
216
221
|
get currentTrack(): Track | null;
|
|
222
|
+
/**
|
|
223
|
+
* Next track in the queue
|
|
224
|
+
*/
|
|
217
225
|
get nextTrack(): Track | null;
|
|
226
|
+
/**
|
|
227
|
+
* Previous track in the queue
|
|
228
|
+
*/
|
|
218
229
|
get previousTrack(): Track | null;
|
|
230
|
+
/**
|
|
231
|
+
* If history is disabled
|
|
232
|
+
*/
|
|
219
233
|
get disabled(): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* If history is empty
|
|
236
|
+
*/
|
|
220
237
|
isEmpty(): boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Add track to track history
|
|
240
|
+
* @param track The track to add
|
|
241
|
+
*/
|
|
221
242
|
push(track: Track | Track[]): boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Clear history
|
|
245
|
+
*/
|
|
222
246
|
clear(): void;
|
|
247
|
+
/**
|
|
248
|
+
* Play the next track in the queue
|
|
249
|
+
*/
|
|
223
250
|
next(): void;
|
|
251
|
+
/**
|
|
252
|
+
* Play the previous track in the queue
|
|
253
|
+
*/
|
|
224
254
|
previous(): void;
|
|
225
255
|
}
|
|
226
256
|
|
|
257
|
+
declare const FFMPEG_SRATE_REGEX: RegExp;
|
|
227
258
|
interface ResourcePlayOptions {
|
|
228
259
|
queue?: boolean;
|
|
229
260
|
seek?: number;
|
|
@@ -244,83 +275,233 @@ declare class GuildQueuePlayerNode<Meta = unknown> {
|
|
|
244
275
|
#private;
|
|
245
276
|
queue: GuildQueue<Meta>;
|
|
246
277
|
constructor(queue: GuildQueue<Meta>);
|
|
278
|
+
/**
|
|
279
|
+
* If the player is currently in idle mode
|
|
280
|
+
*/
|
|
247
281
|
isIdle(): boolean;
|
|
282
|
+
/**
|
|
283
|
+
* If the player is currently buffering the track
|
|
284
|
+
*/
|
|
248
285
|
isBuffering(): boolean;
|
|
286
|
+
/**
|
|
287
|
+
* If the player is currently playing a track
|
|
288
|
+
*/
|
|
249
289
|
isPlaying(): boolean;
|
|
290
|
+
/**
|
|
291
|
+
* If the player is currently paused
|
|
292
|
+
*/
|
|
250
293
|
isPaused(): boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Reset progress history
|
|
296
|
+
*/
|
|
251
297
|
resetProgress(): void;
|
|
298
|
+
/**
|
|
299
|
+
* The stream time for current session
|
|
300
|
+
*/
|
|
301
|
+
get streamTime(): number;
|
|
302
|
+
/**
|
|
303
|
+
* Current playback duration with history included
|
|
304
|
+
*/
|
|
252
305
|
get playbackTime(): number;
|
|
253
|
-
|
|
306
|
+
/**
|
|
307
|
+
* Get duration multiplier
|
|
308
|
+
*/
|
|
309
|
+
getDurationMultiplier(): number;
|
|
310
|
+
/**
|
|
311
|
+
* Estimated progress of the player
|
|
312
|
+
*/
|
|
313
|
+
get estimatedPlaybackTime(): number;
|
|
314
|
+
/**
|
|
315
|
+
* Estimated total duration of the player
|
|
316
|
+
*/
|
|
317
|
+
get estimatedDuration(): number;
|
|
318
|
+
/**
|
|
319
|
+
* Get stream progress
|
|
320
|
+
* @param ignoreFilters Ignore filters
|
|
321
|
+
*/
|
|
322
|
+
getTimestamp(ignoreFilters?: boolean): PlayerTimestamp | null;
|
|
323
|
+
/**
|
|
324
|
+
* Create progress bar for current progress
|
|
325
|
+
* @param options Progress bar options
|
|
326
|
+
*/
|
|
254
327
|
createProgressBar(options?: PlayerProgressbarOptions): string | null;
|
|
328
|
+
/**
|
|
329
|
+
* Seek the player
|
|
330
|
+
* @param duration The duration to seek to
|
|
331
|
+
*/
|
|
255
332
|
seek(duration: number): Promise<boolean>;
|
|
333
|
+
/**
|
|
334
|
+
* Current volume
|
|
335
|
+
*/
|
|
256
336
|
get volume(): number;
|
|
337
|
+
/**
|
|
338
|
+
* Set volume
|
|
339
|
+
* @param vol Volume amount to set
|
|
340
|
+
*/
|
|
257
341
|
setVolume(vol: number): boolean;
|
|
342
|
+
/**
|
|
343
|
+
* Set bit rate
|
|
344
|
+
* @param rate The bit rate to set
|
|
345
|
+
*/
|
|
258
346
|
setBitrate(rate: number | 'auto'): void;
|
|
347
|
+
/**
|
|
348
|
+
* Set paused state
|
|
349
|
+
* @param state The state
|
|
350
|
+
*/
|
|
259
351
|
setPaused(state: boolean): boolean;
|
|
352
|
+
/**
|
|
353
|
+
* Pause the playback
|
|
354
|
+
*/
|
|
260
355
|
pause(): boolean;
|
|
356
|
+
/**
|
|
357
|
+
* Resume the playback
|
|
358
|
+
*/
|
|
261
359
|
resume(): boolean;
|
|
360
|
+
/**
|
|
361
|
+
* Skip current track
|
|
362
|
+
*/
|
|
262
363
|
skip(): boolean;
|
|
364
|
+
/**
|
|
365
|
+
* Remove the given track from queue
|
|
366
|
+
* @param track The track to remove
|
|
367
|
+
*/
|
|
263
368
|
remove(track: TrackResolvable): Track | null;
|
|
369
|
+
/**
|
|
370
|
+
* Jump to specific track on the queue
|
|
371
|
+
* @param track The track to jump to without removing other tracks
|
|
372
|
+
*/
|
|
264
373
|
jump(track: TrackResolvable): boolean;
|
|
374
|
+
/**
|
|
375
|
+
* Get track position
|
|
376
|
+
* @param track The track
|
|
377
|
+
*/
|
|
265
378
|
getTrackPosition(track: TrackResolvable): number;
|
|
379
|
+
/**
|
|
380
|
+
* Skip to the given track, removing others on the way
|
|
381
|
+
* @param track The track to skip to
|
|
382
|
+
*/
|
|
266
383
|
skipTo(track: TrackResolvable): boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Insert a track on the given position in queue
|
|
386
|
+
* @param track The track to insert
|
|
387
|
+
* @param index The position to insert to, defaults to 0.
|
|
388
|
+
*/
|
|
267
389
|
insert(track: Track, index?: number): void;
|
|
390
|
+
/**
|
|
391
|
+
* Stop the playback
|
|
392
|
+
* @param force Whether or not to forcefully stop the playback
|
|
393
|
+
*/
|
|
268
394
|
stop(force?: boolean): boolean;
|
|
395
|
+
/**
|
|
396
|
+
* Play the given track
|
|
397
|
+
* @param res The track to play
|
|
398
|
+
* @param options Options for playing the track
|
|
399
|
+
*/
|
|
269
400
|
play(res?: Track, options?: ResourcePlayOptions): Promise<void>;
|
|
270
401
|
}
|
|
271
402
|
|
|
403
|
+
interface FFmpegStreamOptions {
|
|
404
|
+
fmt?: string;
|
|
405
|
+
encoderArgs?: string[];
|
|
406
|
+
seek?: number;
|
|
407
|
+
skip?: boolean;
|
|
408
|
+
cookies?: string;
|
|
409
|
+
}
|
|
410
|
+
declare function FFMPEG_ARGS_STRING(stream: string, fmt?: string, cookies?: string): string[];
|
|
411
|
+
declare function FFMPEG_ARGS_PIPED(fmt?: string): string[];
|
|
412
|
+
/**
|
|
413
|
+
* Creates FFmpeg stream
|
|
414
|
+
* @param stream The source stream
|
|
415
|
+
* @param options FFmpeg stream options
|
|
416
|
+
*/
|
|
417
|
+
declare function createFFmpegStream(stream: Readable | Duplex | string, options?: FFmpegStreamOptions): Readable;
|
|
418
|
+
|
|
272
419
|
type Filters = keyof typeof AudioFilters.filters;
|
|
273
420
|
declare const EqualizerConfigurationPreset: {
|
|
274
|
-
readonly
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
readonly
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
readonly
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
readonly
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
readonly
|
|
291
|
-
|
|
292
|
-
gain: number;
|
|
293
|
-
}[];
|
|
294
|
-
readonly Folk: {
|
|
295
|
-
band: number;
|
|
296
|
-
gain: number;
|
|
297
|
-
}[];
|
|
298
|
-
readonly RnB: {
|
|
299
|
-
band: number;
|
|
300
|
-
gain: number;
|
|
301
|
-
}[];
|
|
302
|
-
readonly Country: {
|
|
303
|
-
band: number;
|
|
304
|
-
gain: number;
|
|
305
|
-
}[];
|
|
306
|
-
readonly Classical: {
|
|
307
|
-
band: number;
|
|
308
|
-
gain: number;
|
|
309
|
-
}[];
|
|
421
|
+
readonly Flat: EqualizerBand[];
|
|
422
|
+
readonly Classical: EqualizerBand[];
|
|
423
|
+
readonly Club: EqualizerBand[];
|
|
424
|
+
readonly Dance: EqualizerBand[];
|
|
425
|
+
readonly FullBass: EqualizerBand[];
|
|
426
|
+
readonly FullBassTreble: EqualizerBand[];
|
|
427
|
+
readonly FullTreble: EqualizerBand[];
|
|
428
|
+
readonly Headphones: EqualizerBand[];
|
|
429
|
+
readonly LargeHall: EqualizerBand[];
|
|
430
|
+
readonly Live: EqualizerBand[];
|
|
431
|
+
readonly Party: EqualizerBand[];
|
|
432
|
+
readonly Pop: EqualizerBand[];
|
|
433
|
+
readonly Reggae: EqualizerBand[];
|
|
434
|
+
readonly Rock: EqualizerBand[];
|
|
435
|
+
readonly Ska: EqualizerBand[];
|
|
436
|
+
readonly Soft: EqualizerBand[];
|
|
437
|
+
readonly SoftRock: EqualizerBand[];
|
|
438
|
+
readonly Techno: EqualizerBand[];
|
|
310
439
|
};
|
|
311
440
|
declare class FFmpegFilterer<Meta = unknown> {
|
|
312
441
|
#private;
|
|
313
442
|
af: GuildQueueAudioFilters<Meta>;
|
|
314
443
|
constructor(af: GuildQueueAudioFilters<Meta>);
|
|
444
|
+
/**
|
|
445
|
+
* Create ffmpeg stream
|
|
446
|
+
* @param source The stream source
|
|
447
|
+
* @param options The stream options
|
|
448
|
+
*/
|
|
449
|
+
createStream(source: string | Readable, options: FFmpegStreamOptions): Readable;
|
|
450
|
+
/**
|
|
451
|
+
* Set ffmpeg filters
|
|
452
|
+
* @param filters The filters
|
|
453
|
+
*/
|
|
315
454
|
setFilters(filters: Filters[] | Record<Filters, boolean> | boolean): Promise<boolean>;
|
|
455
|
+
/**
|
|
456
|
+
* Currently active ffmpeg filters
|
|
457
|
+
*/
|
|
316
458
|
get filters(): Filters[];
|
|
317
459
|
set filters(filters: Filters[]);
|
|
460
|
+
/**
|
|
461
|
+
* Toggle given ffmpeg filter(s)
|
|
462
|
+
* @param filters The filter(s)
|
|
463
|
+
*/
|
|
318
464
|
toggle(filters: Filters[] | Filters): Promise<boolean>;
|
|
465
|
+
/**
|
|
466
|
+
* Set default filters
|
|
467
|
+
* @param ff Filters list
|
|
468
|
+
*/
|
|
469
|
+
setDefaults(ff: Filters[]): void;
|
|
470
|
+
/**
|
|
471
|
+
* Get list of enabled filters
|
|
472
|
+
*/
|
|
319
473
|
getFiltersEnabled(): (keyof QueueFilters)[];
|
|
474
|
+
/**
|
|
475
|
+
* Get list of disabled filters
|
|
476
|
+
*/
|
|
320
477
|
getFiltersDisabled(): (keyof QueueFilters)[];
|
|
478
|
+
/**
|
|
479
|
+
* Check if the given filter is enabled
|
|
480
|
+
* @param filter The filter
|
|
481
|
+
*/
|
|
321
482
|
isEnabled<T extends Filters>(filter: T): boolean;
|
|
483
|
+
/**
|
|
484
|
+
* Check if the given filter is disabled
|
|
485
|
+
* @param filter The filter
|
|
486
|
+
*/
|
|
322
487
|
isDisabled<T extends Filters>(filter: T): boolean;
|
|
323
|
-
|
|
488
|
+
/**
|
|
489
|
+
* Check if the given filter is a valid filter
|
|
490
|
+
* @param filter The filter to test
|
|
491
|
+
*/
|
|
492
|
+
isValidFilter(filter: string): filter is FiltersName;
|
|
493
|
+
/**
|
|
494
|
+
* Convert current filters to array
|
|
495
|
+
*/
|
|
496
|
+
toArray(): string[];
|
|
497
|
+
/**
|
|
498
|
+
* Convert current filters to JSON object
|
|
499
|
+
*/
|
|
500
|
+
toJSON(): Record<keyof QueueFilters, string>;
|
|
501
|
+
/**
|
|
502
|
+
* String representation of current filters
|
|
503
|
+
*/
|
|
504
|
+
toString(): string;
|
|
324
505
|
}
|
|
325
506
|
interface GuildQueueAFiltersCache {
|
|
326
507
|
equalizer: EqualizerBand[];
|
|
@@ -334,50 +515,51 @@ declare class GuildQueueAudioFilters<Meta = unknown> {
|
|
|
334
515
|
graph: AFilterGraph<Meta>;
|
|
335
516
|
ffmpeg: FFmpegFilterer<Meta>;
|
|
336
517
|
equalizerPresets: {
|
|
337
|
-
readonly
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
readonly
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
readonly
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
readonly
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
readonly
|
|
354
|
-
|
|
355
|
-
gain: number;
|
|
356
|
-
}[];
|
|
357
|
-
readonly Folk: {
|
|
358
|
-
band: number;
|
|
359
|
-
gain: number;
|
|
360
|
-
}[];
|
|
361
|
-
readonly RnB: {
|
|
362
|
-
band: number;
|
|
363
|
-
gain: number;
|
|
364
|
-
}[];
|
|
365
|
-
readonly Country: {
|
|
366
|
-
band: number;
|
|
367
|
-
gain: number;
|
|
368
|
-
}[];
|
|
369
|
-
readonly Classical: {
|
|
370
|
-
band: number;
|
|
371
|
-
gain: number;
|
|
372
|
-
}[];
|
|
518
|
+
readonly Flat: EqualizerBand[];
|
|
519
|
+
readonly Classical: EqualizerBand[];
|
|
520
|
+
readonly Club: EqualizerBand[];
|
|
521
|
+
readonly Dance: EqualizerBand[];
|
|
522
|
+
readonly FullBass: EqualizerBand[];
|
|
523
|
+
readonly FullBassTreble: EqualizerBand[];
|
|
524
|
+
readonly FullTreble: EqualizerBand[];
|
|
525
|
+
readonly Headphones: EqualizerBand[];
|
|
526
|
+
readonly LargeHall: EqualizerBand[];
|
|
527
|
+
readonly Live: EqualizerBand[];
|
|
528
|
+
readonly Party: EqualizerBand[];
|
|
529
|
+
readonly Pop: EqualizerBand[];
|
|
530
|
+
readonly Reggae: EqualizerBand[];
|
|
531
|
+
readonly Rock: EqualizerBand[];
|
|
532
|
+
readonly Ska: EqualizerBand[];
|
|
533
|
+
readonly Soft: EqualizerBand[];
|
|
534
|
+
readonly SoftRock: EqualizerBand[];
|
|
535
|
+
readonly Techno: EqualizerBand[];
|
|
373
536
|
};
|
|
374
537
|
_lastFiltersCache: GuildQueueAFiltersCache;
|
|
375
538
|
constructor(queue: GuildQueue<Meta>);
|
|
539
|
+
/**
|
|
540
|
+
* Volume transformer
|
|
541
|
+
*/
|
|
376
542
|
get volume(): _discord_player_equalizer.VolumeTransformer | null;
|
|
543
|
+
/**
|
|
544
|
+
* 15 Band Equalizer
|
|
545
|
+
*/
|
|
377
546
|
get equalizer(): _discord_player_equalizer.EqualizerStream | null;
|
|
547
|
+
/**
|
|
548
|
+
* Digital biquad filters
|
|
549
|
+
*/
|
|
378
550
|
get biquad(): _discord_player_equalizer.BiquadStream | null;
|
|
551
|
+
/**
|
|
552
|
+
* DSP filters
|
|
553
|
+
*/
|
|
379
554
|
get filters(): _discord_player_equalizer.AudioFilter | null;
|
|
555
|
+
/**
|
|
556
|
+
* Audio resampler
|
|
557
|
+
*/
|
|
380
558
|
get resampler(): _discord_player_equalizer.PCMResampler | null;
|
|
559
|
+
/**
|
|
560
|
+
* Replay current track in transition mode
|
|
561
|
+
* @param seek The duration to seek to
|
|
562
|
+
*/
|
|
381
563
|
triggerReplay(seek?: number): Promise<boolean>;
|
|
382
564
|
}
|
|
383
565
|
declare class AFilterGraph<Meta = unknown> {
|
|
@@ -408,9 +590,11 @@ interface GuildNodeInit<Meta = unknown> {
|
|
|
408
590
|
biquad: BiquadFilters | boolean | undefined;
|
|
409
591
|
resampler: number | boolean;
|
|
410
592
|
filterer: PCMFilters[] | boolean;
|
|
593
|
+
ffmpegFilters: FiltersName[];
|
|
411
594
|
disableHistory: boolean;
|
|
412
595
|
skipOnNoStream: boolean;
|
|
413
596
|
onBeforeCreateStream?: OnBeforeCreateStreamHandler;
|
|
597
|
+
onAfterCreateStream?: OnAfterCreateStreamHandler;
|
|
414
598
|
repeatMode?: QueueRepeatMode;
|
|
415
599
|
leaveOnEmpty: boolean;
|
|
416
600
|
leaveOnEmptyCooldown: number;
|
|
@@ -418,13 +602,22 @@ interface GuildNodeInit<Meta = unknown> {
|
|
|
418
602
|
leaveOnEndCooldown: number;
|
|
419
603
|
leaveOnStop: boolean;
|
|
420
604
|
leaveOnStopCooldown: number;
|
|
605
|
+
connectionTimeout: number;
|
|
606
|
+
selfDeaf?: boolean;
|
|
421
607
|
metadata?: Meta | null;
|
|
608
|
+
bufferingTimeout: number;
|
|
422
609
|
}
|
|
423
610
|
interface VoiceConnectConfig {
|
|
424
611
|
deaf?: boolean;
|
|
425
612
|
timeout?: number;
|
|
426
613
|
}
|
|
614
|
+
interface PostProcessedResult {
|
|
615
|
+
stream: Readable;
|
|
616
|
+
type: StreamType;
|
|
617
|
+
}
|
|
427
618
|
type OnBeforeCreateStreamHandler = (track: Track, queryType: SearchQueryType, queue: GuildQueue) => Promise<Readable | null>;
|
|
619
|
+
type OnAfterCreateStreamHandler = (stream: Readable, queue: GuildQueue) => Promise<PostProcessedResult | null>;
|
|
620
|
+
type PlayerTriggeredReason = 'filters' | 'normal';
|
|
428
621
|
interface GuildQueueEvents<Meta = unknown> {
|
|
429
622
|
/**
|
|
430
623
|
* Emitted when audio track is added to the queue
|
|
@@ -496,8 +689,13 @@ interface GuildQueueEvents<Meta = unknown> {
|
|
|
496
689
|
*/
|
|
497
690
|
playerSkip: (queue: GuildQueue<Meta>, track: Track) => unknown;
|
|
498
691
|
/**
|
|
499
|
-
* Emitted when the
|
|
500
|
-
*
|
|
692
|
+
* Emitted when the audio player is triggered
|
|
693
|
+
* @param queue The queue where this event occurred
|
|
694
|
+
* @param track The track which was played in this event
|
|
695
|
+
*/
|
|
696
|
+
playerTrigger: (queue: GuildQueue<Meta>, track: Track, reason: PlayerTriggeredReason) => unknown;
|
|
697
|
+
/**
|
|
698
|
+
* Emitted when the voice state is updated. Consuming this event may disable default voice state update handler if `Player.isVoiceStateHandlerLocked()` returns `false`.
|
|
501
699
|
* @param queue The queue where this event occurred
|
|
502
700
|
* @param oldState The old voice state
|
|
503
701
|
* @param newState The new voice state
|
|
@@ -509,70 +707,137 @@ declare class GuildQueue<Meta = unknown> {
|
|
|
509
707
|
player: Player;
|
|
510
708
|
options: GuildNodeInit<Meta>;
|
|
511
709
|
private __current;
|
|
512
|
-
tracks: Queue
|
|
710
|
+
tracks: Queue<Track>;
|
|
513
711
|
history: GuildQueueHistory<Meta>;
|
|
514
712
|
dispatcher: StreamDispatcher | null;
|
|
515
713
|
node: GuildQueuePlayerNode<Meta>;
|
|
516
714
|
filters: GuildQueueAudioFilters<Meta>;
|
|
517
715
|
onBeforeCreateStream: OnBeforeCreateStreamHandler;
|
|
716
|
+
onAfterCreateStream: OnAfterCreateStreamHandler;
|
|
518
717
|
repeatMode: QueueRepeatMode;
|
|
519
718
|
timeouts: Collection<string, NodeJS.Timeout>;
|
|
719
|
+
stats: GuildQueueStatistics<Meta>;
|
|
520
720
|
constructor(player: Player, options: GuildNodeInit<Meta>);
|
|
721
|
+
/**
|
|
722
|
+
* Write a debug message to this queue
|
|
723
|
+
* @param m The message to write
|
|
724
|
+
*/
|
|
521
725
|
debug(m: string): void;
|
|
726
|
+
/**
|
|
727
|
+
* The metadata of this queue
|
|
728
|
+
*/
|
|
522
729
|
get metadata(): Meta | undefined | null;
|
|
523
730
|
set metadata(m: Meta | undefined | null);
|
|
731
|
+
/**
|
|
732
|
+
* Set metadata for this queue
|
|
733
|
+
* @param m Metadata to set
|
|
734
|
+
*/
|
|
524
735
|
setMetadata(m: Meta | undefined | null): void;
|
|
736
|
+
/**
|
|
737
|
+
* Indicates if this queue is currently initializing
|
|
738
|
+
*/
|
|
525
739
|
get initializing(): boolean;
|
|
526
740
|
set initializing(v: boolean);
|
|
741
|
+
/**
|
|
742
|
+
* Indicates current track of this queue
|
|
743
|
+
*/
|
|
527
744
|
get currentTrack(): Track | null;
|
|
745
|
+
/**
|
|
746
|
+
* Indicates if this queue was deleted previously
|
|
747
|
+
*/
|
|
528
748
|
get deleted(): boolean;
|
|
749
|
+
/**
|
|
750
|
+
* The voice channel of this queue
|
|
751
|
+
*/
|
|
529
752
|
get channel(): VoiceBasedChannel | null;
|
|
530
753
|
set channel(c: VoiceBasedChannel | null);
|
|
754
|
+
/**
|
|
755
|
+
* The voice connection of this queue
|
|
756
|
+
*/
|
|
531
757
|
get connection(): _discordjs_voice.VoiceConnection | null;
|
|
758
|
+
/**
|
|
759
|
+
* The guild this queue belongs to
|
|
760
|
+
*/
|
|
532
761
|
get guild(): Guild;
|
|
762
|
+
/**
|
|
763
|
+
* The id of this queue
|
|
764
|
+
*/
|
|
533
765
|
get id(): string;
|
|
766
|
+
/**
|
|
767
|
+
* Set transition mode for this queue
|
|
768
|
+
* @param state The state to set
|
|
769
|
+
*/
|
|
534
770
|
setTransitioning(state: boolean): void;
|
|
771
|
+
/**
|
|
772
|
+
* if this queue is currently under transition mode
|
|
773
|
+
*/
|
|
535
774
|
isTransitioning(): boolean;
|
|
775
|
+
/**
|
|
776
|
+
* Set repeat mode for this queue
|
|
777
|
+
* @param mode The repeat mode to apply
|
|
778
|
+
*/
|
|
536
779
|
setRepeatMode(mode: QueueRepeatMode): void;
|
|
780
|
+
/**
|
|
781
|
+
* Check if this queue has no tracks left in it
|
|
782
|
+
*/
|
|
537
783
|
isEmpty(): boolean;
|
|
784
|
+
/**
|
|
785
|
+
* Check if this queue currently holds active audio resource
|
|
786
|
+
*/
|
|
538
787
|
isPlaying(): boolean;
|
|
788
|
+
/**
|
|
789
|
+
* Add track to the queue
|
|
790
|
+
* @param track Track or playlist or array of tracks to add
|
|
791
|
+
*/
|
|
539
792
|
addTrack(track: Track | Track[] | Playlist): void;
|
|
793
|
+
/**
|
|
794
|
+
* Connect to a voice channel
|
|
795
|
+
* @param channelResolvable The voice channel to connect to
|
|
796
|
+
* @param options Join config
|
|
797
|
+
*/
|
|
540
798
|
connect(channelResolvable: GuildVoiceChannelResolvable, options?: VoiceConnectConfig): Promise<this>;
|
|
799
|
+
/**
|
|
800
|
+
* The voice connection latency of this queue
|
|
801
|
+
*/
|
|
541
802
|
get ping(): number;
|
|
803
|
+
/**
|
|
804
|
+
* Delete this queue
|
|
805
|
+
*/
|
|
542
806
|
delete(): void;
|
|
807
|
+
/**
|
|
808
|
+
* Wait for this queue to initialize
|
|
809
|
+
*/
|
|
543
810
|
awaitInitialization(): Promise<boolean>;
|
|
544
811
|
}
|
|
545
812
|
|
|
546
|
-
interface
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
813
|
+
interface GuildQueueStatisticsMetadata {
|
|
814
|
+
latency: {
|
|
815
|
+
eventLoop: number;
|
|
816
|
+
voiceConnection: number;
|
|
817
|
+
};
|
|
818
|
+
status: {
|
|
819
|
+
buffering: boolean;
|
|
820
|
+
playing: boolean;
|
|
821
|
+
paused: boolean;
|
|
822
|
+
idle: boolean;
|
|
823
|
+
};
|
|
824
|
+
tracksCount: number;
|
|
825
|
+
historySize: number;
|
|
826
|
+
extractors: number;
|
|
827
|
+
listeners: number;
|
|
828
|
+
memoryUsage: NodeJS.MemoryUsage;
|
|
829
|
+
versions: {
|
|
830
|
+
node: string;
|
|
831
|
+
player: string;
|
|
832
|
+
};
|
|
564
833
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
has(node: NodeResolvable): boolean;
|
|
573
|
-
delete(node: NodeResolvable): boolean;
|
|
574
|
-
resolve<T = Meta>(node: NodeResolvable): GuildQueue<unknown> | undefined;
|
|
575
|
-
resolveId(node: NodeResolvable): string | null;
|
|
834
|
+
declare class GuildQueueStatistics<Meta = unknown> {
|
|
835
|
+
queue: GuildQueue<Meta>;
|
|
836
|
+
constructor(queue: GuildQueue<Meta>);
|
|
837
|
+
/**
|
|
838
|
+
* Generate statistics of this queue
|
|
839
|
+
*/
|
|
840
|
+
generate(): GuildQueueStatisticsMetadata;
|
|
576
841
|
}
|
|
577
842
|
|
|
578
843
|
declare class VoiceUtils {
|
|
@@ -591,6 +856,7 @@ declare class VoiceUtils {
|
|
|
591
856
|
connect(channel: VoiceChannel | StageChannel, options?: {
|
|
592
857
|
deaf?: boolean;
|
|
593
858
|
maxTime?: number;
|
|
859
|
+
queue: GuildQueue;
|
|
594
860
|
}): Promise<StreamDispatcher>;
|
|
595
861
|
/**
|
|
596
862
|
* Joins a voice channel
|
|
@@ -666,6 +932,12 @@ declare class BaseExtractor {
|
|
|
666
932
|
* @param args The data to dispatch
|
|
667
933
|
*/
|
|
668
934
|
emit<K extends keyof PlayerEvents>(event: K, ...args: Parameters<PlayerEvents[K]>): boolean;
|
|
935
|
+
/**
|
|
936
|
+
* Create extractor response
|
|
937
|
+
* @param playlist The playlist
|
|
938
|
+
* @param tracks The track array
|
|
939
|
+
*/
|
|
940
|
+
createResponse(playlist?: Playlist | null, tracks?: Track[]): ExtractorInfo;
|
|
669
941
|
}
|
|
670
942
|
type NextFunction = (error?: Error | null, stream?: Readable) => void;
|
|
671
943
|
interface ExtractorInfo {
|
|
@@ -687,7 +959,7 @@ declare class ExtractorExecutionContext {
|
|
|
687
959
|
register(_extractor: typeof BaseExtractor): Promise<void>;
|
|
688
960
|
unregister<K extends string | BaseExtractor>(_extractor: K): Promise<void>;
|
|
689
961
|
unregisterAll(): Promise<void>;
|
|
690
|
-
run<T = unknown>(fn: ExtractorExecutionFN<T
|
|
962
|
+
run<T = unknown>(fn: ExtractorExecutionFN<T>, filterBlocked?: boolean): Promise<ExtractorExecutionResult<T> | null>;
|
|
691
963
|
}
|
|
692
964
|
interface ExtractorExecutionResult<T = unknown> {
|
|
693
965
|
extractor: BaseExtractor;
|
|
@@ -707,16 +979,49 @@ declare class SearchResult {
|
|
|
707
979
|
player: Player;
|
|
708
980
|
private _data;
|
|
709
981
|
constructor(player: Player, _data: SearchResultData);
|
|
982
|
+
/**
|
|
983
|
+
* The search query
|
|
984
|
+
*/
|
|
710
985
|
get query(): string;
|
|
986
|
+
/**
|
|
987
|
+
* The search query type
|
|
988
|
+
*/
|
|
711
989
|
get queryType(): SearchQueryType | `ext:${string}`;
|
|
990
|
+
/**
|
|
991
|
+
* The extractor
|
|
992
|
+
*/
|
|
712
993
|
get extractor(): BaseExtractor | null;
|
|
994
|
+
/**
|
|
995
|
+
* Playlist result
|
|
996
|
+
*/
|
|
713
997
|
get playlist(): Playlist | null | undefined;
|
|
998
|
+
/**
|
|
999
|
+
* Tracks result
|
|
1000
|
+
*/
|
|
714
1001
|
get tracks(): Track[];
|
|
1002
|
+
/**
|
|
1003
|
+
* Requested by
|
|
1004
|
+
*/
|
|
715
1005
|
get requestedBy(): User | null;
|
|
1006
|
+
/**
|
|
1007
|
+
* Re-execute this search
|
|
1008
|
+
*/
|
|
716
1009
|
execute(): Promise<SearchResult>;
|
|
1010
|
+
/**
|
|
1011
|
+
* If this search result is empty
|
|
1012
|
+
*/
|
|
717
1013
|
isEmpty(): boolean;
|
|
1014
|
+
/**
|
|
1015
|
+
* If this search result has playlist
|
|
1016
|
+
*/
|
|
718
1017
|
hasPlaylist(): boolean;
|
|
1018
|
+
/**
|
|
1019
|
+
* If this search result has tracks
|
|
1020
|
+
*/
|
|
719
1021
|
hasTracks(): boolean;
|
|
1022
|
+
/**
|
|
1023
|
+
* JSON representation of this search
|
|
1024
|
+
*/
|
|
720
1025
|
toJSON(): {
|
|
721
1026
|
query: string;
|
|
722
1027
|
queryType: SearchQueryType | `ext:${string}`;
|
|
@@ -727,14 +1032,41 @@ declare class SearchResult {
|
|
|
727
1032
|
};
|
|
728
1033
|
}
|
|
729
1034
|
|
|
1035
|
+
interface QueryCacheOptions {
|
|
1036
|
+
checkInterval?: number;
|
|
1037
|
+
}
|
|
1038
|
+
declare class QueryCache {
|
|
1039
|
+
#private;
|
|
1040
|
+
player: Player;
|
|
1041
|
+
options: QueryCacheOptions;
|
|
1042
|
+
timer: NodeJS.Timer;
|
|
1043
|
+
fuse: Fuse<Track>;
|
|
1044
|
+
constructor(player: Player, options?: QueryCacheOptions);
|
|
1045
|
+
get checkInterval(): number;
|
|
1046
|
+
cleanup(): Promise<void>;
|
|
1047
|
+
clear(): Promise<void>;
|
|
1048
|
+
getData(): Promise<DiscordPlayerQueryResultCache<Track>[]>;
|
|
1049
|
+
addData(data: SearchResult): Promise<void>;
|
|
1050
|
+
resolve(context: QueryCacheResolverContext): Promise<SearchResult>;
|
|
1051
|
+
}
|
|
1052
|
+
declare class DiscordPlayerQueryResultCache<T = unknown> {
|
|
1053
|
+
data: T;
|
|
1054
|
+
expireAfter: number;
|
|
1055
|
+
constructor(data: T, expireAfter?: number);
|
|
1056
|
+
hasExpired(): boolean;
|
|
1057
|
+
}
|
|
1058
|
+
interface QueryCacheResolverContext {
|
|
1059
|
+
query: string;
|
|
1060
|
+
requestedBy?: User;
|
|
1061
|
+
queryType?: SearchQueryType | `ext:${string}`;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
730
1064
|
declare class Player extends EventEmitter<PlayerEvents> {
|
|
731
1065
|
#private;
|
|
1066
|
+
static _singletonKey: symbol;
|
|
1067
|
+
readonly id: string;
|
|
732
1068
|
readonly client: Client;
|
|
733
1069
|
readonly options: PlayerInitOptions;
|
|
734
|
-
/**
|
|
735
|
-
* @deprecated
|
|
736
|
-
*/
|
|
737
|
-
readonly queues: Collection<string, Queue<unknown>>;
|
|
738
1070
|
nodes: GuildNodeManager<unknown>;
|
|
739
1071
|
readonly voiceUtils: VoiceUtils;
|
|
740
1072
|
requiredEvents: string[];
|
|
@@ -747,35 +1079,45 @@ declare class Player extends EventEmitter<PlayerEvents> {
|
|
|
747
1079
|
*/
|
|
748
1080
|
constructor(client: Client, options?: PlayerInitOptions);
|
|
749
1081
|
/**
|
|
750
|
-
*
|
|
751
|
-
* @
|
|
1082
|
+
* Creates discord-player singleton instance.
|
|
1083
|
+
* @param client The client that instantiated player
|
|
1084
|
+
* @param options Player initializer options
|
|
752
1085
|
*/
|
|
753
|
-
|
|
1086
|
+
static singleton(client: Client, options?: PlayerInitOptions): Player;
|
|
754
1087
|
/**
|
|
755
|
-
*
|
|
1088
|
+
* Get all active player instances
|
|
756
1089
|
*/
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
1090
|
+
static getAllPlayers(): Player[];
|
|
1091
|
+
/**
|
|
1092
|
+
* Clear all player instances
|
|
1093
|
+
*/
|
|
1094
|
+
static clearAllPlayers(): void;
|
|
1095
|
+
/**
|
|
1096
|
+
* The current query cache provider
|
|
1097
|
+
*/
|
|
1098
|
+
get queryCache(): QueryCache | null;
|
|
1099
|
+
/**
|
|
1100
|
+
* Alias to `Player.nodes`
|
|
1101
|
+
*/
|
|
1102
|
+
get queues(): GuildNodeManager<unknown>;
|
|
1103
|
+
/**
|
|
1104
|
+
* Event loop lag
|
|
1105
|
+
* @type {number}
|
|
1106
|
+
*/
|
|
1107
|
+
get eventLoopLag(): number;
|
|
1108
|
+
/**
|
|
1109
|
+
* Generates statistics
|
|
1110
|
+
*/
|
|
1111
|
+
generateStatistics(): {
|
|
1112
|
+
instances: number;
|
|
1113
|
+
queuesCount: number;
|
|
1114
|
+
queryCacheEnabled: boolean;
|
|
1115
|
+
queues: GuildQueueStatisticsMetadata[];
|
|
1116
|
+
};
|
|
1117
|
+
/**
|
|
1118
|
+
* Destroy player
|
|
1119
|
+
*/
|
|
1120
|
+
destroy(): Promise<void>;
|
|
779
1121
|
private _handleVoiceState;
|
|
780
1122
|
/**
|
|
781
1123
|
* Handles voice state update
|
|
@@ -784,48 +1126,23 @@ declare class Player extends EventEmitter<PlayerEvents> {
|
|
|
784
1126
|
* @returns {void}
|
|
785
1127
|
*/
|
|
786
1128
|
handleVoiceState(oldState: VoiceState, newState: VoiceState): void;
|
|
787
|
-
lockVoiceStateHandler(): void;
|
|
788
|
-
unlockVoiceStateHandler(): void;
|
|
789
|
-
isVoiceStateHandlerLocked(): boolean;
|
|
790
1129
|
/**
|
|
791
|
-
*
|
|
792
|
-
* @param {GuildResolvable} guild The guild
|
|
793
|
-
* @param {PlayerOptions} queueInitOptions Queue init options
|
|
794
|
-
* @returns {Queue}
|
|
1130
|
+
* Lock voice state handler
|
|
795
1131
|
*/
|
|
796
|
-
|
|
797
|
-
metadata?: T;
|
|
798
|
-
}): Queue<T>;
|
|
1132
|
+
lockVoiceStateHandler(): void;
|
|
799
1133
|
/**
|
|
800
|
-
*
|
|
801
|
-
* @param {GuildResolvable} guild The guild id
|
|
802
|
-
* @returns {Queue | undefined}
|
|
1134
|
+
* Unlock voice state handler
|
|
803
1135
|
*/
|
|
804
|
-
|
|
1136
|
+
unlockVoiceStateHandler(): void;
|
|
805
1137
|
/**
|
|
806
|
-
*
|
|
807
|
-
* @param {GuildResolvable} guild The guild id to remove
|
|
808
|
-
* @returns {Queue}
|
|
1138
|
+
* Checks if voice state handler is locked
|
|
809
1139
|
*/
|
|
810
|
-
|
|
1140
|
+
isVoiceStateHandlerLocked(): boolean;
|
|
811
1141
|
/**
|
|
812
1142
|
* Initiate audio player
|
|
813
1143
|
* @param channel The voice channel on which the music should be played
|
|
814
1144
|
* @param query The track or source to play
|
|
815
1145
|
* @param options Options for player
|
|
816
|
-
* @example ```js
|
|
817
|
-
* const client = new Discord.Client({ intents: ['GuildVoiceStates'] });
|
|
818
|
-
* const player = new Player(client);
|
|
819
|
-
*
|
|
820
|
-
* // play
|
|
821
|
-
* const query = message.getQuerySomehow();
|
|
822
|
-
*
|
|
823
|
-
* await player.play(message.member.voice.channel, query, {
|
|
824
|
-
* nodeOptions: {
|
|
825
|
-
* metadata: message
|
|
826
|
-
* }
|
|
827
|
-
* });
|
|
828
|
-
* ```
|
|
829
1146
|
*/
|
|
830
1147
|
play<T = unknown>(channel: GuildVoiceChannelResolvable, query: string | Track | SearchResult, options?: SearchOptions & {
|
|
831
1148
|
nodeOptions?: GuildNodeCreateOptions<T>;
|
|
@@ -854,14 +1171,7 @@ declare class Player extends EventEmitter<PlayerEvents> {
|
|
|
854
1171
|
*/
|
|
855
1172
|
scanDeps(): string;
|
|
856
1173
|
emit<U extends keyof PlayerEvents>(eventName: U, ...args: Parameters<PlayerEvents[U]>): boolean;
|
|
857
|
-
|
|
858
|
-
* Resolves queue
|
|
859
|
-
* @param {GuildResolvable|Queue} queueLike Queue like object
|
|
860
|
-
* @returns {Queue}
|
|
861
|
-
* @deprecated
|
|
862
|
-
*/
|
|
863
|
-
resolveQueue<T>(queueLike: GuildResolvable | Queue): Queue<T>;
|
|
864
|
-
[Symbol.iterator](): Generator<Queue<unknown> | GuildQueue<unknown>, void, undefined>;
|
|
1174
|
+
[Symbol.iterator](): Generator<GuildQueue<unknown>, void, undefined>;
|
|
865
1175
|
/**
|
|
866
1176
|
* Creates `Playlist` instance
|
|
867
1177
|
* @param data The data to initialize a playlist
|
|
@@ -869,297 +1179,97 @@ declare class Player extends EventEmitter<PlayerEvents> {
|
|
|
869
1179
|
createPlaylist(data: PlaylistInitData): Playlist;
|
|
870
1180
|
}
|
|
871
1181
|
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
1182
|
+
interface GuildNodeCreateOptions<T = unknown> {
|
|
1183
|
+
strategy?: QueueStrategy;
|
|
1184
|
+
volume?: number | boolean;
|
|
1185
|
+
equalizer?: EqualizerBand[] | boolean;
|
|
1186
|
+
a_filter?: PCMFilters[] | boolean;
|
|
1187
|
+
biquad?: BiquadFilters | boolean;
|
|
1188
|
+
resampler?: number | boolean;
|
|
1189
|
+
disableHistory?: boolean;
|
|
1190
|
+
skipOnNoStream?: boolean;
|
|
1191
|
+
onBeforeCreateStream?: OnBeforeCreateStreamHandler;
|
|
1192
|
+
onAfterCreateStream?: OnAfterCreateStreamHandler;
|
|
1193
|
+
repeatMode?: QueueRepeatMode;
|
|
1194
|
+
leaveOnEmpty?: boolean;
|
|
1195
|
+
leaveOnEmptyCooldown?: number;
|
|
1196
|
+
leaveOnEnd?: boolean;
|
|
1197
|
+
leaveOnEndCooldown?: number;
|
|
1198
|
+
leaveOnStop?: boolean;
|
|
1199
|
+
leaveOnStopCooldown?: number;
|
|
884
1200
|
metadata?: T | null;
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
/**
|
|
896
|
-
* Queue constructor
|
|
897
|
-
* @param {Player} player The player that instantiated this queue
|
|
898
|
-
* @param {Guild} guild The guild that instantiated this queue
|
|
899
|
-
* @param {PlayerOptions} [options] Player options for the queue
|
|
900
|
-
*/
|
|
901
|
-
constructor(player: Player, guild: Guild, options?: PlayerOptions);
|
|
902
|
-
/**
|
|
903
|
-
* The PCM filterer
|
|
904
|
-
*/
|
|
905
|
-
get filters(): _discord_player_equalizer.AudioFilter | null;
|
|
906
|
-
get equalizer(): _discord_player_equalizer.EqualizerStream | null;
|
|
907
|
-
get biquad(): _discord_player_equalizer.BiquadStream | null;
|
|
908
|
-
/**
|
|
909
|
-
* Forces next play
|
|
910
|
-
* @returns {Promise<void>}
|
|
911
|
-
*/
|
|
912
|
-
forceNext(): Promise<void>;
|
|
913
|
-
/**
|
|
914
|
-
* Returns current track
|
|
915
|
-
* @type {Track}
|
|
916
|
-
*/
|
|
917
|
-
get current(): Track | undefined;
|
|
918
|
-
/**
|
|
919
|
-
* If this queue is destroyed
|
|
920
|
-
* @type {boolean}
|
|
921
|
-
*/
|
|
922
|
-
get destroyed(): boolean;
|
|
923
|
-
/**
|
|
924
|
-
* Returns current track
|
|
925
|
-
* @returns {Track}
|
|
926
|
-
*/
|
|
927
|
-
nowPlaying(): Track | undefined;
|
|
928
|
-
/**
|
|
929
|
-
* Connects to a voice channel
|
|
930
|
-
* @param {GuildChannelResolvable} channel The voice/stage channel
|
|
931
|
-
* @returns {Promise<Queue>}
|
|
932
|
-
*/
|
|
933
|
-
connect(channel: GuildChannelResolvable): Promise<this | undefined>;
|
|
934
|
-
private emitEnd;
|
|
935
|
-
private refreshEndCooldown;
|
|
936
|
-
/**
|
|
937
|
-
* Destroys this queue
|
|
938
|
-
* @param {boolean} [disconnect=this.options.leaveOnStop] If it should leave on destroy
|
|
939
|
-
* @returns {void}
|
|
940
|
-
*/
|
|
941
|
-
destroy(disconnect?: boolean | undefined): void;
|
|
942
|
-
/**
|
|
943
|
-
* Skips current track
|
|
944
|
-
* @returns {boolean}
|
|
945
|
-
*/
|
|
946
|
-
skip(): boolean | undefined;
|
|
947
|
-
/**
|
|
948
|
-
* Adds single track to the queue
|
|
949
|
-
* @param {Track} track The track to add
|
|
950
|
-
* @returns {void}
|
|
951
|
-
*/
|
|
952
|
-
addTrack(track: Track): void;
|
|
953
|
-
/**
|
|
954
|
-
* Adds multiple tracks to the queue
|
|
955
|
-
* @param {Track[]} tracks Array of tracks to add
|
|
956
|
-
*/
|
|
957
|
-
addTracks(tracks: Track[]): void;
|
|
958
|
-
/**
|
|
959
|
-
* Sets paused state
|
|
960
|
-
* @param {boolean} paused The paused state
|
|
961
|
-
* @returns {boolean}
|
|
962
|
-
*/
|
|
963
|
-
setPaused(paused?: boolean): boolean;
|
|
964
|
-
/**
|
|
965
|
-
* If the player is currently paused
|
|
966
|
-
*/
|
|
967
|
-
get paused(): boolean;
|
|
968
|
-
set paused(val: boolean);
|
|
969
|
-
/**
|
|
970
|
-
* Pause the playback
|
|
971
|
-
*/
|
|
972
|
-
pause(): boolean;
|
|
973
|
-
/**
|
|
974
|
-
* Resume the playback
|
|
975
|
-
*/
|
|
976
|
-
resume(): boolean;
|
|
977
|
-
/**
|
|
978
|
-
* Sets bitrate
|
|
979
|
-
* @param {number|auto} bitrate bitrate to set
|
|
980
|
-
* @returns {void}
|
|
981
|
-
*/
|
|
982
|
-
setBitrate(bitrate: number | 'auto'): void;
|
|
983
|
-
/**
|
|
984
|
-
* Sets volume
|
|
985
|
-
* @param {number} amount The volume amount
|
|
986
|
-
* @returns {boolean}
|
|
987
|
-
*/
|
|
988
|
-
setVolume(amount: number): boolean | undefined;
|
|
989
|
-
/**
|
|
990
|
-
* Sets repeat mode
|
|
991
|
-
* @param {QueueRepeatMode} mode The repeat mode
|
|
992
|
-
* @returns {boolean}
|
|
993
|
-
*/
|
|
994
|
-
setRepeatMode(mode: QueueRepeatMode): boolean | undefined;
|
|
995
|
-
/**
|
|
996
|
-
* The current volume amount
|
|
997
|
-
* @type {number}
|
|
998
|
-
*/
|
|
999
|
-
get volume(): number;
|
|
1000
|
-
set volume(amount: number);
|
|
1001
|
-
/**
|
|
1002
|
-
* The stream time of this queue
|
|
1003
|
-
* @type {number}
|
|
1004
|
-
*/
|
|
1005
|
-
get streamTime(): number;
|
|
1006
|
-
set streamTime(time: number);
|
|
1007
|
-
/**
|
|
1008
|
-
* Returns enabled filters
|
|
1009
|
-
* @returns {AudioFilters}
|
|
1010
|
-
*/
|
|
1011
|
-
getFiltersEnabled(): (keyof QueueFilters)[] | undefined;
|
|
1012
|
-
/**
|
|
1013
|
-
* Returns disabled filters
|
|
1014
|
-
* @returns {AudioFilters}
|
|
1015
|
-
*/
|
|
1016
|
-
getFiltersDisabled(): (keyof QueueFilters)[] | undefined;
|
|
1017
|
-
/**
|
|
1018
|
-
* Sets filters
|
|
1019
|
-
* @param {QueueFilters} filters Queue filters
|
|
1020
|
-
* @returns {Promise<void>}
|
|
1021
|
-
*/
|
|
1022
|
-
setFilters(filters?: QueueFilters): Promise<void>;
|
|
1023
|
-
/**
|
|
1024
|
-
* Seeks to the given time
|
|
1025
|
-
* @param {number} position The position
|
|
1026
|
-
* @returns {boolean}
|
|
1027
|
-
*/
|
|
1028
|
-
seek(position: number): Promise<boolean | undefined>;
|
|
1029
|
-
/**
|
|
1030
|
-
* Plays previous track
|
|
1031
|
-
* @returns {Promise<void>}
|
|
1032
|
-
*/
|
|
1033
|
-
back(): Promise<void>;
|
|
1034
|
-
/**
|
|
1035
|
-
* Clear this queue
|
|
1036
|
-
*/
|
|
1037
|
-
clear(): void;
|
|
1038
|
-
/**
|
|
1039
|
-
* Stops the player
|
|
1040
|
-
* @returns {void}
|
|
1041
|
-
*/
|
|
1042
|
-
stop(): void;
|
|
1043
|
-
/**
|
|
1044
|
-
* Shuffles this queue
|
|
1045
|
-
* @returns {boolean}
|
|
1046
|
-
*/
|
|
1047
|
-
shuffle(): boolean | undefined;
|
|
1048
|
-
/**
|
|
1049
|
-
* Removes a track from the queue
|
|
1050
|
-
* @param {Track|string|number} track The track to remove
|
|
1051
|
-
* @returns {Track}
|
|
1052
|
-
*/
|
|
1053
|
-
remove(track: Track | string | number): Track | undefined;
|
|
1054
|
-
/**
|
|
1055
|
-
* Returns the index of the specified track. If found, returns the track index else returns -1.
|
|
1056
|
-
* @param {number|Track|string} track The track
|
|
1057
|
-
* @returns {number}
|
|
1058
|
-
*/
|
|
1059
|
-
getTrackPosition(track: number | Track | string): number | undefined;
|
|
1060
|
-
/**
|
|
1061
|
-
* Jumps to particular track
|
|
1062
|
-
* @param {Track|number} track The track
|
|
1063
|
-
* @returns {void}
|
|
1064
|
-
*/
|
|
1065
|
-
jump(track: Track | number): void;
|
|
1066
|
-
/**
|
|
1067
|
-
* Jumps to particular track, removing other tracks on the way
|
|
1068
|
-
* @param {Track|number} track The track
|
|
1069
|
-
* @returns {void}
|
|
1070
|
-
*/
|
|
1071
|
-
skipTo(track: Track | number): void;
|
|
1072
|
-
/**
|
|
1073
|
-
* Inserts the given track to specified index
|
|
1074
|
-
* @param {Track} track The track to insert
|
|
1075
|
-
* @param {number} [index=0] The index where this track should be
|
|
1076
|
-
*/
|
|
1077
|
-
insert(track: Track, index?: number): void;
|
|
1078
|
-
/**
|
|
1079
|
-
* @typedef {object} PlayerTimestamp
|
|
1080
|
-
* @property {string} current The current progress
|
|
1081
|
-
* @property {string} end The total time
|
|
1082
|
-
* @property {number} progress Progress in %
|
|
1083
|
-
*/
|
|
1084
|
-
/**
|
|
1085
|
-
* Returns player stream timestamp
|
|
1086
|
-
* @returns {PlayerTimestamp}
|
|
1087
|
-
*/
|
|
1088
|
-
getPlayerTimestamp(): {
|
|
1089
|
-
current: string;
|
|
1090
|
-
end: string;
|
|
1091
|
-
progress: number;
|
|
1092
|
-
} | undefined;
|
|
1093
|
-
/**
|
|
1094
|
-
* Creates progress bar string
|
|
1095
|
-
* @param {PlayerProgressbarOptions} options The progress bar options
|
|
1096
|
-
* @returns {string}
|
|
1097
|
-
*/
|
|
1098
|
-
createProgressBar(options?: PlayerProgressbarOptions): string | undefined;
|
|
1201
|
+
selfDeaf?: boolean;
|
|
1202
|
+
connectionTimeout?: number;
|
|
1203
|
+
defaultFFmpegFilters?: FiltersName[];
|
|
1204
|
+
bufferingTimeout?: number;
|
|
1205
|
+
}
|
|
1206
|
+
type NodeResolvable = GuildQueue | GuildResolvable;
|
|
1207
|
+
declare class GuildNodeManager<Meta = unknown> {
|
|
1208
|
+
player: Player;
|
|
1209
|
+
cache: Collection<string, GuildQueue<unknown>>;
|
|
1210
|
+
constructor(player: Player);
|
|
1099
1211
|
/**
|
|
1100
|
-
*
|
|
1101
|
-
* @
|
|
1212
|
+
* Create guild queue if it does not exist
|
|
1213
|
+
* @param guild The guild which will be the owner of the queue
|
|
1214
|
+
* @param options Queue initializer options
|
|
1102
1215
|
*/
|
|
1103
|
-
|
|
1216
|
+
create<T = Meta>(guild: GuildResolvable, options?: GuildNodeCreateOptions<T>): GuildQueue<T>;
|
|
1104
1217
|
/**
|
|
1105
|
-
*
|
|
1218
|
+
* Get existing queue
|
|
1219
|
+
* @param node Queue resolvable
|
|
1106
1220
|
*/
|
|
1107
|
-
|
|
1108
|
-
guild: string;
|
|
1109
|
-
memory: NodeJS.MemoryUsage;
|
|
1110
|
-
tracks: number;
|
|
1111
|
-
os: {
|
|
1112
|
-
cpuCount: number;
|
|
1113
|
-
totalMem: number;
|
|
1114
|
-
freeMem: number;
|
|
1115
|
-
platform: NodeJS.Platform;
|
|
1116
|
-
};
|
|
1117
|
-
isShard: boolean;
|
|
1118
|
-
latency: {
|
|
1119
|
-
client: number;
|
|
1120
|
-
udp: number | undefined;
|
|
1121
|
-
ws: number | undefined;
|
|
1122
|
-
eventLoop: number;
|
|
1123
|
-
};
|
|
1124
|
-
subscribers: number;
|
|
1125
|
-
connections: number;
|
|
1126
|
-
extractors: number;
|
|
1127
|
-
};
|
|
1221
|
+
get<T = Meta>(node: NodeResolvable): GuildQueue<T> | null;
|
|
1128
1222
|
/**
|
|
1129
|
-
*
|
|
1130
|
-
* @
|
|
1223
|
+
* Check if a queue exists
|
|
1224
|
+
* @param node Queue resolvable
|
|
1131
1225
|
*/
|
|
1132
|
-
|
|
1226
|
+
has(node: NodeResolvable): boolean;
|
|
1133
1227
|
/**
|
|
1134
|
-
*
|
|
1135
|
-
* @param
|
|
1136
|
-
* @param {PlayOptions} [options] The options
|
|
1137
|
-
* @returns {Promise<void>}
|
|
1228
|
+
* Delete queue
|
|
1229
|
+
* @param node Queue resolvable
|
|
1138
1230
|
*/
|
|
1139
|
-
|
|
1231
|
+
delete(node: NodeResolvable): boolean;
|
|
1140
1232
|
/**
|
|
1141
|
-
*
|
|
1142
|
-
* @param
|
|
1143
|
-
* @returns {Promise<void>}
|
|
1144
|
-
* @private
|
|
1233
|
+
* Resolve queue
|
|
1234
|
+
* @param node Queue resolvable
|
|
1145
1235
|
*/
|
|
1146
|
-
|
|
1147
|
-
[Symbol.iterator](): Generator<Track, void, undefined>;
|
|
1236
|
+
resolve<T = Meta>(node: NodeResolvable): GuildQueue<unknown> | undefined;
|
|
1148
1237
|
/**
|
|
1149
|
-
*
|
|
1150
|
-
* @
|
|
1238
|
+
* Resolve queue id
|
|
1239
|
+
* @param node Queue resolvable
|
|
1151
1240
|
*/
|
|
1241
|
+
resolveId(node: NodeResolvable): string | null;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
declare enum ErrorStatusCode {
|
|
1245
|
+
STREAM_ERROR = "StreamError",
|
|
1246
|
+
AUDIO_PLAYER_ERROR = "AudioPlayerError",
|
|
1247
|
+
PLAYER_ERROR = "PlayerError",
|
|
1248
|
+
NO_AUDIO_RESOURCE = "NoAudioResource",
|
|
1249
|
+
UNKNOWN_GUILD = "UnknownGuild",
|
|
1250
|
+
INVALID_ARG_TYPE = "InvalidArgType",
|
|
1251
|
+
UNKNOWN_EXTRACTOR = "UnknownExtractor",
|
|
1252
|
+
INVALID_EXTRACTOR = "InvalidExtractor",
|
|
1253
|
+
INVALID_CHANNEL_TYPE = "InvalidChannelType",
|
|
1254
|
+
INVALID_TRACK = "InvalidTrack",
|
|
1255
|
+
UNKNOWN_REPEAT_MODE = "UnknownRepeatMode",
|
|
1256
|
+
TRACK_NOT_FOUND = "TrackNotFound",
|
|
1257
|
+
NO_CONNECTION = "NoConnection",
|
|
1258
|
+
DESTROYED_QUEUE = "DestroyedQueue"
|
|
1259
|
+
}
|
|
1260
|
+
declare class PlayerError extends Error {
|
|
1261
|
+
message: string;
|
|
1262
|
+
statusCode: ErrorStatusCode;
|
|
1263
|
+
createdAt: Date;
|
|
1264
|
+
constructor(message: string, code?: ErrorStatusCode);
|
|
1265
|
+
get createdTimestamp(): number;
|
|
1266
|
+
valueOf(): ErrorStatusCode;
|
|
1152
1267
|
toJSON(): {
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
} | undefined;
|
|
1159
|
-
/**
|
|
1160
|
-
* String representation of this queue
|
|
1161
|
-
* @returns {string}
|
|
1162
|
-
*/
|
|
1268
|
+
stack: string | undefined;
|
|
1269
|
+
code: ErrorStatusCode;
|
|
1270
|
+
message: string;
|
|
1271
|
+
created: number;
|
|
1272
|
+
};
|
|
1163
1273
|
toString(): string | undefined;
|
|
1164
1274
|
}
|
|
1165
1275
|
|
|
@@ -1205,6 +1315,7 @@ interface QueueFilters {
|
|
|
1205
1315
|
fadein?: boolean;
|
|
1206
1316
|
dim?: boolean;
|
|
1207
1317
|
earrape?: boolean;
|
|
1318
|
+
lofi?: boolean;
|
|
1208
1319
|
}
|
|
1209
1320
|
/**
|
|
1210
1321
|
* The track source:
|
|
@@ -1276,107 +1387,6 @@ interface PlayerProgressbarOptions {
|
|
|
1276
1387
|
indicator?: string;
|
|
1277
1388
|
queue?: boolean;
|
|
1278
1389
|
}
|
|
1279
|
-
/**
|
|
1280
|
-
* @typedef {object} PlayerOptions
|
|
1281
|
-
* @property {boolean} [leaveOnEnd=true] If it should leave on end
|
|
1282
|
-
* @property {boolean} [leaveOnStop=true] If it should leave on stop
|
|
1283
|
-
* @property {boolean} [leaveOnEmpty=true] If it should leave on empty
|
|
1284
|
-
* @property {number} [leaveOnEmptyCooldown=1000] The cooldown in ms
|
|
1285
|
-
* @property {number} [leaveOnEndCooldown=1000] The cooldown in ms
|
|
1286
|
-
* @property {boolean} [autoSelfDeaf=true] If it should set the bot in deaf mode
|
|
1287
|
-
* @property {YTDLDownloadOptions} [ytdlOptions] The youtube download options
|
|
1288
|
-
* @property {number} [initialVolume=100] The initial player volume
|
|
1289
|
-
* @property {number} [bufferingTimeout=3000] Buffering timeout for the stream
|
|
1290
|
-
* @property {boolean} [spotifyBridge=true] If player should bridge spotify source to youtube
|
|
1291
|
-
* @property {boolean} [disableVolume=false] If player should disable inline volume
|
|
1292
|
-
* @property {boolean} [disableEqualizer=false] If player should disable equalizer
|
|
1293
|
-
* @property {boolean} [disableBiquad=false] If player should disable biquad
|
|
1294
|
-
* @property {number} [volumeSmoothness=0] The volume transition smoothness between volume changes (lower the value to get better result)
|
|
1295
|
-
* Setting this or leaving this empty will disable this effect. Example: `volumeSmoothness: 0.1`
|
|
1296
|
-
* @property {EqualizerBand[]} [equalizerBands] The equalizer bands array for 15 band equalizer.
|
|
1297
|
-
* @property {BiquadFilters} [biquadFilter] The biquad filter initializer value
|
|
1298
|
-
* @property {boolean} [disableFilters] Disable/enable PCM filter
|
|
1299
|
-
* @property {PCMFilters[]} [defaultFilters] The PCM filters initializer
|
|
1300
|
-
* @property {Function} [onBeforeCreateStream] Runs before creating stream
|
|
1301
|
-
*/
|
|
1302
|
-
interface PlayerOptions {
|
|
1303
|
-
leaveOnEnd?: boolean;
|
|
1304
|
-
leaveOnEndCooldown?: number;
|
|
1305
|
-
leaveOnStop?: boolean;
|
|
1306
|
-
leaveOnEmpty?: boolean;
|
|
1307
|
-
leaveOnEmptyCooldown?: number;
|
|
1308
|
-
autoSelfDeaf?: boolean;
|
|
1309
|
-
ytdlOptions?: downloadOptions;
|
|
1310
|
-
initialVolume?: number;
|
|
1311
|
-
bufferingTimeout?: number;
|
|
1312
|
-
spotifyBridge?: boolean;
|
|
1313
|
-
disableVolume?: boolean;
|
|
1314
|
-
disableEqualizer?: boolean;
|
|
1315
|
-
disableBiquad?: boolean;
|
|
1316
|
-
volumeSmoothness?: number;
|
|
1317
|
-
equalizerBands?: EqualizerBand[];
|
|
1318
|
-
biquadFilter?: BiquadFilters;
|
|
1319
|
-
disableFilters?: boolean;
|
|
1320
|
-
defaultFilters?: PCMFilters[];
|
|
1321
|
-
onBeforeCreateStream?: (track: Track, source: SearchQueryType, queue: Queue) => Promise<Readable>;
|
|
1322
|
-
}
|
|
1323
|
-
/**
|
|
1324
|
-
* @typedef {object} ExtractorModelData
|
|
1325
|
-
* @property {object} [playlist] The playlist info (if any)
|
|
1326
|
-
* @property {string} [playlist.title] The playlist title
|
|
1327
|
-
* @property {string} [playlist.description] The playlist description
|
|
1328
|
-
* @property {string} [playlist.thumbnail] The playlist thumbnail
|
|
1329
|
-
* @property {album|playlist} [playlist.type] The playlist type: `album` | `playlist`
|
|
1330
|
-
* @property {TrackSource} [playlist.source] The playlist source
|
|
1331
|
-
* @property {object} [playlist.author] The playlist author
|
|
1332
|
-
* @property {string} [playlist.author.name] The author name
|
|
1333
|
-
* @property {string} [playlist.author.url] The author url
|
|
1334
|
-
* @property {string} [playlist.id] The playlist id
|
|
1335
|
-
* @property {string} [playlist.url] The playlist url
|
|
1336
|
-
* @property {any} [playlist.rawPlaylist] The raw data
|
|
1337
|
-
* @property {ExtractorData[]} data The data
|
|
1338
|
-
*/
|
|
1339
|
-
/**
|
|
1340
|
-
* @typedef {object} ExtractorData
|
|
1341
|
-
* @property {string} title The title
|
|
1342
|
-
* @property {number} duration The duration
|
|
1343
|
-
* @property {string} thumbnail The thumbnail
|
|
1344
|
-
* @property {string|Readable|Duplex} engine The stream engine
|
|
1345
|
-
* @property {number} views The views count
|
|
1346
|
-
* @property {string} author The author
|
|
1347
|
-
* @property {string} description The description
|
|
1348
|
-
* @property {string} url The url
|
|
1349
|
-
* @property {string} [version] The extractor version
|
|
1350
|
-
* @property {TrackSource} [source="arbitrary"] The source
|
|
1351
|
-
*/
|
|
1352
|
-
interface ExtractorModelData {
|
|
1353
|
-
playlist?: {
|
|
1354
|
-
title: string;
|
|
1355
|
-
description: string;
|
|
1356
|
-
thumbnail: string;
|
|
1357
|
-
type: 'album' | 'playlist';
|
|
1358
|
-
source: TrackSource;
|
|
1359
|
-
author: {
|
|
1360
|
-
name: string;
|
|
1361
|
-
url: string;
|
|
1362
|
-
};
|
|
1363
|
-
id: string;
|
|
1364
|
-
url: string;
|
|
1365
|
-
rawPlaylist?: any;
|
|
1366
|
-
};
|
|
1367
|
-
data: {
|
|
1368
|
-
title: string;
|
|
1369
|
-
duration: number;
|
|
1370
|
-
thumbnail: string;
|
|
1371
|
-
engine: string | Readable | Duplex;
|
|
1372
|
-
views: number;
|
|
1373
|
-
author: string;
|
|
1374
|
-
description: string;
|
|
1375
|
-
url: string;
|
|
1376
|
-
version?: string;
|
|
1377
|
-
source?: TrackSource;
|
|
1378
|
-
}[];
|
|
1379
|
-
}
|
|
1380
1390
|
/**
|
|
1381
1391
|
* The search query type
|
|
1382
1392
|
* This can be one of:
|
|
@@ -1425,90 +1435,10 @@ declare const QueryType: {
|
|
|
1425
1435
|
readonly FILE: "file";
|
|
1426
1436
|
};
|
|
1427
1437
|
type SearchQueryType = keyof typeof QueryType | (typeof QueryType)[keyof typeof QueryType];
|
|
1428
|
-
/**
|
|
1429
|
-
* Emitted when bot gets disconnected from a voice channel
|
|
1430
|
-
* @event Player#botDisconnect
|
|
1431
|
-
* @param {Queue} queue The queue
|
|
1432
|
-
*/
|
|
1433
|
-
/**
|
|
1434
|
-
* Emitted when the voice channel is empty
|
|
1435
|
-
* @event Player#channelEmpty
|
|
1436
|
-
* @param {Queue} queue The queue
|
|
1437
|
-
*/
|
|
1438
|
-
/**
|
|
1439
|
-
* Emitted when bot connects to a voice channel
|
|
1440
|
-
* @event Player#connectionCreate
|
|
1441
|
-
* @param {Queue} queue The queue
|
|
1442
|
-
* @param {StreamDispatcher} connection The discord player connection object
|
|
1443
|
-
*/
|
|
1444
|
-
/**
|
|
1445
|
-
* Debug information
|
|
1446
|
-
* @event Player#debug
|
|
1447
|
-
* @param {Queue} queue The queue
|
|
1448
|
-
* @param {string} message The message
|
|
1449
|
-
*/
|
|
1450
|
-
/**
|
|
1451
|
-
* Emitted on error
|
|
1452
|
-
* <warn>This event should handled properly otherwise it may crash your process!</warn>
|
|
1453
|
-
* @event Player#error
|
|
1454
|
-
* @param {Queue} queue The queue
|
|
1455
|
-
* @param {Error} error The error
|
|
1456
|
-
*/
|
|
1457
|
-
/**
|
|
1458
|
-
* Emitted on connection error. Sometimes stream errors are emitted here as well.
|
|
1459
|
-
* @event Player#connectionError
|
|
1460
|
-
* @param {Queue} queue The queue
|
|
1461
|
-
* @param {Error} error The error
|
|
1462
|
-
*/
|
|
1463
|
-
/**
|
|
1464
|
-
* Emitted when queue ends
|
|
1465
|
-
* @event Player#queueEnd
|
|
1466
|
-
* @param {Queue} queue The queue
|
|
1467
|
-
*/
|
|
1468
|
-
/**
|
|
1469
|
-
* Emitted when a single track is added
|
|
1470
|
-
* @event Player#trackAdd
|
|
1471
|
-
* @param {Queue} queue The queue
|
|
1472
|
-
* @param {Track} track The track
|
|
1473
|
-
*/
|
|
1474
|
-
/**
|
|
1475
|
-
* Emitted when multiple tracks are added
|
|
1476
|
-
* @event Player#tracksAdd
|
|
1477
|
-
* @param {Queue} queue The queue
|
|
1478
|
-
* @param {Track[]} tracks The tracks
|
|
1479
|
-
*/
|
|
1480
|
-
/**
|
|
1481
|
-
* Emitted when a track starts playing
|
|
1482
|
-
* @event Player#trackStart
|
|
1483
|
-
* @param {Queue} queue The queue
|
|
1484
|
-
* @param {Track} track The track
|
|
1485
|
-
*/
|
|
1486
|
-
/**
|
|
1487
|
-
* Emitted when a track ends
|
|
1488
|
-
* @event Player#trackEnd
|
|
1489
|
-
* @param {Queue} queue The queue
|
|
1490
|
-
* @param {Track} track The track
|
|
1491
|
-
*/
|
|
1492
|
-
/**
|
|
1493
|
-
* Emitted when voice state updates. Listen to this event to modify internal voice state update handler.
|
|
1494
|
-
* @event Player#voiceStateUpdate
|
|
1495
|
-
* @param {Queue} queue The queue that this update belongs to
|
|
1496
|
-
* @param {VoiceState} oldState The old voice state
|
|
1497
|
-
* @param {VoiceState} newState The new voice state
|
|
1498
|
-
*/
|
|
1499
1438
|
interface PlayerEvents {
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
debug: (queue: Queue, message: string) => any;
|
|
1504
|
-
error: (queue: Queue, error: Error) => any;
|
|
1505
|
-
connectionError: (queue: Queue, error: Error) => any;
|
|
1506
|
-
queueEnd: (queue: Queue) => any;
|
|
1507
|
-
trackAdd: (queue: Queue, track: Track) => any;
|
|
1508
|
-
tracksAdd: (queue: Queue, track: Track[]) => any;
|
|
1509
|
-
trackStart: (queue: Queue, track: Track) => any;
|
|
1510
|
-
trackEnd: (queue: Queue, track: Track) => any;
|
|
1511
|
-
voiceStateUpdate: (queue: Queue, oldState: VoiceState, newState: VoiceState) => any;
|
|
1439
|
+
debug: (message: string) => any;
|
|
1440
|
+
error: (error: Error) => any;
|
|
1441
|
+
voiceStateUpdate: (queue: GuildQueue, oldState: VoiceState, newState: VoiceState) => any;
|
|
1512
1442
|
}
|
|
1513
1443
|
/**
|
|
1514
1444
|
* @typedef {object} PlayOptions
|
|
@@ -1528,12 +1458,14 @@ type QueryExtractorSearch = `ext:${string}`;
|
|
|
1528
1458
|
* @typedef {object} SearchOptions
|
|
1529
1459
|
* @property {UserResolvable} requestedBy The user who requested this search
|
|
1530
1460
|
* @property {typeof QueryType|string} [searchEngine=QueryType.AUTO] The query search engine, can be extractor name to target specific one (custom)
|
|
1531
|
-
* @property {
|
|
1461
|
+
* @property {string[]} [blockExtractors[]] List of the extractors to block
|
|
1462
|
+
* @property {boolean} [ignoreCache] If it should ignore query cache lookup
|
|
1532
1463
|
*/
|
|
1533
1464
|
interface SearchOptions {
|
|
1534
1465
|
requestedBy?: UserResolvable;
|
|
1535
1466
|
searchEngine?: SearchQueryType | QueryExtractorSearch;
|
|
1536
1467
|
blockExtractors?: string[];
|
|
1468
|
+
ignoreCache?: boolean;
|
|
1537
1469
|
}
|
|
1538
1470
|
/**
|
|
1539
1471
|
* The queue repeat mode. This can be one of:
|
|
@@ -1641,7 +1573,9 @@ interface PlaylistJSON {
|
|
|
1641
1573
|
* @property {boolean} [smoothVolume=true] Toggle smooth volume transition
|
|
1642
1574
|
* @property {boolean} [lagMonitor=30000] Time in ms to re-monitor event loop lag
|
|
1643
1575
|
* @property {boolean} [lockVoiceStateHandler] Prevent voice state handler from being overridden
|
|
1644
|
-
* @property {string[]} [blockExtractors] List of extractors to
|
|
1576
|
+
* @property {string[]} [blockExtractors] List of extractors to disable querying metadata from
|
|
1577
|
+
* @property {string[]} [blockStreamFrom] List of extractors to disable streaming from
|
|
1578
|
+
* @property {QueryCache | null} [queryCache] Query cache provider
|
|
1645
1579
|
*/
|
|
1646
1580
|
interface PlayerInitOptions {
|
|
1647
1581
|
autoRegisterExtractor?: boolean;
|
|
@@ -1651,6 +1585,8 @@ interface PlayerInitOptions {
|
|
|
1651
1585
|
lagMonitor?: number;
|
|
1652
1586
|
lockVoiceStateHandler?: boolean;
|
|
1653
1587
|
blockExtractors?: string[];
|
|
1588
|
+
blockStreamFrom?: string[];
|
|
1589
|
+
queryCache?: QueryCache | null;
|
|
1654
1590
|
}
|
|
1655
1591
|
|
|
1656
1592
|
declare class AudioFilters {
|
|
@@ -1687,70 +1623,6 @@ declare class AudioFilters {
|
|
|
1687
1623
|
}[]): void;
|
|
1688
1624
|
}
|
|
1689
1625
|
|
|
1690
|
-
declare enum ErrorStatusCode {
|
|
1691
|
-
STREAM_ERROR = "StreamError",
|
|
1692
|
-
AUDIO_PLAYER_ERROR = "AudioPlayerError",
|
|
1693
|
-
PLAYER_ERROR = "PlayerError",
|
|
1694
|
-
NO_AUDIO_RESOURCE = "NoAudioResource",
|
|
1695
|
-
UNKNOWN_GUILD = "UnknownGuild",
|
|
1696
|
-
INVALID_ARG_TYPE = "InvalidArgType",
|
|
1697
|
-
UNKNOWN_EXTRACTOR = "UnknownExtractor",
|
|
1698
|
-
INVALID_EXTRACTOR = "InvalidExtractor",
|
|
1699
|
-
INVALID_CHANNEL_TYPE = "InvalidChannelType",
|
|
1700
|
-
INVALID_TRACK = "InvalidTrack",
|
|
1701
|
-
UNKNOWN_REPEAT_MODE = "UnknownRepeatMode",
|
|
1702
|
-
TRACK_NOT_FOUND = "TrackNotFound",
|
|
1703
|
-
NO_CONNECTION = "NoConnection",
|
|
1704
|
-
DESTROYED_QUEUE = "DestroyedQueue"
|
|
1705
|
-
}
|
|
1706
|
-
declare class PlayerError extends Error {
|
|
1707
|
-
message: string;
|
|
1708
|
-
statusCode: ErrorStatusCode;
|
|
1709
|
-
createdAt: Date;
|
|
1710
|
-
constructor(message: string, code?: ErrorStatusCode);
|
|
1711
|
-
get createdTimestamp(): number;
|
|
1712
|
-
valueOf(): ErrorStatusCode;
|
|
1713
|
-
toJSON(): {
|
|
1714
|
-
stack: string | undefined;
|
|
1715
|
-
code: ErrorStatusCode;
|
|
1716
|
-
message: string;
|
|
1717
|
-
created: number;
|
|
1718
|
-
};
|
|
1719
|
-
toString(): string | undefined;
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
declare class QueryResolver {
|
|
1723
|
-
/**
|
|
1724
|
-
* Query resolver
|
|
1725
|
-
*/
|
|
1726
|
-
private constructor();
|
|
1727
|
-
static get regex(): {
|
|
1728
|
-
spotifyAlbumRegex: RegExp;
|
|
1729
|
-
spotifyPlaylistRegex: RegExp;
|
|
1730
|
-
spotifySongRegex: RegExp;
|
|
1731
|
-
vimeoRegex: RegExp;
|
|
1732
|
-
reverbnationRegex: RegExp;
|
|
1733
|
-
attachmentRegex: RegExp;
|
|
1734
|
-
appleMusicAlbumRegex: RegExp;
|
|
1735
|
-
appleMusicPlaylistRegex: RegExp;
|
|
1736
|
-
appleMusicSongRegex: RegExp;
|
|
1737
|
-
};
|
|
1738
|
-
/**
|
|
1739
|
-
* Resolves the given search query
|
|
1740
|
-
* @param {string} query The query
|
|
1741
|
-
* @returns {QueryType}
|
|
1742
|
-
*/
|
|
1743
|
-
static resolve(query: string): (typeof QueryType)[keyof typeof QueryType];
|
|
1744
|
-
/**
|
|
1745
|
-
* Parses vimeo id from url
|
|
1746
|
-
* @param {string} query The query
|
|
1747
|
-
* @returns {string}
|
|
1748
|
-
*/
|
|
1749
|
-
static getVimeoID(query: string): string | null | undefined;
|
|
1750
|
-
static validateId(q: string): boolean;
|
|
1751
|
-
static validateURL(q: string): boolean;
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1754
1626
|
declare class Util {
|
|
1755
1627
|
/**
|
|
1756
1628
|
* Utils
|
|
@@ -1803,21 +1675,6 @@ declare class Util {
|
|
|
1803
1675
|
static warn(message: string, code?: string, detail?: string): void;
|
|
1804
1676
|
}
|
|
1805
1677
|
|
|
1806
|
-
interface FFmpegStreamOptions {
|
|
1807
|
-
fmt?: string;
|
|
1808
|
-
encoderArgs?: string[];
|
|
1809
|
-
seek?: number;
|
|
1810
|
-
skip?: boolean;
|
|
1811
|
-
}
|
|
1812
|
-
declare function FFMPEG_ARGS_STRING(stream: string, fmt?: string): string[];
|
|
1813
|
-
declare function FFMPEG_ARGS_PIPED(fmt?: string): string[];
|
|
1814
|
-
/**
|
|
1815
|
-
* Creates FFmpeg stream
|
|
1816
|
-
* @param stream The source stream
|
|
1817
|
-
* @param options FFmpeg stream options
|
|
1818
|
-
*/
|
|
1819
|
-
declare function createFFmpegStream(stream: Readable | Duplex | string, options?: FFmpegStreamOptions): Readable;
|
|
1820
|
-
|
|
1821
1678
|
declare const version: string;
|
|
1822
1679
|
|
|
1823
|
-
export { AFilterGraph, AudioFilters, BaseExtractor, EqualizerConfigurationPreset, ErrorStatusCode, ExtractorExecutionContext, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo,
|
|
1680
|
+
export { AFilterGraph, AudioFilters, BaseExtractor, DiscordPlayerQueryResultCache, EqualizerConfigurationPreset, ErrorStatusCode, ExtractorExecutionContext, ExtractorExecutionFN, ExtractorExecutionResult, ExtractorInfo, ExtractorSearchContext, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFMPEG_SRATE_REGEX, FFmpegFilterer, FFmpegStreamOptions, FilterGraph, FiltersName, GuildNodeCreateOptions, GuildNodeInit, GuildNodeManager, GuildQueue, GuildQueueAFiltersCache, GuildQueueAudioFilters, GuildQueueEvents, GuildQueueHistory, GuildQueuePlayerNode, NextFunction, NodeResolvable, OnAfterCreateStreamHandler, OnBeforeCreateStreamHandler, PlayOptions, Player, PlayerError, PlayerEvents, PlayerInitOptions, PlayerProgressbarOptions, PlayerSearchResult, PlayerTimestamp, PlayerTriggeredReason, Playlist, PlaylistInitData, PlaylistJSON, PostProcessedResult, QueryCache, QueryCacheOptions, QueryCacheResolverContext, QueryExtractorSearch, QueryType, QueueFilters, QueueRepeatMode, RawTrackData, ResourcePlayOptions, SearchOptions, SearchQueryType, SearchResult, SearchResultData, StreamDispatcher, TimeData, Track, TrackJSON, TrackResolvable, TrackSource, Util, VoiceConnectConfig, VoiceEvents, VoiceUtils, createFFmpegStream, version };
|