distube 5.0.2 → 5.0.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.
@@ -0,0 +1,1489 @@
1
+ import * as discord_js from 'discord.js';
2
+ import { Snowflake, Message, GuildTextBasedChannel, VoiceBasedChannel, VoiceState, Guild, GuildMember, Interaction, Client, Collection, ClientOptions } from 'discord.js';
3
+ import { TypedEmitter } from 'tiny-typed-emitter';
4
+ import { AudioPlayer, VoiceConnection, AudioResource } from '@discordjs/voice';
5
+ import { Transform, TransformCallback } from 'stream';
6
+ import { ChildProcess } from 'child_process';
7
+
8
+ type Awaitable<T = any> = T | PromiseLike<T>;
9
+ declare enum Events {
10
+ ERROR = "error",
11
+ ADD_LIST = "addList",
12
+ ADD_SONG = "addSong",
13
+ PLAY_SONG = "playSong",
14
+ FINISH_SONG = "finishSong",
15
+ EMPTY = "empty",
16
+ FINISH = "finish",
17
+ INIT_QUEUE = "initQueue",
18
+ NO_RELATED = "noRelated",
19
+ DISCONNECT = "disconnect",
20
+ DELETE_QUEUE = "deleteQueue",
21
+ FFMPEG_DEBUG = "ffmpegDebug",
22
+ DEBUG = "debug"
23
+ }
24
+ type DisTubeEvents = {
25
+ [Events.ADD_LIST]: [queue: Queue, playlist: Playlist];
26
+ [Events.ADD_SONG]: [queue: Queue, song: Song];
27
+ [Events.DELETE_QUEUE]: [queue: Queue];
28
+ [Events.DISCONNECT]: [queue: Queue];
29
+ [Events.ERROR]: [error: Error, queue: Queue, song: Song | undefined];
30
+ [Events.FFMPEG_DEBUG]: [debug: string];
31
+ [Events.DEBUG]: [debug: string];
32
+ [Events.FINISH]: [queue: Queue];
33
+ [Events.FINISH_SONG]: [queue: Queue, song: Song];
34
+ [Events.INIT_QUEUE]: [queue: Queue];
35
+ [Events.NO_RELATED]: [queue: Queue, error: DisTubeError];
36
+ [Events.PLAY_SONG]: [queue: Queue, song: Song];
37
+ };
38
+ type TypedDisTubeEvents = {
39
+ [K in keyof DisTubeEvents]: (...args: DisTubeEvents[K]) => Awaitable;
40
+ };
41
+ type DisTubeVoiceEvents = {
42
+ disconnect: (error?: Error) => Awaitable;
43
+ error: (error: Error) => Awaitable;
44
+ finish: () => Awaitable;
45
+ };
46
+ /**
47
+ * An FFmpeg audio filter object
48
+ * ```ts
49
+ * {
50
+ * name: "bassboost",
51
+ * value: "bass=g=10"
52
+ * }
53
+ * ```ts
54
+ */
55
+ interface Filter {
56
+ /**
57
+ * Name of the filter
58
+ */
59
+ name: string;
60
+ /**
61
+ * FFmpeg audio filter argument
62
+ */
63
+ value: string;
64
+ }
65
+ /**
66
+ * Data that resolves to give an FFmpeg audio filter. This can be:
67
+ * - A name of a default filters or custom filters (`string`)
68
+ * - A {@link Filter} object
69
+ * @see {@link defaultFilters}
70
+ * @see {@link DisTubeOptions|DisTubeOptions.customFilters}
71
+ */
72
+ type FilterResolvable = string | Filter;
73
+ /**
74
+ * FFmpeg Filters
75
+ * ```ts
76
+ * {
77
+ * "Filter Name": "Filter Value",
78
+ * "bassboost": "bass=g=10"
79
+ * }
80
+ * ```
81
+ * @see {@link defaultFilters}
82
+ */
83
+ type Filters = Record<string, string>;
84
+ /**
85
+ * DisTube options
86
+ */
87
+ type DisTubeOptions = {
88
+ /**
89
+ * DisTube plugins.
90
+ * The order of this effects the priority of the plugins when verifying the input.
91
+ */
92
+ plugins?: DisTubePlugin[];
93
+ /**
94
+ * Whether or not emitting {@link Events.PLAY_SONG} event when looping a song
95
+ * or next song is the same as the previous one
96
+ */
97
+ emitNewSongOnly?: boolean;
98
+ /**
99
+ * Whether or not saving the previous songs of the queue and enable {@link
100
+ * DisTube#previous} method. Disable it may help to reduce the memory usage
101
+ */
102
+ savePreviousSongs?: boolean;
103
+ /**
104
+ * Override {@link defaultFilters} or add more ffmpeg filters
105
+ */
106
+ customFilters?: Filters;
107
+ /**
108
+ * Whether or not playing age-restricted content and disabling safe search in
109
+ * non-NSFW channel
110
+ */
111
+ nsfw?: boolean;
112
+ /**
113
+ * Whether or not emitting `addSong` event when creating a new Queue
114
+ */
115
+ emitAddSongWhenCreatingQueue?: boolean;
116
+ /**
117
+ * Whether or not emitting `addList` event when creating a new Queue
118
+ */
119
+ emitAddListWhenCreatingQueue?: boolean;
120
+ /**
121
+ * Whether or not joining the new voice channel when using {@link DisTube#play}
122
+ * method
123
+ */
124
+ joinNewVoiceChannel?: boolean;
125
+ /**
126
+ * FFmpeg options
127
+ */
128
+ ffmpeg?: {
129
+ /**
130
+ * FFmpeg path
131
+ */
132
+ path?: string;
133
+ /**
134
+ * FFmpeg default arguments
135
+ */
136
+ args?: Partial<FFmpegArgs>;
137
+ };
138
+ };
139
+ /**
140
+ * Data that can be resolved to give a guild id string. This can be:
141
+ * - A guild id string | a guild {@link https://discord.js.org/#/docs/main/stable/class/Snowflake|Snowflake}
142
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/Guild | Guild}
143
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/Message | Message}
144
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/BaseGuildVoiceChannel
145
+ * | BaseGuildVoiceChannel}
146
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/BaseGuildTextChannel
147
+ * | BaseGuildTextChannel}
148
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/VoiceState |
149
+ * VoiceState}
150
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/GuildMember |
151
+ * GuildMember}
152
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/Interaction |
153
+ * Interaction}
154
+ * - A {@link DisTubeVoice}
155
+ * - A {@link Queue}
156
+ */
157
+ type GuildIdResolvable = Queue | DisTubeVoice | Snowflake | Message | GuildTextBasedChannel | VoiceBasedChannel | VoiceState | Guild | GuildMember | Interaction | string;
158
+ interface SongInfo {
159
+ plugin: DisTubePlugin | null;
160
+ source: string;
161
+ playFromSource: boolean;
162
+ id: string;
163
+ name?: string;
164
+ isLive?: boolean;
165
+ duration?: number;
166
+ url?: string;
167
+ thumbnail?: string;
168
+ views?: number;
169
+ likes?: number;
170
+ dislikes?: number;
171
+ reposts?: number;
172
+ uploader?: {
173
+ name?: string;
174
+ url?: string;
175
+ };
176
+ ageRestricted?: boolean;
177
+ }
178
+ interface PlaylistInfo {
179
+ source: string;
180
+ songs: Song[];
181
+ id?: string;
182
+ name?: string;
183
+ url?: string;
184
+ thumbnail?: string;
185
+ }
186
+ type RelatedSong = Omit<Song, "related">;
187
+ type PlayHandlerOptions = {
188
+ /**
189
+ * [Default: false] Skip the playing song (if exists) and play the added playlist
190
+ * instantly
191
+ */
192
+ skip?: boolean;
193
+ /**
194
+ * [Default: 0] Position of the song/playlist to add to the queue, \<= 0 to add to
195
+ * the end of the queue
196
+ */
197
+ position?: number;
198
+ /**
199
+ * The default text channel of the queue
200
+ */
201
+ textChannel?: GuildTextBasedChannel;
202
+ };
203
+ interface PlayOptions<T = unknown> extends PlayHandlerOptions, ResolveOptions<T> {
204
+ /**
205
+ * Called message (For built-in search events. If this is a {@link
206
+ * https://developer.mozilla.org/en-US/docs/Glossary/Falsy | falsy value}, it will
207
+ * play the first result instead)
208
+ */
209
+ message?: Message;
210
+ }
211
+ interface ResolveOptions<T = unknown> {
212
+ /**
213
+ * Requested user
214
+ */
215
+ member?: GuildMember;
216
+ /**
217
+ * Metadata
218
+ */
219
+ metadata?: T;
220
+ }
221
+ interface ResolvePlaylistOptions<T = unknown> extends ResolveOptions<T> {
222
+ /**
223
+ * Source of the playlist
224
+ */
225
+ source?: string;
226
+ }
227
+ interface CustomPlaylistOptions {
228
+ /**
229
+ * A guild member creating the playlist
230
+ */
231
+ member?: GuildMember;
232
+ /**
233
+ * Whether or not fetch the songs in parallel
234
+ */
235
+ parallel?: boolean;
236
+ /**
237
+ * Metadata
238
+ */
239
+ metadata?: any;
240
+ /**
241
+ * Playlist name
242
+ */
243
+ name?: string;
244
+ /**
245
+ * Playlist source
246
+ */
247
+ source?: string;
248
+ /**
249
+ * Playlist url
250
+ */
251
+ url?: string;
252
+ /**
253
+ * Playlist thumbnail
254
+ */
255
+ thumbnail?: string;
256
+ }
257
+ /**
258
+ * The repeat mode of a {@link Queue}
259
+ * - `DISABLED` = 0
260
+ * - `SONG` = 1
261
+ * - `QUEUE` = 2
262
+ */
263
+ declare enum RepeatMode {
264
+ DISABLED = 0,
265
+ SONG = 1,
266
+ QUEUE = 2
267
+ }
268
+ /**
269
+ * All available plugin types:
270
+ * - `EXTRACTOR` = `"extractor"`: {@link ExtractorPlugin}
271
+ * - `INFO_EXTRACTOR` = `"info-extractor"`: {@link InfoExtractorPlugin}
272
+ * - `PLAYABLE_EXTRACTOR` = `"playable-extractor"`: {@link PlayableExtractorPlugin}
273
+ */
274
+ declare enum PluginType {
275
+ EXTRACTOR = "extractor",
276
+ INFO_EXTRACTOR = "info-extractor",
277
+ PLAYABLE_EXTRACTOR = "playable-extractor"
278
+ }
279
+ type DisTubePlugin = ExtractorPlugin | InfoExtractorPlugin | PlayableExtractorPlugin;
280
+ type FFmpegArg = Record<string, string | number | boolean | Array<string | null | undefined> | null | undefined>;
281
+ /**
282
+ * FFmpeg arguments for different use cases
283
+ */
284
+ type FFmpegArgs = {
285
+ global: FFmpegArg;
286
+ input: FFmpegArg;
287
+ output: FFmpegArg;
288
+ };
289
+ /**
290
+ * FFmpeg options
291
+ */
292
+ type FFmpegOptions = {
293
+ /**
294
+ * Path to the ffmpeg executable
295
+ */
296
+ path: string;
297
+ /**
298
+ * Arguments
299
+ */
300
+ args: FFmpegArgs;
301
+ };
302
+
303
+ /**
304
+ * Default DisTube audio filters.
305
+ */
306
+ declare const defaultFilters: Filters;
307
+ declare const defaultOptions: {
308
+ plugins: never[];
309
+ emitNewSongOnly: false;
310
+ savePreviousSongs: true;
311
+ nsfw: false;
312
+ emitAddSongWhenCreatingQueue: true;
313
+ emitAddListWhenCreatingQueue: true;
314
+ joinNewVoiceChannel: true;
315
+ };
316
+
317
+ declare const ERROR_MESSAGES: {
318
+ INVALID_TYPE: (expected: (number | string) | readonly (number | string)[], got: any, name?: string) => string;
319
+ NUMBER_COMPARE: (name: string, expected: string, value: number) => string;
320
+ EMPTY_ARRAY: (name: string) => string;
321
+ EMPTY_FILTERED_ARRAY: (name: string, type: string) => string;
322
+ EMPTY_STRING: (name: string) => string;
323
+ INVALID_KEY: (obj: string, key: string) => string;
324
+ MISSING_KEY: (obj: string, key: string) => string;
325
+ MISSING_KEYS: (obj: string, key: string[], all: boolean) => string;
326
+ MISSING_INTENTS: (i: string) => string;
327
+ DISABLED_OPTION: (o: string) => string;
328
+ ENABLED_OPTION: (o: string) => string;
329
+ NOT_IN_VOICE: string;
330
+ VOICE_FULL: string;
331
+ VOICE_ALREADY_CREATED: string;
332
+ VOICE_CONNECT_FAILED: (s: number) => string;
333
+ VOICE_MISSING_PERMS: string;
334
+ VOICE_RECONNECT_FAILED: string;
335
+ VOICE_DIFFERENT_GUILD: string;
336
+ VOICE_DIFFERENT_CLIENT: string;
337
+ FFMPEG_EXITED: (code: number) => string;
338
+ FFMPEG_NOT_INSTALLED: (path: string) => string;
339
+ ENCRYPTION_LIBRARIES_MISSING: string;
340
+ NO_QUEUE: string;
341
+ QUEUE_EXIST: string;
342
+ QUEUE_STOPPED: string;
343
+ PAUSED: string;
344
+ RESUMED: string;
345
+ NO_PREVIOUS: string;
346
+ NO_UP_NEXT: string;
347
+ NO_SONG_POSITION: string;
348
+ NO_PLAYING_SONG: string;
349
+ NO_EXTRACTOR_PLUGIN: string;
350
+ NO_RELATED: string;
351
+ CANNOT_PLAY_RELATED: string;
352
+ UNAVAILABLE_VIDEO: string;
353
+ UNPLAYABLE_FORMATS: string;
354
+ NON_NSFW: string;
355
+ NOT_SUPPORTED_URL: string;
356
+ NOT_SUPPORTED_SONG: (song: string) => string;
357
+ NO_VALID_SONG: string;
358
+ CANNOT_RESOLVE_SONG: (t: any) => string;
359
+ CANNOT_GET_STREAM_URL: (song: string) => string;
360
+ CANNOT_GET_SEARCH_QUERY: (song: string) => string;
361
+ NO_RESULT: (query: string) => string;
362
+ NO_STREAM_URL: (song: string) => string;
363
+ EMPTY_FILTERED_PLAYLIST: string;
364
+ EMPTY_PLAYLIST: string;
365
+ };
366
+ type ErrorMessage = typeof ERROR_MESSAGES;
367
+ type ErrorCode = keyof ErrorMessage;
368
+ type StaticErrorCode = {
369
+ [K in ErrorCode]-?: ErrorMessage[K] extends string ? K : never;
370
+ }[ErrorCode];
371
+ type TemplateErrorCode = Exclude<keyof typeof ERROR_MESSAGES, StaticErrorCode>;
372
+ declare class DisTubeError<T extends string = any> extends Error {
373
+ errorCode: string;
374
+ constructor(code: T extends StaticErrorCode ? T : never);
375
+ constructor(code: T extends TemplateErrorCode ? T : never, ...args: Parameters<ErrorMessage[typeof code]>);
376
+ constructor(code: TemplateErrorCode, _: never);
377
+ constructor(code: T extends ErrorCode ? never : T, message: string);
378
+ get name(): string;
379
+ get code(): string;
380
+ }
381
+
382
+ /**
383
+ * Task queuing system
384
+ */
385
+ declare class TaskQueue {
386
+ #private;
387
+ /**
388
+ * Waits for last task finished and queues a new task
389
+ */
390
+ queuing(): Promise<void>;
391
+ /**
392
+ * Removes the finished task and processes the next task
393
+ */
394
+ resolve(): void;
395
+ /**
396
+ * The remaining number of tasks
397
+ */
398
+ get remaining(): number;
399
+ }
400
+
401
+ /**
402
+ * Class representing a playlist.
403
+ */
404
+ declare class Playlist<T = unknown> implements PlaylistInfo {
405
+ #private;
406
+ /**
407
+ * Playlist source.
408
+ */
409
+ source: string;
410
+ /**
411
+ * Songs in the playlist.
412
+ */
413
+ songs: Song[];
414
+ /**
415
+ * Playlist ID.
416
+ */
417
+ id?: string;
418
+ /**
419
+ * Playlist name.
420
+ */
421
+ name?: string;
422
+ /**
423
+ * Playlist URL.
424
+ */
425
+ url?: string;
426
+ /**
427
+ * Playlist thumbnail.
428
+ */
429
+ thumbnail?: string;
430
+ /**
431
+ * Create a Playlist
432
+ * @param playlist - Raw playlist info
433
+ * @param options - Optional data
434
+ */
435
+ constructor(playlist: PlaylistInfo, { member, metadata }?: ResolveOptions<T>);
436
+ /**
437
+ * Playlist duration in second.
438
+ */
439
+ get duration(): number;
440
+ /**
441
+ * Formatted duration string `hh:mm:ss`.
442
+ */
443
+ get formattedDuration(): string;
444
+ /**
445
+ * User requested.
446
+ */
447
+ get member(): GuildMember | undefined;
448
+ set member(member: GuildMember | undefined);
449
+ /**
450
+ * User requested.
451
+ */
452
+ get user(): discord_js.User | undefined;
453
+ /**
454
+ * Optional metadata that can be used to identify the playlist.
455
+ */
456
+ get metadata(): T;
457
+ set metadata(metadata: T);
458
+ toString(): string;
459
+ }
460
+
461
+ /**
462
+ * Class representing a song.
463
+ */
464
+ declare class Song<T = unknown> {
465
+ #private;
466
+ /**
467
+ * The source of this song info
468
+ */
469
+ source: string;
470
+ /**
471
+ * Song ID.
472
+ */
473
+ id: string;
474
+ /**
475
+ * Song name.
476
+ */
477
+ name?: string;
478
+ /**
479
+ * Indicates if the song is an active live.
480
+ */
481
+ isLive?: boolean;
482
+ /**
483
+ * Song duration.
484
+ */
485
+ duration: number;
486
+ /**
487
+ * Formatted duration string (`hh:mm:ss`, `mm:ss` or `Live`).
488
+ */
489
+ formattedDuration: string;
490
+ /**
491
+ * Song URL.
492
+ */
493
+ url?: string;
494
+ /**
495
+ * Song thumbnail.
496
+ */
497
+ thumbnail?: string;
498
+ /**
499
+ * Song view count
500
+ */
501
+ views?: number;
502
+ /**
503
+ * Song like count
504
+ */
505
+ likes?: number;
506
+ /**
507
+ * Song dislike count
508
+ */
509
+ dislikes?: number;
510
+ /**
511
+ * Song repost (share) count
512
+ */
513
+ reposts?: number;
514
+ /**
515
+ * Song uploader
516
+ */
517
+ uploader: {
518
+ name?: string;
519
+ url?: string;
520
+ };
521
+ /**
522
+ * Whether or not an age-restricted content
523
+ */
524
+ ageRestricted?: boolean;
525
+ /**
526
+ * Stream info
527
+ */
528
+ stream: {
529
+ /**
530
+ * The stream of this song will be played from source
531
+ */
532
+ playFromSource: true;
533
+ /**
534
+ * Stream URL of this song
535
+ */
536
+ url?: string;
537
+ } | {
538
+ /**
539
+ * The stream of this song will be played from another song
540
+ */
541
+ playFromSource: false;
542
+ /**
543
+ * The song that this song will be played from
544
+ */
545
+ song?: Song<T>;
546
+ };
547
+ /**
548
+ * The plugin that created this song
549
+ */
550
+ plugin: DisTubePlugin | null;
551
+ /**
552
+ * Create a Song
553
+ *
554
+ * @param info - Raw song info
555
+ * @param options - Optional data
556
+ */
557
+ constructor(info: SongInfo, { member, metadata }?: ResolveOptions<T>);
558
+ /**
559
+ * The playlist this song belongs to
560
+ */
561
+ get playlist(): Playlist | undefined;
562
+ set playlist(playlist: Playlist | undefined);
563
+ /**
564
+ * User requested to play this song.
565
+ */
566
+ get member(): GuildMember | undefined;
567
+ set member(member: GuildMember | undefined);
568
+ /**
569
+ * User requested to play this song.
570
+ */
571
+ get user(): discord_js.User | undefined;
572
+ /**
573
+ * Optional metadata that can be used to identify the song. This is attached by the
574
+ * {@link DisTube#play} method.
575
+ */
576
+ get metadata(): T;
577
+ set metadata(metadata: T);
578
+ toString(): string;
579
+ }
580
+
581
+ declare abstract class DisTubeBase {
582
+ distube: DisTube;
583
+ constructor(distube: DisTube);
584
+ /**
585
+ * Emit the {@link DisTube} of this base
586
+ * @param eventName - Event name
587
+ * @param args - arguments
588
+ */
589
+ emit(eventName: keyof DisTubeEvents, ...args: any): boolean;
590
+ /**
591
+ * Emit error event
592
+ * @param error - error
593
+ * @param queue - The queue encountered the error
594
+ * @param song - The playing song when encountered the error
595
+ */
596
+ emitError(error: Error, queue: Queue, song?: Song): void;
597
+ /**
598
+ * Emit debug event
599
+ * @param message - debug message
600
+ */
601
+ debug(message: string): void;
602
+ /**
603
+ * The queue manager
604
+ */
605
+ get queues(): QueueManager;
606
+ /**
607
+ * The voice manager
608
+ */
609
+ get voices(): DisTubeVoiceManager;
610
+ /**
611
+ * Discord.js client
612
+ */
613
+ get client(): Client;
614
+ /**
615
+ * DisTube options
616
+ */
617
+ get options(): Options;
618
+ /**
619
+ * DisTube handler
620
+ */
621
+ get handler(): DisTubeHandler;
622
+ /**
623
+ * DisTube plugins
624
+ */
625
+ get plugins(): DisTubePlugin[];
626
+ }
627
+
628
+ /**
629
+ * Create a voice connection to the voice channel
630
+ */
631
+ declare class DisTubeVoice extends TypedEmitter<DisTubeVoiceEvents> {
632
+ #private;
633
+ readonly id: Snowflake;
634
+ readonly voices: DisTubeVoiceManager;
635
+ readonly audioPlayer: AudioPlayer;
636
+ connection: VoiceConnection;
637
+ emittedError: boolean;
638
+ isDisconnected: boolean;
639
+ stream?: DisTubeStream;
640
+ constructor(voiceManager: DisTubeVoiceManager, channel: VoiceBasedChannel);
641
+ /**
642
+ * The voice channel id the bot is in
643
+ */
644
+ get channelId(): string | undefined;
645
+ get channel(): VoiceBasedChannel;
646
+ set channel(channel: VoiceBasedChannel);
647
+ /**
648
+ * Join a voice channel with this connection
649
+ * @param channel - A voice channel
650
+ */
651
+ join(channel?: VoiceBasedChannel): Promise<DisTubeVoice>;
652
+ /**
653
+ * Leave the voice channel of this connection
654
+ * @param error - Optional, an error to emit with 'error' event.
655
+ */
656
+ leave(error?: Error): void;
657
+ /**
658
+ * Stop the playing stream
659
+ * @param force - If true, will force the {@link DisTubeVoice#audioPlayer} to enter the Idle state even
660
+ * if the {@link DisTubeStream#audioResource} has silence padding frames.
661
+ */
662
+ stop(force?: boolean): void;
663
+ /**
664
+ * Play a {@link DisTubeStream}
665
+ * @param dtStream - DisTubeStream
666
+ */
667
+ play(dtStream: DisTubeStream): void;
668
+ set volume(volume: number);
669
+ /**
670
+ * Get or set the volume percentage
671
+ */
672
+ get volume(): number;
673
+ /**
674
+ * Playback duration of the audio resource in seconds
675
+ */
676
+ get playbackDuration(): number;
677
+ pause(): void;
678
+ unpause(): void;
679
+ /**
680
+ * Whether the bot is self-deafened
681
+ */
682
+ get selfDeaf(): boolean;
683
+ /**
684
+ * Whether the bot is self-muted
685
+ */
686
+ get selfMute(): boolean;
687
+ /**
688
+ * Self-deafens/undeafens the bot.
689
+ * @param selfDeaf - Whether or not the bot should be self-deafened
690
+ * @returns true if the voice state was successfully updated, otherwise false
691
+ */
692
+ setSelfDeaf(selfDeaf: boolean): boolean;
693
+ /**
694
+ * Self-mutes/unmutes the bot.
695
+ * @param selfMute - Whether or not the bot should be self-muted
696
+ * @returns true if the voice state was successfully updated, otherwise false
697
+ */
698
+ setSelfMute(selfMute: boolean): boolean;
699
+ /**
700
+ * The voice state of this connection
701
+ */
702
+ get voiceState(): VoiceState | undefined;
703
+ }
704
+
705
+ /**
706
+ * Options for {@link DisTubeStream}
707
+ */
708
+ interface StreamOptions {
709
+ /**
710
+ * FFmpeg options
711
+ */
712
+ ffmpeg: FFmpegOptions;
713
+ /**
714
+ * Seek time (in seconds).
715
+ * @default 0
716
+ */
717
+ seek?: number;
718
+ }
719
+ declare const checkFFmpeg: (distube: DisTube) => void;
720
+ /**
721
+ * Create a stream to play with {@link DisTubeVoice}
722
+ */
723
+ declare class DisTubeStream extends TypedEmitter<{
724
+ debug: (debug: string) => Awaitable;
725
+ error: (error: Error) => Awaitable;
726
+ }> {
727
+ #private;
728
+ process?: ChildProcess;
729
+ stream: VolumeTransformer;
730
+ audioResource: AudioResource;
731
+ /**
732
+ * Create a DisTubeStream to play with {@link DisTubeVoice}
733
+ * @param url - Stream URL
734
+ * @param options - Stream options
735
+ */
736
+ constructor(url: string, options: StreamOptions);
737
+ spawn(): void;
738
+ private debug;
739
+ setVolume(volume: number): void;
740
+ kill(): void;
741
+ }
742
+ declare class VolumeTransformer extends Transform {
743
+ private buffer;
744
+ private readonly extrema;
745
+ vol: number;
746
+ _transform(newChunk: Buffer, _encoding: BufferEncoding, done: TransformCallback): void;
747
+ }
748
+
749
+ /**
750
+ * DisTube's Handler
751
+ */
752
+ declare class DisTubeHandler extends DisTubeBase {
753
+ #private;
754
+ resolve<T = unknown>(song: Song<T>, options?: Omit<ResolveOptions, "metadata">): Promise<Song<T>>;
755
+ resolve<T = unknown>(song: Playlist<T>, options?: Omit<ResolveOptions, "metadata">): Promise<Playlist<T>>;
756
+ resolve<T = unknown>(song: string, options?: ResolveOptions<T>): Promise<Song<T> | Playlist<T>>;
757
+ resolve<T = unknown>(song: Song, options: ResolveOptions<T>): Promise<Song<T>>;
758
+ resolve<T = unknown>(song: Playlist, options: ResolveOptions<T>): Promise<Playlist<T>>;
759
+ resolve(song: string | Song | Playlist, options?: ResolveOptions): Promise<Song | Playlist>;
760
+ _getPluginFromURL(url: string): Promise<DisTubePlugin | null>;
761
+ _getPluginFromSong(song: Song): Promise<DisTubePlugin | null>;
762
+ _getPluginFromSong<T extends PluginType>(song: Song, types: T[], validate?: boolean): Promise<(DisTubePlugin & {
763
+ type: T;
764
+ }) | null>;
765
+ /**
766
+ * Get {@link Song}'s stream info and attach it to the song.
767
+ * @param song - A Song
768
+ */
769
+ attachStreamInfo(song: Song): Promise<void>;
770
+ followRedirectLink(url: string, maxRedirect?: number): Promise<string>;
771
+ }
772
+
773
+ declare class Options {
774
+ #private;
775
+ plugins: DisTubePlugin[];
776
+ emitNewSongOnly: boolean;
777
+ savePreviousSongs: boolean;
778
+ customFilters?: Filters;
779
+ nsfw: boolean;
780
+ emitAddSongWhenCreatingQueue: boolean;
781
+ emitAddListWhenCreatingQueue: boolean;
782
+ joinNewVoiceChannel: boolean;
783
+ ffmpeg: FFmpegOptions;
784
+ constructor(options: DisTubeOptions);
785
+ }
786
+
787
+ /**
788
+ * Manages the collection of a data model.
789
+ */
790
+ declare abstract class BaseManager<V> extends DisTubeBase {
791
+ /**
792
+ * The collection of items for this manager.
793
+ */
794
+ collection: Collection<string, V>;
795
+ /**
796
+ * The size of the collection.
797
+ */
798
+ get size(): number;
799
+ }
800
+
801
+ /**
802
+ * Manages the collection of a data model paired with a guild id.
803
+ */
804
+ declare abstract class GuildIdManager<V> extends BaseManager<V> {
805
+ add(idOrInstance: GuildIdResolvable, data: V): this;
806
+ get(idOrInstance: GuildIdResolvable): V | undefined;
807
+ remove(idOrInstance: GuildIdResolvable): boolean;
808
+ has(idOrInstance: GuildIdResolvable): boolean;
809
+ }
810
+
811
+ /**
812
+ * Manages voice connections
813
+ */
814
+ declare class DisTubeVoiceManager extends GuildIdManager<DisTubeVoice> {
815
+ /**
816
+ * Create a {@link DisTubeVoice} instance
817
+ * @param channel - A voice channel to join
818
+ */
819
+ create(channel: VoiceBasedChannel): DisTubeVoice;
820
+ /**
821
+ * Join a voice channel and wait until the connection is ready
822
+ * @param channel - A voice channel to join
823
+ */
824
+ join(channel: VoiceBasedChannel): Promise<DisTubeVoice>;
825
+ /**
826
+ * Leave the connected voice channel in a guild
827
+ * @param guild - Queue Resolvable
828
+ */
829
+ leave(guild: GuildIdResolvable): void;
830
+ }
831
+
832
+ /**
833
+ * Manage filters of a playing {@link Queue}
834
+ */
835
+ declare class FilterManager extends BaseManager<Filter> {
836
+ #private;
837
+ /**
838
+ * The queue to manage
839
+ */
840
+ queue: Queue;
841
+ constructor(queue: Queue);
842
+ /**
843
+ * Enable a filter or multiple filters to the manager
844
+ * @param filterOrFilters - The filter or filters to enable
845
+ * @param override - Wether or not override the applied filter with new filter value
846
+ */
847
+ add(filterOrFilters: FilterResolvable | FilterResolvable[], override?: boolean): this;
848
+ /**
849
+ * Clear enabled filters of the manager
850
+ */
851
+ clear(): this;
852
+ /**
853
+ * Set the filters applied to the manager
854
+ * @param filters - The filters to apply
855
+ */
856
+ set(filters: FilterResolvable[]): this;
857
+ /**
858
+ * Disable a filter or multiple filters
859
+ * @param filterOrFilters - The filter or filters to disable
860
+ */
861
+ remove(filterOrFilters: FilterResolvable | FilterResolvable[]): this;
862
+ /**
863
+ * Check whether a filter enabled or not
864
+ * @param filter - The filter to check
865
+ */
866
+ has(filter: FilterResolvable): boolean;
867
+ /**
868
+ * Array of enabled filter names
869
+ */
870
+ get names(): string[];
871
+ /**
872
+ * Array of enabled filters
873
+ */
874
+ get values(): Filter[];
875
+ get ffmpegArgs(): FFmpegArg;
876
+ toString(): string;
877
+ }
878
+
879
+ /**
880
+ * Queue manager
881
+ */
882
+ declare class QueueManager extends GuildIdManager<Queue> {
883
+ #private;
884
+ /**
885
+ * Create a {@link Queue}
886
+ * @param channel - A voice channel
887
+ * @param textChannel - Default text channel
888
+ * @returns Returns `true` if encounter an error
889
+ */
890
+ create(channel: VoiceBasedChannel, textChannel?: GuildTextBasedChannel): Promise<Queue>;
891
+ /**
892
+ * Play a song on voice connection with queue properties
893
+ * @param queue - The guild queue to play
894
+ * @param emitPlaySong - Whether or not emit {@link Events.PLAY_SONG} event
895
+ */
896
+ playSong(queue: Queue, emitPlaySong?: boolean): Promise<void>;
897
+ }
898
+
899
+ /**
900
+ * Represents a queue.
901
+ */
902
+ declare class Queue extends DisTubeBase {
903
+ #private;
904
+ /**
905
+ * Queue id (Guild id)
906
+ */
907
+ readonly id: Snowflake;
908
+ /**
909
+ * Voice connection of this queue.
910
+ */
911
+ voice: DisTubeVoice;
912
+ /**
913
+ * List of songs in the queue (The first one is the playing song)
914
+ */
915
+ songs: Song[];
916
+ /**
917
+ * List of the previous songs.
918
+ */
919
+ previousSongs: Song[];
920
+ /**
921
+ * Whether stream is currently stopped.
922
+ */
923
+ stopped: boolean;
924
+ /**
925
+ * Whether or not the stream is currently playing.
926
+ */
927
+ playing: boolean;
928
+ /**
929
+ * Whether or not the stream is currently paused.
930
+ */
931
+ paused: boolean;
932
+ /**
933
+ * Type of repeat mode (`0` is disabled, `1` is repeating a song, `2` is repeating
934
+ * all the queue). Default value: `0` (disabled)
935
+ */
936
+ repeatMode: RepeatMode;
937
+ /**
938
+ * Whether or not the autoplay mode is enabled. Default value: `false`
939
+ */
940
+ autoplay: boolean;
941
+ /**
942
+ * FFmpeg arguments for the current queue. Default value is defined with {@link DisTubeOptions}.ffmpeg.args.
943
+ * `af` output argument will be replaced with {@link Queue#filters} manager
944
+ */
945
+ ffmpegArgs: FFmpegArgs;
946
+ /**
947
+ * The text channel of the Queue. (Default: where the first command is called).
948
+ */
949
+ textChannel?: GuildTextBasedChannel;
950
+ /**
951
+ * What time in the song to begin (in seconds).
952
+ */
953
+ _beginTime: number;
954
+ /**
955
+ * Whether or not the last song was skipped to next song.
956
+ */
957
+ _next: boolean;
958
+ /**
959
+ * Whether or not the last song was skipped to previous song.
960
+ */
961
+ _prev: boolean;
962
+ /**
963
+ * Task queuing system
964
+ */
965
+ _taskQueue: TaskQueue;
966
+ /**
967
+ * {@link DisTubeVoice} listener
968
+ */
969
+ _listeners?: DisTubeVoiceEvents;
970
+ /**
971
+ * Create a queue for the guild
972
+ * @param distube - DisTube
973
+ * @param voice - Voice connection
974
+ * @param textChannel - Default text channel
975
+ */
976
+ constructor(distube: DisTube, voice: DisTubeVoice, textChannel?: GuildTextBasedChannel);
977
+ /**
978
+ * The client user as a `GuildMember` of this queue's guild
979
+ */
980
+ get clientMember(): discord_js.GuildMember | undefined;
981
+ /**
982
+ * The filter manager of the queue
983
+ */
984
+ get filters(): FilterManager;
985
+ /**
986
+ * Formatted duration string.
987
+ */
988
+ get formattedDuration(): string;
989
+ /**
990
+ * Queue's duration.
991
+ */
992
+ get duration(): number;
993
+ /**
994
+ * What time in the song is playing (in seconds).
995
+ */
996
+ get currentTime(): number;
997
+ /**
998
+ * Formatted {@link Queue#currentTime} string.
999
+ */
1000
+ get formattedCurrentTime(): string;
1001
+ /**
1002
+ * The voice channel playing in.
1003
+ */
1004
+ get voiceChannel(): discord_js.VoiceBasedChannel | null;
1005
+ /**
1006
+ * Get or set the stream volume. Default value: `50`.
1007
+ */
1008
+ get volume(): number;
1009
+ set volume(value: number);
1010
+ /**
1011
+ * @throws {DisTubeError}
1012
+ * @param song - Song to add
1013
+ * @param position - Position to add, \<= 0 to add to the end of the queue
1014
+ * @returns The guild queue
1015
+ */
1016
+ addToQueue(song: Song | Song[], position?: number): Queue;
1017
+ /**
1018
+ * @returns `true` if the queue is playing
1019
+ */
1020
+ isPlaying(): boolean;
1021
+ /**
1022
+ * @returns `true` if the queue is paused
1023
+ */
1024
+ isPaused(): boolean;
1025
+ /**
1026
+ * Pause the guild stream
1027
+ * @returns The guild queue
1028
+ */
1029
+ pause(): Queue;
1030
+ /**
1031
+ * Resume the guild stream
1032
+ * @returns The guild queue
1033
+ */
1034
+ resume(): Queue;
1035
+ /**
1036
+ * Set the guild stream's volume
1037
+ * @param percent - The percentage of volume you want to set
1038
+ * @returns The guild queue
1039
+ */
1040
+ setVolume(percent: number): Queue;
1041
+ /**
1042
+ * Skip the playing song if there is a next song in the queue. <info>If {@link
1043
+ * Queue#autoplay} is `true` and there is no up next song, DisTube will add and
1044
+ * play a related song.</info>
1045
+ * @returns The song will skip to
1046
+ */
1047
+ skip(): Promise<Song>;
1048
+ /**
1049
+ * Play the previous song if exists
1050
+ * @returns The guild queue
1051
+ */
1052
+ previous(): Promise<Song>;
1053
+ /**
1054
+ * Shuffle the queue's songs
1055
+ * @returns The guild queue
1056
+ */
1057
+ shuffle(): Promise<Queue>;
1058
+ /**
1059
+ * Jump to the song position in the queue. The next one is 1, 2,... The previous
1060
+ * one is -1, -2,...
1061
+ * if `num` is invalid number
1062
+ * @param position - The song position to play
1063
+ * @returns The new Song will be played
1064
+ */
1065
+ jump(position: number): Promise<Song>;
1066
+ /**
1067
+ * Set the repeat mode of the guild queue.
1068
+ * Toggle mode `(Disabled -> Song -> Queue -> Disabled ->...)` if `mode` is `undefined`
1069
+ * @param mode - The repeat modes (toggle if `undefined`)
1070
+ * @returns The new repeat mode
1071
+ */
1072
+ setRepeatMode(mode?: RepeatMode): RepeatMode;
1073
+ /**
1074
+ * Set the playing time to another position
1075
+ * @param time - Time in seconds
1076
+ * @returns The guild queue
1077
+ */
1078
+ seek(time: number): Queue;
1079
+ /**
1080
+ * Add a related song of the playing song to the queue
1081
+ * @returns The added song
1082
+ */
1083
+ addRelatedSong(): Promise<Song>;
1084
+ /**
1085
+ * Stop the guild stream and delete the queue
1086
+ */
1087
+ stop(): Promise<void>;
1088
+ /**
1089
+ * Remove the queue from the manager
1090
+ */
1091
+ remove(): void;
1092
+ /**
1093
+ * Toggle autoplay mode
1094
+ * @returns Autoplay mode state
1095
+ */
1096
+ toggleAutoplay(): boolean;
1097
+ /**
1098
+ * Play the first song in the queue
1099
+ * @param emitPlaySong - Whether or not emit {@link Events.PLAY_SONG} event
1100
+ */
1101
+ play(emitPlaySong?: boolean): Promise<void>;
1102
+ }
1103
+
1104
+ /**
1105
+ * DisTube Plugin
1106
+ */
1107
+ declare abstract class Plugin {
1108
+ /**
1109
+ * Type of the plugin
1110
+ */
1111
+ abstract readonly type: PluginType;
1112
+ /**
1113
+ * DisTube
1114
+ */
1115
+ distube: DisTube;
1116
+ init(distube: DisTube): void;
1117
+ /**
1118
+ * Get related songs from a supported url.
1119
+ * @param song - Input song
1120
+ */
1121
+ abstract getRelatedSongs(song: Song): Awaitable<Song[]>;
1122
+ }
1123
+
1124
+ /**
1125
+ * This plugin can extract the info, search, and play a song directly from its source
1126
+ */
1127
+ declare abstract class ExtractorPlugin extends Plugin {
1128
+ readonly type = PluginType.EXTRACTOR;
1129
+ /**
1130
+ * Check if the url is working with this plugin
1131
+ * @param url - Input url
1132
+ */
1133
+ abstract validate(url: string): Awaitable<boolean>;
1134
+ /**
1135
+ * Resolve the validated url to a {@link Song} or a {@link Playlist}.
1136
+ * @param url - URL
1137
+ * @param options - Optional options
1138
+ */
1139
+ abstract resolve<T>(url: string, options: ResolveOptions<T>): Awaitable<Song<T> | Playlist<T>>;
1140
+ /**
1141
+ * Search for a Song which playable from this plugin's source
1142
+ * @param query - Search query
1143
+ * @param options - Optional options
1144
+ */
1145
+ abstract searchSong<T>(query: string, options: ResolveOptions<T>): Awaitable<Song<T> | null>;
1146
+ /**
1147
+ * Get the stream url from {@link Song#url}. Returns {@link Song#url} by default.
1148
+ * Not needed if the plugin plays song from YouTube.
1149
+ * @param song - Input song
1150
+ */
1151
+ abstract getStreamURL<T>(song: Song<T>): Awaitable<string>;
1152
+ }
1153
+
1154
+ /**
1155
+ * This plugin only can extract the info from supported links, but not play song directly from its source
1156
+ */
1157
+ declare abstract class InfoExtractorPlugin extends Plugin {
1158
+ readonly type = PluginType.INFO_EXTRACTOR;
1159
+ /**
1160
+ * Check if the url is working with this plugin
1161
+ * @param url - Input url
1162
+ */
1163
+ abstract validate(url: string): Awaitable<boolean>;
1164
+ /**
1165
+ * Resolve the validated url to a {@link Song} or a {@link Playlist}.
1166
+ * @param url - URL
1167
+ * @param options - Optional options
1168
+ */
1169
+ abstract resolve<T>(url: string, options: ResolveOptions<T>): Awaitable<Song<T> | Playlist<T>>;
1170
+ /**
1171
+ * Create a search query to be used in {@link ExtractorPlugin#searchSong}
1172
+ * @param song - Input song
1173
+ */
1174
+ abstract createSearchQuery<T>(song: Song<T>): Awaitable<string>;
1175
+ }
1176
+
1177
+ /**
1178
+ * This plugin can extract and play song from supported links, but cannot search for songs from its source
1179
+ */
1180
+ declare abstract class PlayableExtractorPlugin extends Plugin {
1181
+ readonly type = PluginType.PLAYABLE_EXTRACTOR;
1182
+ /**
1183
+ * Check if the url is working with this plugin
1184
+ * @param url - Input url
1185
+ */
1186
+ abstract validate(url: string): Awaitable<boolean>;
1187
+ /**
1188
+ * Resolve the validated url to a {@link Song} or a {@link Playlist}.
1189
+ * @param url - URL
1190
+ * @param options - Optional options
1191
+ */
1192
+ abstract resolve<T>(url: string, options: ResolveOptions<T>): Awaitable<Song<T> | Playlist<T>>;
1193
+ /**
1194
+ * Get the stream url from {@link Song#url}. Returns {@link Song#url} by default.
1195
+ * Not needed if the plugin plays song from YouTube.
1196
+ * @param song - Input song
1197
+ */
1198
+ abstract getStreamURL<T>(song: Song<T>): Awaitable<string>;
1199
+ }
1200
+
1201
+ /**
1202
+ * Format duration to string
1203
+ * @param sec - Duration in seconds
1204
+ */
1205
+ declare function formatDuration(sec: number): string;
1206
+ declare const SUPPORTED_PROTOCOL: readonly ["https:", "http:", "file:"];
1207
+ /**
1208
+ * Check if the string is an URL
1209
+ * @param input - input
1210
+ */
1211
+ declare function isURL(input: any): input is `${(typeof SUPPORTED_PROTOCOL)[number]}//${string}`;
1212
+ /**
1213
+ * Check if the Client has enough intents to using DisTube
1214
+ * @param options - options
1215
+ */
1216
+ declare function checkIntents(options: ClientOptions): void;
1217
+ /**
1218
+ * Check if the voice channel is empty
1219
+ * @param voiceState - voiceState
1220
+ */
1221
+ declare function isVoiceChannelEmpty(voiceState: VoiceState): boolean;
1222
+ declare function isSnowflake(id: any): id is Snowflake;
1223
+ declare function isMemberInstance(member: any): member is GuildMember;
1224
+ declare function isTextChannelInstance(channel: any): channel is GuildTextBasedChannel;
1225
+ declare function isMessageInstance(message: any): message is Message<true>;
1226
+ declare function isSupportedVoiceChannel(channel: any): channel is VoiceBasedChannel;
1227
+ declare function isGuildInstance(guild: any): guild is Guild;
1228
+ declare function resolveGuildId(resolvable: GuildIdResolvable): Snowflake;
1229
+ declare function isClientInstance(client: any): client is Client;
1230
+ declare function checkInvalidKey(target: Record<string, any>, source: Record<string, any> | string[], sourceName: string): void;
1231
+ declare function isObject(obj: any): obj is object;
1232
+ type KeyOf<T> = T extends object ? (keyof T)[] : [];
1233
+ declare function objectKeys<T>(obj: T): KeyOf<T>;
1234
+ declare function isNsfwChannel(channel?: GuildTextBasedChannel): boolean;
1235
+ type Falsy = undefined | null | false | 0 | "";
1236
+ declare const isTruthy: <T>(x: T | Falsy) => x is T;
1237
+ declare const checkEncryptionLibraries: () => boolean;
1238
+
1239
+ /**
1240
+ * DisTube class
1241
+ */
1242
+ declare class DisTube extends TypedEmitter<TypedDisTubeEvents> {
1243
+ #private;
1244
+ /**
1245
+ * @event
1246
+ * Emitted after DisTube add a new playlist to the playing {@link Queue}.
1247
+ * @param queue - The guild queue
1248
+ * @param playlist - Playlist info
1249
+ */
1250
+ static readonly [Events.ADD_LIST]: (queue: Queue, playlist: Playlist) => Awaitable;
1251
+ /**
1252
+ * @event
1253
+ * Emitted after DisTube add a new song to the playing {@link Queue}.
1254
+ * @param queue - The guild queue
1255
+ * @param song - Added song
1256
+ */
1257
+ static readonly [Events.ADD_SONG]: (queue: Queue, song: Song) => Awaitable;
1258
+ /**
1259
+ * @event
1260
+ * Emitted when a {@link Queue} is deleted with any reasons.
1261
+ * @param queue - The guild queue
1262
+ */
1263
+ static readonly [Events.DELETE_QUEUE]: (queue: Queue) => Awaitable;
1264
+ /**
1265
+ * @event
1266
+ * Emitted when the bot is disconnected to a voice channel.
1267
+ * @param queue - The guild queue
1268
+ */
1269
+ static readonly [Events.DISCONNECT]: (queue: Queue) => Awaitable;
1270
+ /**
1271
+ * @event
1272
+ * Emitted when DisTube encounters an error while playing songs.
1273
+ * @param error - error
1274
+ * @param queue - The queue encountered the error
1275
+ * @param song - The playing song when encountered the error
1276
+ */
1277
+ static readonly [Events.ERROR]: (error: Error, queue: Queue, song?: Song) => Awaitable;
1278
+ /**
1279
+ * @event
1280
+ * Emitted for logging FFmpeg debug information.
1281
+ * @param debug - Debug message string.
1282
+ */
1283
+ static readonly [Events.FFMPEG_DEBUG]: (debug: string) => Awaitable;
1284
+ /**
1285
+ * @event
1286
+ * Emitted to provide debug information from DisTube's operation.
1287
+ * Useful for troubleshooting or logging purposes.
1288
+ *
1289
+ * @param debug - Debug message string.
1290
+ */
1291
+ static readonly [Events.DEBUG]: (debug: string) => Awaitable;
1292
+ /**
1293
+ * @event
1294
+ * Emitted when there is no more song in the queue and {@link Queue#autoplay} is `false`.
1295
+ * @param queue - The guild queue
1296
+ */
1297
+ static readonly [Events.FINISH]: (queue: Queue) => Awaitable;
1298
+ /**
1299
+ * @event
1300
+ * Emitted when DisTube finished a song.
1301
+ * @param queue - The guild queue
1302
+ * @param song - Finished song
1303
+ */
1304
+ static readonly [Events.FINISH_SONG]: (queue: Queue, song: Song) => Awaitable;
1305
+ /**
1306
+ * @event
1307
+ * Emitted when DisTube initialize a queue to change queue default properties.
1308
+ * @param queue - The guild queue
1309
+ */
1310
+ static readonly [Events.INIT_QUEUE]: (queue: Queue) => Awaitable;
1311
+ /**
1312
+ * @event
1313
+ * Emitted when {@link Queue#autoplay} is `true`, {@link Queue#songs} is empty, and
1314
+ * DisTube cannot find related songs to play.
1315
+ * @param queue - The guild queue
1316
+ */
1317
+ static readonly [Events.NO_RELATED]: (queue: Queue) => Awaitable;
1318
+ /**
1319
+ * @event
1320
+ * Emitted when DisTube play a song.
1321
+ * If {@link DisTubeOptions}.emitNewSongOnly is `true`, this event is not emitted
1322
+ * when looping a song or next song is the previous one.
1323
+ * @param queue - The guild queue
1324
+ * @param song - Playing song
1325
+ */
1326
+ static readonly [Events.PLAY_SONG]: (queue: Queue, song: Song) => Awaitable;
1327
+ /**
1328
+ * DisTube internal handler
1329
+ */
1330
+ readonly handler: DisTubeHandler;
1331
+ /**
1332
+ * DisTube options
1333
+ */
1334
+ readonly options: Options;
1335
+ /**
1336
+ * Discord.js v14 client
1337
+ */
1338
+ readonly client: Client;
1339
+ /**
1340
+ * Queues manager
1341
+ */
1342
+ readonly queues: QueueManager;
1343
+ /**
1344
+ * DisTube voice connections manager
1345
+ */
1346
+ readonly voices: DisTubeVoiceManager;
1347
+ /**
1348
+ * DisTube plugins
1349
+ */
1350
+ readonly plugins: DisTubePlugin[];
1351
+ /**
1352
+ * DisTube ffmpeg audio filters
1353
+ */
1354
+ readonly filters: Filters;
1355
+ /**
1356
+ * Create a new DisTube class.
1357
+ * @throws {@link DisTubeError}
1358
+ * @param client - Discord.JS client
1359
+ * @param opts - Custom DisTube options
1360
+ */
1361
+ constructor(client: Client, opts?: DisTubeOptions);
1362
+ static get version(): string;
1363
+ /**
1364
+ * DisTube version
1365
+ */
1366
+ get version(): string;
1367
+ /**
1368
+ * Play / add a song or playlist from url.
1369
+ * Search and play a song (with {@link ExtractorPlugin}) if it is not a valid url.
1370
+ * @throws {@link DisTubeError}
1371
+ * @param voiceChannel - The channel will be joined if the bot isn't in any channels, the bot will be
1372
+ * moved to this channel if {@link DisTubeOptions}.joinNewVoiceChannel is `true`
1373
+ * @param song - URL | Search string | {@link Song} | {@link Playlist}
1374
+ * @param options - Optional options
1375
+ */
1376
+ play<T = unknown>(voiceChannel: VoiceBasedChannel, song: string | Song | Playlist, options?: PlayOptions<T>): Promise<void>;
1377
+ /**
1378
+ * Create a custom playlist
1379
+ * @param songs - Array of url or Song
1380
+ * @param options - Optional options
1381
+ */
1382
+ createCustomPlaylist(songs: (string | Song)[], { member, parallel, metadata, name, source, url, thumbnail }?: CustomPlaylistOptions): Promise<Playlist>;
1383
+ /**
1384
+ * Get the guild queue
1385
+ * @param guild - The type can be resolved to give a {@link Queue}
1386
+ */
1387
+ getQueue(guild: GuildIdResolvable): Queue | undefined;
1388
+ /**
1389
+ * Pause the guild stream
1390
+ * @param guild - The type can be resolved to give a {@link Queue}
1391
+ * @returns The guild queue
1392
+ */
1393
+ pause(guild: GuildIdResolvable): Queue;
1394
+ /**
1395
+ * Resume the guild stream
1396
+ * @param guild - The type can be resolved to give a {@link Queue}
1397
+ * @returns The guild queue
1398
+ */
1399
+ resume(guild: GuildIdResolvable): Queue;
1400
+ /**
1401
+ * Stop the guild stream
1402
+ * @param guild - The type can be resolved to give a {@link Queue}
1403
+ */
1404
+ stop(guild: GuildIdResolvable): Promise<void>;
1405
+ /**
1406
+ * Set the guild stream's volume
1407
+ * @param guild - The type can be resolved to give a {@link Queue}
1408
+ * @param percent - The percentage of volume you want to set
1409
+ * @returns The guild queue
1410
+ */
1411
+ setVolume(guild: GuildIdResolvable, percent: number): Queue;
1412
+ /**
1413
+ * Skip the playing song if there is a next song in the queue. <info>If {@link
1414
+ * Queue#autoplay} is `true` and there is no up next song, DisTube will add and
1415
+ * play a related song.</info>
1416
+ * @param guild - The type can be resolved to give a {@link Queue}
1417
+ * @returns The new Song will be played
1418
+ */
1419
+ skip(guild: GuildIdResolvable): Promise<Song>;
1420
+ /**
1421
+ * Play the previous song
1422
+ * @param guild - The type can be resolved to give a {@link Queue}
1423
+ * @returns The new Song will be played
1424
+ */
1425
+ previous(guild: GuildIdResolvable): Promise<Song>;
1426
+ /**
1427
+ * Shuffle the guild queue songs
1428
+ * @param guild - The type can be resolved to give a {@link Queue}
1429
+ * @returns The guild queue
1430
+ */
1431
+ shuffle(guild: GuildIdResolvable): Promise<Queue>;
1432
+ /**
1433
+ * Jump to the song number in the queue. The next one is 1, 2,... The previous one
1434
+ * is -1, -2,...
1435
+ * @param guild - The type can be resolved to give a {@link Queue}
1436
+ * @param num - The song number to play
1437
+ * @returns The new Song will be played
1438
+ */
1439
+ jump(guild: GuildIdResolvable, num: number): Promise<Song>;
1440
+ /**
1441
+ * Set the repeat mode of the guild queue.
1442
+ * Toggle mode `(Disabled -> Song -> Queue -> Disabled ->...)` if `mode` is `undefined`
1443
+ * @param guild - The type can be resolved to give a {@link Queue}
1444
+ * @param mode - The repeat modes (toggle if `undefined`)
1445
+ * @returns The new repeat mode
1446
+ */
1447
+ setRepeatMode(guild: GuildIdResolvable, mode?: RepeatMode): RepeatMode;
1448
+ /**
1449
+ * Toggle autoplay mode
1450
+ * @param guild - The type can be resolved to give a {@link Queue}
1451
+ * @returns Autoplay mode state
1452
+ */
1453
+ toggleAutoplay(guild: GuildIdResolvable): boolean;
1454
+ /**
1455
+ * Add related song to the queue
1456
+ * @param guild - The type can be resolved to give a {@link Queue}
1457
+ * @returns The guild queue
1458
+ */
1459
+ addRelatedSong(guild: GuildIdResolvable): Promise<Song>;
1460
+ /**
1461
+ * Set the playing time to another position
1462
+ * @param guild - The type can be resolved to give a {@link Queue}
1463
+ * @param time - Time in seconds
1464
+ * @returns Seeked queue
1465
+ */
1466
+ seek(guild: GuildIdResolvable, time: number): Queue;
1467
+ /**
1468
+ * Emit error event
1469
+ * @param error - error
1470
+ * @param queue - The queue encountered the error
1471
+ * @param song - The playing song when encountered the error
1472
+ */
1473
+ emitError(error: Error, queue: Queue, song?: Song): void;
1474
+ /**
1475
+ * Emit debug event
1476
+ * @param message - debug message
1477
+ */
1478
+ debug(message: string): void;
1479
+ }
1480
+
1481
+ /**
1482
+ * The current version that you are currently using.
1483
+ *
1484
+ * Note to developers:
1485
+ * This needs to explicitly be `string` so it is not typed as a "const string" that gets injected by esbuild
1486
+ */
1487
+ declare const version: string;
1488
+
1489
+ export { type Awaitable, BaseManager, type CustomPlaylistOptions, DisTube, DisTubeBase, DisTubeError, type DisTubeEvents, DisTubeHandler, type DisTubeOptions, type DisTubePlugin, DisTubeStream, DisTubeVoice, type DisTubeVoiceEvents, DisTubeVoiceManager, Events, ExtractorPlugin, type FFmpegArg, type FFmpegArgs, type FFmpegOptions, type Falsy, type Filter, FilterManager, type FilterResolvable, type Filters, GuildIdManager, type GuildIdResolvable, InfoExtractorPlugin, type KeyOf, Options, type PlayHandlerOptions, type PlayOptions, PlayableExtractorPlugin, Playlist, type PlaylistInfo, Plugin, PluginType, Queue, QueueManager, type RelatedSong, RepeatMode, type ResolveOptions, type ResolvePlaylistOptions, Song, type SongInfo, type StreamOptions, TaskQueue, type TypedDisTubeEvents, checkEncryptionLibraries, checkFFmpeg, checkIntents, checkInvalidKey, DisTube as default, defaultFilters, defaultOptions, formatDuration, isClientInstance, isGuildInstance, isMemberInstance, isMessageInstance, isNsfwChannel, isObject, isSnowflake, isSupportedVoiceChannel, isTextChannelInstance, isTruthy, isURL, isVoiceChannelEmpty, objectKeys, resolveGuildId, version };