@kattowo/distube 0.0.0-stage → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3260 @@
1
+ import * as discord_js from 'discord.js';
2
+ import { Snowflake, Message, GuildTextBasedChannel, VoiceBasedChannel, VoiceState, Guild, GuildMember, Interaction, Collection, Client, ClientOptions } from 'discord.js';
3
+ import { AudioResource, AudioPlayer, VoiceConnection } from '@discordjs/voice';
4
+ import { TypedEmitter } from 'tiny-typed-emitter';
5
+ import { ChildProcess } from 'node:child_process';
6
+ import { Transform, TransformCallback, Readable } from 'node:stream';
7
+ import { IncomingMessage } from 'node:http';
8
+
9
+ /**
10
+ * A value that can be awaited.
11
+ *
12
+ * It is used by every method of DisTube that can be implemented
13
+ * synchronously or asynchronously: the plugin methods and the event
14
+ * listeners.
15
+ */
16
+ type Awaitable<T = any> = T | PromiseLike<T>;
17
+ /**
18
+ * Behavior when the {@link Events.ERROR} event is emitted but nobody listens to it.
19
+ * - `log` (default): the error is logged to the console instead of crashing the process
20
+ * - `throw`: the error is re-thrown (Node.js default behavior)
21
+ * - `ignore`: the error is silently discarded
22
+ */
23
+ type UnhandledErrorBehavior = "log" | "throw" | "ignore";
24
+ /**
25
+ * The events emitted by a {@link DisTube} instance.
26
+ */
27
+ declare enum Events {
28
+ /**
29
+ * Emitted when DisTube encounters an error while playing songs.
30
+ *
31
+ * It is the only special event: Node.js crashes the process when the
32
+ * `"error"` event is emitted without any listener. DisTube handles it
33
+ * gracefully instead, following {@link DisTubeOptions.unhandledError}.
34
+ */
35
+ ERROR = "error",
36
+ /**
37
+ * Emitted after a new playlist is added to a {@link Queue}.
38
+ */
39
+ ADD_LIST = "addList",
40
+ /**
41
+ * Emitted after a new song is added to a {@link Queue}.
42
+ */
43
+ ADD_SONG = "addSong",
44
+ /**
45
+ * Emitted when a song starts playing.
46
+ */
47
+ PLAY_SONG = "playSong",
48
+ /**
49
+ * Emitted when a song finished playing.
50
+ */
51
+ FINISH_SONG = "finishSong",
52
+ /**
53
+ * Emitted when a {@link Queue} runs out of songs to play.
54
+ */
55
+ EMPTY = "empty",
56
+ /**
57
+ * Emitted when a {@link Queue} is finished, and its autoplay mode is
58
+ * disabled.
59
+ */
60
+ FINISH = "finish",
61
+ /**
62
+ * Emitted when a {@link Queue} is initialized, to change its default
63
+ * properties.
64
+ */
65
+ INIT_QUEUE = "initQueue",
66
+ /**
67
+ * Emitted when the autoplay mode is enabled and no related song could be
68
+ * found.
69
+ */
70
+ NO_RELATED = "noRelated",
71
+ /**
72
+ * Emitted when the bot is disconnected from a voice channel.
73
+ */
74
+ DISCONNECT = "disconnect",
75
+ /**
76
+ * Emitted when a {@link Queue} is deleted.
77
+ */
78
+ DELETE_QUEUE = "deleteQueue",
79
+ /**
80
+ * Emitted for logging FFmpeg debug information.
81
+ */
82
+ FFMPEG_DEBUG = "ffmpegDebug",
83
+ /**
84
+ * Emitted to provide debug information from DisTube's operation.
85
+ */
86
+ DEBUG = "debug"
87
+ }
88
+ /**
89
+ * The arguments of every {@link Events} event.
90
+ *
91
+ * It is the source of truth of the signature of the event listeners:
92
+ * @see {@link TypedDisTubeEvents}
93
+ */
94
+ type DisTubeEvents = {
95
+ /**
96
+ * Emitted after a new playlist is added to a {@link Queue}.
97
+ */
98
+ [Events.ADD_LIST]: [queue: Queue, playlist: Playlist];
99
+ /**
100
+ * Emitted after a new song is added to a {@link Queue}.
101
+ */
102
+ [Events.ADD_SONG]: [queue: Queue, song: Song];
103
+ /**
104
+ * Emitted when a {@link Queue} is deleted.
105
+ */
106
+ [Events.DELETE_QUEUE]: [queue: Queue];
107
+ /**
108
+ * Emitted when the bot is disconnected from a voice channel.
109
+ */
110
+ [Events.DISCONNECT]: [queue: Queue];
111
+ /**
112
+ * Emitted when a {@link Queue} runs out of songs to play.
113
+ */
114
+ [Events.EMPTY]: [queue: Queue];
115
+ /**
116
+ * Emitted when DisTube encounters an error while playing songs.
117
+ */
118
+ [Events.ERROR]: [error: Error, queue: Queue, song: Song | undefined];
119
+ /**
120
+ * Emitted for logging FFmpeg debug information.
121
+ */
122
+ [Events.FFMPEG_DEBUG]: [debug: string];
123
+ /**
124
+ * Emitted to provide debug information from DisTube's operation.
125
+ */
126
+ [Events.DEBUG]: [debug: string];
127
+ /**
128
+ * Emitted when a {@link Queue} is finished, and its autoplay mode is
129
+ * disabled.
130
+ */
131
+ [Events.FINISH]: [queue: Queue];
132
+ /**
133
+ * Emitted when a song finished playing.
134
+ */
135
+ [Events.FINISH_SONG]: [queue: Queue, song: Song];
136
+ /**
137
+ * Emitted when a {@link Queue} is initialized.
138
+ */
139
+ [Events.INIT_QUEUE]: [queue: Queue];
140
+ /**
141
+ * Emitted when the autoplay mode is enabled and no related song could be
142
+ * found.
143
+ */
144
+ [Events.NO_RELATED]: [queue: Queue, error: DisTubeError];
145
+ /**
146
+ * Emitted when a song starts playing.
147
+ */
148
+ [Events.PLAY_SONG]: [queue: Queue, song: Song];
149
+ };
150
+ /**
151
+ * The typed event listeners of a {@link DisTube} instance.
152
+ *
153
+ * Every listener of an event receives the arguments of
154
+ * {@link DisTubeEvents}, and can be synchronous or asynchronous.
155
+ */
156
+ type TypedDisTubeEvents = {
157
+ [K in keyof DisTubeEvents]: (...args: DisTubeEvents[K]) => Awaitable;
158
+ };
159
+ /**
160
+ * The events emitted by a {@link DisTubeVoice} instance.
161
+ */
162
+ type DisTubeVoiceEvents = {
163
+ /**
164
+ * Emitted when the voice connection is disconnected.
165
+ * @param error - The error that caused the disconnection, when there is one.
166
+ */
167
+ disconnect: (error?: Error) => Awaitable;
168
+ /**
169
+ * Emitted when an error occurs while playing the audio.
170
+ * @param error - The error
171
+ */
172
+ error: (error: Error) => Awaitable;
173
+ /**
174
+ * Emitted when the audio player becomes idle, i.e. the song is finished.
175
+ */
176
+ finish: () => Awaitable;
177
+ };
178
+ /**
179
+ * An FFmpeg audio filter object
180
+ * ```ts
181
+ * {
182
+ * name: "bassboost",
183
+ * value: "bass=g=10"
184
+ * }
185
+ * ```ts
186
+ */
187
+ interface Filter {
188
+ /**
189
+ * Name of the filter
190
+ */
191
+ name: string;
192
+ /**
193
+ * FFmpeg audio filter argument
194
+ */
195
+ value: string;
196
+ }
197
+ /**
198
+ * Data that resolves to give an FFmpeg audio filter. This can be:
199
+ * - A name of a default filters or custom filters (`string`)
200
+ * - A {@link Filter} object
201
+ * @see {@link defaultFilters}
202
+ * @see {@link DisTubeOptions|DisTubeOptions.customFilters}
203
+ */
204
+ type FilterResolvable = string | Filter;
205
+ /**
206
+ * FFmpeg Filters
207
+ * ```ts
208
+ * {
209
+ * "Filter Name": "Filter Value",
210
+ * "bassboost": "bass=g=10"
211
+ * }
212
+ * ```
213
+ * @see {@link defaultFilters}
214
+ */
215
+ type Filters = Record<string, string>;
216
+ /**
217
+ * DisTube options
218
+ */
219
+ type DisTubeOptions = {
220
+ /**
221
+ * DisTube plugins.
222
+ * The order of this effects the priority of the plugins when verifying the input.
223
+ */
224
+ plugins?: DisTubePlugin[];
225
+ /**
226
+ * Whether or not emitting {@link Events.PLAY_SONG} event when looping a song
227
+ * or next song is the same as the previous one
228
+ * @default false
229
+ */
230
+ emitNewSongOnly?: boolean;
231
+ /**
232
+ * Whether or not saving the previous songs of the queue and enable {@link
233
+ * Queue#previous} method. Disable it may help to reduce the memory usage
234
+ * @default true
235
+ */
236
+ savePreviousSongs?: boolean;
237
+ /**
238
+ * Override {@link defaultFilters} or add more ffmpeg filters
239
+ */
240
+ customFilters?: Filters;
241
+ /**
242
+ * Whether or not playing age-restricted content and disabling safe search in
243
+ * non-NSFW channel
244
+ * @default false
245
+ */
246
+ nsfw?: boolean;
247
+ /**
248
+ * Whether or not emitting `addSong` event when creating a new Queue
249
+ * @default true
250
+ */
251
+ emitAddSongWhenCreatingQueue?: boolean;
252
+ /**
253
+ * Whether or not emitting `addList` event when creating a new Queue
254
+ * @default true
255
+ */
256
+ emitAddListWhenCreatingQueue?: boolean;
257
+ /**
258
+ * Whether or not joining the new voice channel when using {@link DisTube#play}
259
+ * method
260
+ * @default true
261
+ */
262
+ joinNewVoiceChannel?: boolean;
263
+ /**
264
+ * Behavior when the {@link Events.ERROR} event is emitted but nobody listens to it.
265
+ *
266
+ * By default (`"log"`), the error is logged to the console instead of crashing the
267
+ * process, which is the Node.js default behavior for the special `"error"` event.
268
+ * @default "log"
269
+ */
270
+ unhandledError?: UnhandledErrorBehavior;
271
+ /**
272
+ * Time (in milliseconds) a track may stay in the "buffering" state before it is
273
+ * considered stuck and gets skipped automatically.
274
+ *
275
+ * Set to `0` to disable the stuck-track detection.
276
+ * @default 10000
277
+ */
278
+ stuckThreshold?: number;
279
+ /**
280
+ * FFmpeg options
281
+ */
282
+ ffmpeg?: {
283
+ /**
284
+ * FFmpeg path
285
+ */
286
+ path?: string;
287
+ /**
288
+ * FFmpeg default arguments
289
+ */
290
+ args?: Partial<FFmpegArgs>;
291
+ };
292
+ };
293
+ /**
294
+ * Data that can be resolved to give a guild id string. This can be:
295
+ * - A guild id string | a guild {@link https://discord.js.org/#/docs/main/stable/class/Snowflake|Snowflake}
296
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/Guild | Guild}
297
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/Message | Message}
298
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/BaseGuildVoiceChannel
299
+ * | BaseGuildVoiceChannel}
300
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/BaseGuildTextChannel
301
+ * | BaseGuildTextChannel}
302
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/VoiceState |
303
+ * VoiceState}
304
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/GuildMember |
305
+ * GuildMember}
306
+ * - A {@link https://discord.js.org/#/docs/main/stable/class/Interaction |
307
+ * Interaction}
308
+ * - A {@link DisTubeVoice}
309
+ * - A {@link Queue}
310
+ */
311
+ type GuildIdResolvable = Queue | DisTubeVoice | Snowflake | Message | GuildTextBasedChannel | VoiceBasedChannel | VoiceState | Guild | GuildMember | Interaction | string;
312
+ /**
313
+ * The raw information of a song.
314
+ *
315
+ * It is the input of the {@link Song} constructor: a plugin builds it from
316
+ * the data of its source.
317
+ */
318
+ interface SongInfo<T = unknown> {
319
+ /**
320
+ * The plugin that created this song, or `null` when it was created manually.
321
+ */
322
+ plugin: DisTubePlugin | null;
323
+ /**
324
+ * The identifier of the source of the song, e.g. `youtube`.
325
+ */
326
+ source: string;
327
+ /**
328
+ * Whether the song can be streamed directly from its source.
329
+ *
330
+ * When it is `false`, DisTube looks for a playable version of the song with
331
+ * the other plugins.
332
+ */
333
+ playFromSource: boolean;
334
+ /**
335
+ * The identifier of the song in its source.
336
+ */
337
+ id: string;
338
+ /**
339
+ * The name of the song.
340
+ */
341
+ name?: string;
342
+ /**
343
+ * Whether the song is a live stream.
344
+ */
345
+ isLive?: boolean;
346
+ /**
347
+ * The duration of the song, in seconds.
348
+ */
349
+ duration?: number;
350
+ /**
351
+ * The URL of the song.
352
+ */
353
+ url?: string;
354
+ /**
355
+ * The URL of the thumbnail of the song.
356
+ */
357
+ thumbnail?: string;
358
+ /**
359
+ * The number of views of the song.
360
+ */
361
+ views?: number;
362
+ /**
363
+ * The number of likes of the song.
364
+ */
365
+ likes?: number;
366
+ /**
367
+ * The number of dislikes of the song.
368
+ */
369
+ dislikes?: number;
370
+ /**
371
+ * The number of reposts (shares) of the song.
372
+ */
373
+ reposts?: number;
374
+ /**
375
+ * The uploader (the author, the channel, ...) of the song.
376
+ */
377
+ uploader?: {
378
+ /**
379
+ * The name of the uploader.
380
+ */
381
+ name?: string;
382
+ /**
383
+ * The URL of the uploader.
384
+ */
385
+ url?: string;
386
+ };
387
+ /**
388
+ * Whether the song is age-restricted.
389
+ */
390
+ ageRestricted?: boolean;
391
+ /**
392
+ * Source specific metadata of the song.
393
+ *
394
+ * It is used by the plugin that created the song to keep the data it needs to
395
+ * play it (stream url, identifiers, ...). It is ignored when the song is
396
+ * created with a `metadata` option.
397
+ */
398
+ metadata?: T;
399
+ }
400
+ /**
401
+ * The raw information of a playlist.
402
+ *
403
+ * It is the input of the {@link Playlist} constructor: a plugin builds it from
404
+ * the data of its source.
405
+ */
406
+ interface PlaylistInfo {
407
+ /**
408
+ * The identifier of the source of the playlist, e.g. `youtube`.
409
+ */
410
+ source: string;
411
+ /**
412
+ * The songs of the playlist.
413
+ */
414
+ songs: Song[];
415
+ /**
416
+ * The identifier of the playlist in its source.
417
+ */
418
+ id?: string;
419
+ /**
420
+ * The name of the playlist.
421
+ */
422
+ name?: string;
423
+ /**
424
+ * The URL of the playlist.
425
+ */
426
+ url?: string;
427
+ /**
428
+ * The URL of the thumbnail of the playlist.
429
+ */
430
+ thumbnail?: string;
431
+ }
432
+ /**
433
+ * A song that is related to another song.
434
+ *
435
+ * It is the same as a {@link Song}, without the `related` property of the
436
+ * previous versions of DisTube.
437
+ */
438
+ type RelatedSong = Omit<Song, "related">;
439
+ /**
440
+ * The options of the handler of a song or a playlist.
441
+ */
442
+ type PlayHandlerOptions = {
443
+ /**
444
+ * [Default: false] Skip the playing song (if exists) and play the added playlist
445
+ * instantly
446
+ */
447
+ skip?: boolean;
448
+ /**
449
+ * [Default: 0] Position of the song/playlist to add to the queue, \<= 0 to add to
450
+ * the end of the queue
451
+ */
452
+ position?: number;
453
+ /**
454
+ * The default text channel of the queue
455
+ */
456
+ textChannel?: GuildTextBasedChannel;
457
+ };
458
+ /**
459
+ * The options of a jump in the queue.
460
+ */
461
+ interface JumpOptions {
462
+ /**
463
+ * [Default: false] Whether or not skipped song(s) will be added to the end of the
464
+ * queue
465
+ */
466
+ requeue?: boolean;
467
+ }
468
+ /**
469
+ * The options of {@link DisTube#play}.
470
+ */
471
+ interface PlayOptions<T = unknown> extends PlayHandlerOptions, ResolveOptions<T> {
472
+ /**
473
+ * The message that triggered the command.
474
+ *
475
+ * It is used as the default {@link PlayHandlerOptions.textChannel} of the queue
476
+ * when no `textChannel` is provided.
477
+ */
478
+ message?: Message;
479
+ }
480
+ /**
481
+ * The kind of result a search is looking for.
482
+ */
483
+ declare enum SearchResultType {
484
+ /**
485
+ * A single track, i.e. a song.
486
+ */
487
+ TRACK = "track",
488
+ /**
489
+ * A video, i.e. a song with a video.
490
+ */
491
+ VIDEO = "video",
492
+ /**
493
+ * A playlist of songs.
494
+ */
495
+ PLAYLIST = "playlist",
496
+ /**
497
+ * An album of songs.
498
+ */
499
+ ALBUM = "album",
500
+ /**
501
+ * The songs of an artist.
502
+ */
503
+ ARTIST = "artist"
504
+ }
505
+ /**
506
+ * The options of the resolution of a song or a playlist.
507
+ */
508
+ interface ResolveOptions<T = unknown> {
509
+ /**
510
+ * Requested user
511
+ */
512
+ member?: GuildMember;
513
+ /**
514
+ * Metadata
515
+ */
516
+ metadata?: T;
517
+ /**
518
+ * The source to resolve the input in.
519
+ *
520
+ * It matches the {@link Plugin.source} of a plugin, or one of its
521
+ * {@link Plugin.aliases}. When it is not given, every plugin is used.
522
+ */
523
+ source?: string;
524
+ }
525
+ /**
526
+ * Options of a search.
527
+ */
528
+ interface SearchOptions<T = unknown> extends ResolveOptions<T> {
529
+ /**
530
+ * [Default: 10] Maximum number of results.
531
+ */
532
+ limit?: number;
533
+ /**
534
+ * The kind of result the caller is looking for.
535
+ */
536
+ type?: SearchResultType;
537
+ /**
538
+ * Whether or not filtering the explicit content.
539
+ */
540
+ safeSearch?: boolean;
541
+ }
542
+ /**
543
+ * The options of the resolution of a playlist.
544
+ */
545
+ interface ResolvePlaylistOptions<T = unknown> extends ResolveOptions<T> {
546
+ /**
547
+ * Source of the playlist
548
+ */
549
+ source?: string;
550
+ }
551
+ /**
552
+ * The options of a custom playlist.
553
+ */
554
+ interface CustomPlaylistOptions {
555
+ /**
556
+ * A guild member creating the playlist
557
+ */
558
+ member?: GuildMember;
559
+ /**
560
+ * Whether or not fetch the songs in parallel
561
+ */
562
+ parallel?: boolean;
563
+ /**
564
+ * Metadata
565
+ */
566
+ metadata?: any;
567
+ /**
568
+ * Playlist name
569
+ */
570
+ name?: string;
571
+ /**
572
+ * Playlist source
573
+ */
574
+ source?: string;
575
+ /**
576
+ * Playlist url
577
+ */
578
+ url?: string;
579
+ /**
580
+ * Playlist thumbnail
581
+ */
582
+ thumbnail?: string;
583
+ }
584
+ /**
585
+ * The repeat mode of a {@link Queue}
586
+ */
587
+ declare enum RepeatMode {
588
+ /**
589
+ * The queue plays every song once. `0`.
590
+ */
591
+ DISABLED = 0,
592
+ /**
593
+ * The queue repeats the current song. `1`.
594
+ */
595
+ SONG = 1,
596
+ /**
597
+ * The queue repeats the whole queue. `2`.
598
+ */
599
+ QUEUE = 2
600
+ }
601
+ /**
602
+ * All available plugin types:
603
+ */
604
+ declare enum PluginType {
605
+ /**
606
+ * A plugin that extracts, searches and plays the songs of its source.
607
+ * `"extractor"`: {@link ExtractorPlugin}
608
+ */
609
+ EXTRACTOR = "extractor",
610
+ /**
611
+ * A plugin that only extracts the info of the links of its source.
612
+ * `"info-extractor"`: {@link InfoExtractorPlugin}
613
+ */
614
+ INFO_EXTRACTOR = "info-extractor",
615
+ /**
616
+ * A plugin that extracts and plays the songs of its source, but cannot
617
+ * search for them. `"playable-extractor"`: {@link PlayableExtractorPlugin}
618
+ */
619
+ PLAYABLE_EXTRACTOR = "playable-extractor"
620
+ }
621
+ /**
622
+ * Every kind of plugin DisTube can use.
623
+ *
624
+ * - {@link ExtractorPlugin}
625
+ * - {@link InfoExtractorPlugin}
626
+ * - {@link PlayableExtractorPlugin}
627
+ */
628
+ type DisTubePlugin = ExtractorPlugin | InfoExtractorPlugin | PlayableExtractorPlugin;
629
+ /**
630
+ * A FFmpeg argument.
631
+ *
632
+ * The value is the argument itself (`"-1"`), or an array of the values of a
633
+ * repeatable argument (`["-1", "-2"]`).
634
+ */
635
+ type FFmpegArg = Record<string, string | number | boolean | Array<string | null | undefined> | null | undefined>;
636
+ /**
637
+ * FFmpeg arguments for different use cases
638
+ */
639
+ type FFmpegArgs = {
640
+ /**
641
+ * The arguments that are applied to the FFmpeg process itself.
642
+ */
643
+ global: FFmpegArg;
644
+ /**
645
+ * The arguments that are applied to the input of the FFmpeg process.
646
+ */
647
+ input: FFmpegArg;
648
+ /**
649
+ * The arguments that are applied to the output of the FFmpeg process.
650
+ *
651
+ * The `af` argument is replaced by the filters of the {@link Queue}.
652
+ */
653
+ output: FFmpegArg;
654
+ };
655
+ /**
656
+ * FFmpeg options
657
+ */
658
+ type FFmpegOptions = {
659
+ /**
660
+ * Path to the ffmpeg executable
661
+ * @default "ffmpeg"
662
+ */
663
+ path: string;
664
+ /**
665
+ * Arguments
666
+ */
667
+ args: FFmpegArgs;
668
+ };
669
+
670
+ /**
671
+ * The version of DisTube.
672
+ *
673
+ * The placeholder is replaced by the real version at build time.
674
+ */
675
+ declare const version: string;
676
+ /**
677
+ * The sample rate of the audio, in Hz.
678
+ */
679
+ declare const AUDIO_SAMPLE_RATE = 48000;
680
+ /**
681
+ * The number of channels of the audio.
682
+ */
683
+ declare const AUDIO_CHANNELS = 2;
684
+ /**
685
+ * Default volume percentage (0-100)
686
+ */
687
+ declare const DEFAULT_VOLUME = 50;
688
+ /**
689
+ * The timeout to join a voice channel, in milliseconds.
690
+ */
691
+ declare const JOIN_TIMEOUT_MS = 30000;
692
+ /**
693
+ * The delay between two reconnection attempts, in milliseconds.
694
+ */
695
+ declare const RECONNECT_TIMEOUT_MS = 5000;
696
+ /**
697
+ * The maximum number of reconnection attempts before giving up.
698
+ */
699
+ declare const RECONNECT_MAX_ATTEMPTS = 5;
700
+ /**
701
+ * Default time (in milliseconds) a track may stay in the "buffering" state
702
+ * before it is considered stuck and gets skipped.
703
+ */
704
+ declare const STUCK_THRESHOLD_MS = 10000;
705
+ /**
706
+ * The HTTP status codes that are followed as a redirection.
707
+ */
708
+ declare const HTTP_REDIRECT_CODES: Set<number>;
709
+ /**
710
+ * The maximum number of redirections that are followed before giving up.
711
+ */
712
+ declare const MAX_REDIRECT_DEPTH = 5;
713
+ /**
714
+ * Default DisTube audio filters.
715
+ */
716
+ declare const defaultFilters: Filters;
717
+ /**
718
+ * The default options of a {@link DisTube} instance.
719
+ *
720
+ * They are overridden by the options given to the constructor of
721
+ * {@link DisTube}.
722
+ */
723
+ declare const defaultOptions: {
724
+ plugins: never[];
725
+ emitNewSongOnly: false;
726
+ savePreviousSongs: true;
727
+ nsfw: false;
728
+ emitAddSongWhenCreatingQueue: true;
729
+ emitAddListWhenCreatingQueue: true;
730
+ joinNewVoiceChannel: true;
731
+ unhandledError: "log";
732
+ stuckThreshold: number;
733
+ };
734
+
735
+ /**
736
+ * Class representing a song.
737
+ */
738
+ declare class Song<T = unknown> {
739
+ #private;
740
+ /**
741
+ * The source of this song info
742
+ */
743
+ source: string;
744
+ /**
745
+ * Song ID.
746
+ */
747
+ id: string;
748
+ /**
749
+ * Song name.
750
+ */
751
+ name?: string;
752
+ /**
753
+ * Indicates if the song is an active live.
754
+ */
755
+ isLive?: boolean;
756
+ /**
757
+ * Song duration.
758
+ */
759
+ duration: number;
760
+ /**
761
+ * Formatted duration string (`hh:mm:ss`, `mm:ss` or `Live`).
762
+ */
763
+ formattedDuration: string;
764
+ /**
765
+ * Song URL.
766
+ */
767
+ url?: string;
768
+ /**
769
+ * Song thumbnail.
770
+ */
771
+ thumbnail?: string;
772
+ /**
773
+ * Song view count
774
+ */
775
+ views?: number;
776
+ /**
777
+ * Song like count
778
+ */
779
+ likes?: number;
780
+ /**
781
+ * Song dislike count
782
+ */
783
+ dislikes?: number;
784
+ /**
785
+ * Song repost (share) count
786
+ */
787
+ reposts?: number;
788
+ /**
789
+ * Song uploader
790
+ */
791
+ uploader: {
792
+ /**
793
+ * The name of the uploader.
794
+ */
795
+ name?: string;
796
+ /**
797
+ * The URL of the uploader.
798
+ */
799
+ url?: string;
800
+ };
801
+ /**
802
+ * Whether or not an age-restricted content
803
+ */
804
+ ageRestricted?: boolean;
805
+ /**
806
+ * Stream info
807
+ */
808
+ stream: {
809
+ /**
810
+ * The stream of this song will be played from source
811
+ */
812
+ playFromSource: true;
813
+ /**
814
+ * Stream URL of this song
815
+ */
816
+ url?: string;
817
+ } | {
818
+ /**
819
+ * The stream of this song will be played from another song
820
+ */
821
+ playFromSource: false;
822
+ /**
823
+ * The song that this song will be played from
824
+ */
825
+ song?: Song<T>;
826
+ };
827
+ /**
828
+ * The plugin that created this song
829
+ */
830
+ plugin: DisTubePlugin | null;
831
+ /**
832
+ * Create a Song
833
+ *
834
+ * @param info - Raw song info
835
+ * @param options - Optional data
836
+ * @param options.member - The user that requested the song
837
+ * @param options.metadata - The metadata of the song
838
+ */
839
+ constructor(info: SongInfo<T>, { member, metadata }?: ResolveOptions<T>);
840
+ /**
841
+ * The playlist this song belongs to
842
+ */
843
+ get playlist(): Playlist | undefined;
844
+ /**
845
+ * Set the playlist this song belongs to.
846
+ * @param playlist - The playlist
847
+ * @throws {@link DisTubeError} When the value is not a {@link Playlist}
848
+ */
849
+ set playlist(playlist: Playlist | undefined);
850
+ /**
851
+ * User requested to play this song.
852
+ */
853
+ get member(): GuildMember | undefined;
854
+ /**
855
+ * Set the user that requested this song.
856
+ *
857
+ * The value is ignored when it is not a valid guild member.
858
+ * @param member - The member
859
+ */
860
+ set member(member: GuildMember | undefined);
861
+ /**
862
+ * User requested to play this song.
863
+ */
864
+ get user(): discord_js.User | undefined;
865
+ /**
866
+ * Optional metadata that can be used to identify the song. This is attached by the
867
+ * {@link DisTube#play} method.
868
+ */
869
+ get metadata(): T;
870
+ /**
871
+ * Set the metadata of the song.
872
+ * @param metadata - The metadata
873
+ */
874
+ set metadata(metadata: T);
875
+ /**
876
+ * The name of the song, or its url, or its id.
877
+ * @returns The string representation of the song
878
+ */
879
+ toString(): string;
880
+ }
881
+
882
+ /**
883
+ * Class representing a playlist.
884
+ */
885
+ declare class Playlist<T = unknown> implements PlaylistInfo {
886
+ #private;
887
+ /**
888
+ * Playlist source.
889
+ */
890
+ source: string;
891
+ /**
892
+ * Songs in the playlist.
893
+ */
894
+ songs: Song[];
895
+ /**
896
+ * Playlist ID.
897
+ */
898
+ id?: string;
899
+ /**
900
+ * Playlist name.
901
+ */
902
+ name?: string;
903
+ /**
904
+ * Playlist URL.
905
+ */
906
+ url?: string;
907
+ /**
908
+ * Playlist thumbnail.
909
+ */
910
+ thumbnail?: string;
911
+ /**
912
+ * Create a Playlist
913
+ * @param playlist - Raw playlist info
914
+ * @param options - Optional data
915
+ * @param options.member - The user that requested the playlist
916
+ * @param options.metadata - The metadata of the playlist
917
+ * @throws {@link DisTubeError} When the playlist does not have any song
918
+ */
919
+ constructor(playlist: PlaylistInfo, { member, metadata }?: ResolveOptions<T>);
920
+ /**
921
+ * Playlist duration in second.
922
+ */
923
+ get duration(): number;
924
+ /**
925
+ * Formatted duration string `hh:mm:ss`.
926
+ */
927
+ get formattedDuration(): string;
928
+ /**
929
+ * User requested.
930
+ */
931
+ get member(): GuildMember | undefined;
932
+ /**
933
+ * Set the user that requested the playlist.
934
+ *
935
+ * The value is ignored when it is not a valid guild member.
936
+ * @param member - The member
937
+ */
938
+ set member(member: GuildMember | undefined);
939
+ /**
940
+ * User requested.
941
+ */
942
+ get user(): discord_js.User | undefined;
943
+ /**
944
+ * Optional metadata that can be used to identify the playlist.
945
+ */
946
+ get metadata(): T;
947
+ /**
948
+ * Set the metadata of the playlist.
949
+ *
950
+ * The metadata of the songs is not changed when the metadata is `undefined`.
951
+ * @param metadata - The metadata
952
+ */
953
+ set metadata(metadata: T);
954
+ /**
955
+ * The name of the playlist and the number of its songs.
956
+ * @returns The string representation of the playlist
957
+ */
958
+ toString(): string;
959
+ }
960
+
961
+ /**
962
+ * DisTube's Handler
963
+ */
964
+ declare class DisTubeHandler extends DisTubeBase {
965
+ #private;
966
+ /**
967
+ * Resolve a {@link Song} to a {@link Song}.
968
+ * @param song - The song to resolve
969
+ * @param options - Optional options
970
+ * @returns The resolved song
971
+ */
972
+ resolve<T = unknown>(song: Song<T>, options?: Omit<ResolveOptions, "metadata">): Promise<Song<T>>;
973
+ /**
974
+ * Resolve a {@link Playlist} to a {@link Playlist}.
975
+ * @param song - The playlist to resolve
976
+ * @param options - Optional options
977
+ * @returns The resolved playlist
978
+ */
979
+ resolve<T = unknown>(song: Playlist<T>, options?: Omit<ResolveOptions, "metadata">): Promise<Playlist<T>>;
980
+ /**
981
+ * Resolve a url or a search query to a {@link Song} or a {@link Playlist}.
982
+ * @param song - The url or the search query to resolve
983
+ * @param options - Optional options
984
+ * @returns The resolved song or playlist
985
+ */
986
+ resolve<T = unknown>(song: string, options?: ResolveOptions<T>): Promise<Song<T> | Playlist<T>>;
987
+ /**
988
+ * Resolve a {@link Song} to a {@link Song}.
989
+ * @param song - The song to resolve
990
+ * @param options - Optional options
991
+ * @returns The resolved song
992
+ */
993
+ resolve<T = unknown>(song: Song, options: ResolveOptions<T>): Promise<Song<T>>;
994
+ /**
995
+ * Resolve a {@link Playlist} to a {@link Playlist}.
996
+ * @param song - The playlist to resolve
997
+ * @param options - Optional options
998
+ * @returns The resolved playlist
999
+ */
1000
+ resolve<T = unknown>(song: Playlist, options: ResolveOptions<T>): Promise<Playlist<T>>;
1001
+ /**
1002
+ * Resolve a url or a supported object to a {@link Song} or {@link Playlist}
1003
+ * @throws {@link DisTubeError}
1004
+ * @param song - Resolvable input
1005
+ * @param options - Optional options
1006
+ * @returns Resolved
1007
+ * @example
1008
+ * ```ts
1009
+ * const song = await distube.handler.resolve("Never gonna give you up");
1010
+ * ```
1011
+ */
1012
+ resolve(song: string | Song | Playlist, options?: ResolveOptions): Promise<Song | Playlist>;
1013
+ /**
1014
+ * Find the plugin that supports the given url.
1015
+ * @param url - The url to check
1016
+ * @returns The plugin, or `null` when there is none
1017
+ */
1018
+ _getPluginFromURL(url: string): Promise<DisTubePlugin | null>;
1019
+ /**
1020
+ * Find the plugin that can handle the given song.
1021
+ * @param song - The song
1022
+ * @returns The plugin, or `null` when there is none
1023
+ */
1024
+ _getPluginFromSong(song: Song): Promise<DisTubePlugin | null>;
1025
+ /**
1026
+ * Find the plugin of the given type that can handle the given song.
1027
+ * @param song - The song
1028
+ * @param types - The types of the plugin to look for
1029
+ * @param validate - Whether the url of the song has to be validated
1030
+ * @returns The plugin, or `null` when there is none
1031
+ */
1032
+ _getPluginFromSong<T extends PluginType>(song: Song, types: T[], validate?: boolean): Promise<(DisTubePlugin & {
1033
+ type: T;
1034
+ }) | null>;
1035
+ /**
1036
+ * Get {@link Song}'s stream info and attach it to the song.
1037
+ * @param song - A Song
1038
+ * @returns A promise that resolves when the stream info is attached
1039
+ * @throws {@link DisTubeError} When no plugin supports the song, or when its
1040
+ * stream URL cannot be found
1041
+ */
1042
+ attachStreamInfo(song: Song): Promise<void>;
1043
+ /**
1044
+ * Follow the redirections of an url.
1045
+ * @param url - The url to follow
1046
+ * @param maxRedirect - The maximum number of redirections to follow
1047
+ * @returns The final url
1048
+ */
1049
+ followRedirectLink(url: string, maxRedirect?: number): Promise<string>;
1050
+ }
1051
+
1052
+ /**
1053
+ * The validated options of a {@link DisTube} instance.
1054
+ *
1055
+ * Every option has a default value, and every option is validated when the
1056
+ * instance is created.
1057
+ */
1058
+ declare class Options {
1059
+ #private;
1060
+ /**
1061
+ * The plugins of the DisTube instance.
1062
+ */
1063
+ plugins: DisTubePlugin[];
1064
+ /**
1065
+ * Whether or not the {@link Events.PLAY_SONG} event is emitted when looping a
1066
+ * song or when the next song is the same as the previous one.
1067
+ * @default false
1068
+ */
1069
+ emitNewSongOnly: boolean;
1070
+ /**
1071
+ * Whether or not the previous songs of a {@link Queue} are saved.
1072
+ * @default true
1073
+ */
1074
+ savePreviousSongs: boolean;
1075
+ /**
1076
+ * The custom FFmpeg audio filters, that override the {@link defaultFilters}.
1077
+ */
1078
+ customFilters?: Filters;
1079
+ /**
1080
+ * Whether or not age-restricted content can be played in a non-NSFW channel.
1081
+ * @default false
1082
+ */
1083
+ nsfw: boolean;
1084
+ /**
1085
+ * Whether or not the {@link Events.ADD_SONG} event is emitted when a new
1086
+ * {@link Queue} is created.
1087
+ * @default true
1088
+ */
1089
+ emitAddSongWhenCreatingQueue: boolean;
1090
+ /**
1091
+ * Whether or not the {@link Events.ADD_LIST} event is emitted when a new
1092
+ * {@link Queue} is created.
1093
+ * @default true
1094
+ */
1095
+ emitAddListWhenCreatingQueue: boolean;
1096
+ /**
1097
+ * Whether or not the bot joins the new voice channel when
1098
+ * {@link DisTube#play} is used.
1099
+ * @default true
1100
+ */
1101
+ joinNewVoiceChannel: boolean;
1102
+ /**
1103
+ * The behavior of the {@link Events.ERROR} event when it has no listener.
1104
+ * @default "log"
1105
+ */
1106
+ unhandledError: UnhandledErrorBehavior;
1107
+ /**
1108
+ * The time (in milliseconds) a track may stay in the "buffering" state before
1109
+ * it is considered stuck and gets skipped.
1110
+ *
1111
+ * Set to `0` to disable the stuck-track detection.
1112
+ * @default 10000
1113
+ */
1114
+ stuckThreshold: number;
1115
+ /**
1116
+ * The FFmpeg options of the DisTube instance.
1117
+ */
1118
+ ffmpeg: FFmpegOptions;
1119
+ /**
1120
+ * Create the options of a {@link DisTube} instance.
1121
+ * @param options - The options given by the user
1122
+ * @throws {@link DisTubeError} When an option has an invalid type, or when it
1123
+ * is not a known option
1124
+ */
1125
+ constructor(options: DisTubeOptions);
1126
+ }
1127
+
1128
+ /**
1129
+ * Options for {@link DisTubeStream}
1130
+ */
1131
+ interface StreamOptions {
1132
+ /**
1133
+ * FFmpeg options
1134
+ */
1135
+ ffmpeg: FFmpegOptions;
1136
+ /**
1137
+ * Seek time (in seconds).
1138
+ * @default 0
1139
+ */
1140
+ seek?: number;
1141
+ }
1142
+ /**
1143
+ * Check that FFmpeg is installed and can be spawned.
1144
+ *
1145
+ * The check is only done once: the result is cached.
1146
+ * @param distube - The DisTube instance
1147
+ * @returns Nothing
1148
+ * @throws {@link DisTubeError} When FFmpeg cannot be spawned
1149
+ */
1150
+ declare const checkFFmpeg: (distube: DisTube) => void;
1151
+ /**
1152
+ * Create a stream to play with {@link DisTubeVoice}
1153
+ */
1154
+ declare class DisTubeStream extends TypedEmitter<{
1155
+ debug: (debug: string) => Awaitable;
1156
+ error: (error: Error) => Awaitable;
1157
+ }> {
1158
+ #private;
1159
+ /**
1160
+ * The FFmpeg process that decodes the audio.
1161
+ *
1162
+ * It is `undefined` until {@link DisTubeStream#spawn} is called.
1163
+ */
1164
+ process?: ChildProcess;
1165
+ /**
1166
+ * The stream of the decoded audio, with the volume applied to it.
1167
+ */
1168
+ stream: VolumeTransformer;
1169
+ /**
1170
+ * The Discord.js audio resource that is played by the audio player.
1171
+ */
1172
+ audioResource: AudioResource;
1173
+ /**
1174
+ * The seek time in seconds that this stream started from
1175
+ */
1176
+ readonly seekTime: number;
1177
+ /**
1178
+ * Create a DisTubeStream to play with {@link DisTubeVoice}
1179
+ * @param url - Stream URL
1180
+ * @param options - Stream options
1181
+ */
1182
+ constructor(url: string, options: StreamOptions);
1183
+ /**
1184
+ * Spawn the FFmpeg process that decodes the audio.
1185
+ * @returns Nothing
1186
+ * @throws {Error} When the FFmpeg process cannot be created
1187
+ */
1188
+ spawn(): void;
1189
+ private debug;
1190
+ /**
1191
+ * Set the volume of the stream.
1192
+ * @param volume - The volume of the stream, between `0` and `1`
1193
+ * @returns Nothing
1194
+ */
1195
+ setVolume(volume: number): void;
1196
+ /**
1197
+ * Kill the FFmpeg process and destroy the stream.
1198
+ * @returns Nothing
1199
+ */
1200
+ kill(): void;
1201
+ }
1202
+ declare class VolumeTransformer extends Transform {
1203
+ private buffer;
1204
+ private readonly extrema;
1205
+ vol: number;
1206
+ _transform(newChunk: Buffer, _encoding: BufferEncoding, done: TransformCallback): void;
1207
+ }
1208
+
1209
+ /**
1210
+ * Create a voice connection to the voice channel
1211
+ */
1212
+ declare class DisTubeVoice extends TypedEmitter<DisTubeVoiceEvents> {
1213
+ #private;
1214
+ /**
1215
+ * The id of the guild of this voice connection.
1216
+ */
1217
+ readonly id: Snowflake;
1218
+ /**
1219
+ * The voice manager that instantiated this connection.
1220
+ */
1221
+ readonly voices: DisTubeVoiceManager;
1222
+ /**
1223
+ * The audio player that plays the audio of this connection.
1224
+ */
1225
+ readonly audioPlayer: AudioPlayer;
1226
+ /**
1227
+ * The Discord.js voice connection.
1228
+ */
1229
+ connection: VoiceConnection;
1230
+ /**
1231
+ * Whether or not an error was already emitted for the current stream.
1232
+ *
1233
+ * It prevents the same error from being emitted several times.
1234
+ */
1235
+ emittedError: boolean;
1236
+ /**
1237
+ * Whether or not the voice connection has been disconnected.
1238
+ */
1239
+ isDisconnected: boolean;
1240
+ /**
1241
+ * The stream that is currently playing.
1242
+ */
1243
+ stream?: DisTubeStream;
1244
+ /**
1245
+ * The stream that was playing when the playback was paused.
1246
+ */
1247
+ pausingStream?: DisTubeStream;
1248
+ /**
1249
+ * Create a voice connection to the voice channel.
1250
+ * @param voiceManager - The voice manager of the DisTube instance
1251
+ * @param channel - The voice channel to join
1252
+ */
1253
+ constructor(voiceManager: DisTubeVoiceManager, channel: VoiceBasedChannel);
1254
+ /**
1255
+ * The voice channel id the bot is in
1256
+ */
1257
+ get channelId(): string | undefined;
1258
+ /**
1259
+ * The voice channel the bot is in.
1260
+ *
1261
+ * Setting it moves the bot to another voice channel.
1262
+ */
1263
+ get channel(): VoiceBasedChannel;
1264
+ /**
1265
+ * Move the bot to another voice channel.
1266
+ * @param channel - The voice channel to join
1267
+ * @throws {@link DisTubeError} When the channel is invalid, when it belongs to
1268
+ * another guild or client, or when the bot cannot join it
1269
+ */
1270
+ set channel(channel: VoiceBasedChannel);
1271
+ /**
1272
+ * Join a voice channel with this connection
1273
+ * @param channel - A voice channel
1274
+ * @returns The voice connection
1275
+ * @throws {@link DisTubeError} When the connection cannot be established
1276
+ */
1277
+ join(channel?: VoiceBasedChannel): Promise<DisTubeVoice>;
1278
+ /**
1279
+ * Leave the voice channel of this connection
1280
+ * @param error - Optional, an error to emit with 'error' event.
1281
+ * @returns Nothing
1282
+ */
1283
+ leave(error?: Error): void;
1284
+ /**
1285
+ * Stop the playing stream
1286
+ * @param force - If true, will force the {@link DisTubeVoice#audioPlayer} to enter the Idle state even
1287
+ * if the {@link DisTubeStream#audioResource} has silence padding frames.
1288
+ * @returns Nothing
1289
+ */
1290
+ stop(force?: boolean): void;
1291
+ /**
1292
+ * Play a {@link DisTubeStream}
1293
+ * @param dtStream - DisTubeStream
1294
+ * @returns A promise that resolves when the stream is playing
1295
+ * @throws {@link DisTubeError} When no encryption library is available
1296
+ */
1297
+ play(dtStream: DisTubeStream): Promise<void>;
1298
+ /**
1299
+ * Set the volume percentage of the stream.
1300
+ * @param volume - The volume percentage, from `0` to `100`
1301
+ * @throws {@link DisTubeError} When the volume is not a number, or when it is
1302
+ * negative
1303
+ */
1304
+ set volume(volume: number);
1305
+ /**
1306
+ * Get or set the volume percentage
1307
+ */
1308
+ get volume(): number;
1309
+ /**
1310
+ * Playback duration of the audio resource in seconds (time since playback started)
1311
+ */
1312
+ get playbackDuration(): number;
1313
+ /**
1314
+ * Current playback time in seconds, accounting for seek offset
1315
+ */
1316
+ get playbackTime(): number;
1317
+ /**
1318
+ * Pause the playback of the audio player.
1319
+ * @returns Nothing
1320
+ */
1321
+ pause(): void;
1322
+ /**
1323
+ * Resume the playback of the audio player.
1324
+ *
1325
+ * The FFmpeg process is spawned again when the stream was killed while the
1326
+ * playback was paused.
1327
+ * @returns Nothing
1328
+ */
1329
+ unpause(): void;
1330
+ /**
1331
+ * Emit an event of the voice connection.
1332
+ *
1333
+ * The special `"error"` event never crashes the process when there is no
1334
+ * listener for it, even when the voice connection is used outside of a
1335
+ * {@link Queue}.
1336
+ * @param event - The event name
1337
+ * @param args - The event arguments
1338
+ * @returns `true` when the event had listeners, `false` otherwise
1339
+ */
1340
+ emit<U extends keyof DisTubeVoiceEvents>(event: U, ...args: Parameters<DisTubeVoiceEvents[U]>): boolean;
1341
+ /**
1342
+ * Whether the bot is self-deafened
1343
+ */
1344
+ get selfDeaf(): boolean;
1345
+ /**
1346
+ * Whether the bot is self-muted
1347
+ */
1348
+ get selfMute(): boolean;
1349
+ /**
1350
+ * Self-deafens/undeafens the bot.
1351
+ * @param selfDeaf - Whether or not the bot should be self-deafened
1352
+ * @returns true if the voice state was successfully updated, otherwise false
1353
+ * @throws {@link DisTubeError} When the value is not a boolean
1354
+ */
1355
+ setSelfDeaf(selfDeaf: boolean): boolean;
1356
+ /**
1357
+ * Self-mutes/unmutes the bot.
1358
+ * @param selfMute - Whether or not the bot should be self-muted
1359
+ * @returns true if the voice state was successfully updated, otherwise false
1360
+ * @throws {@link DisTubeError} When the value is not a boolean
1361
+ */
1362
+ setSelfMute(selfMute: boolean): boolean;
1363
+ /**
1364
+ * The voice state of this connection
1365
+ */
1366
+ get voiceState(): VoiceState | undefined;
1367
+ }
1368
+
1369
+ /**
1370
+ * Manages the collection of a data model.
1371
+ */
1372
+ declare abstract class BaseManager<V> extends DisTubeBase {
1373
+ /**
1374
+ * The collection of items for this manager.
1375
+ */
1376
+ collection: Collection<string, V>;
1377
+ /**
1378
+ * The size of the collection.
1379
+ */
1380
+ get size(): number;
1381
+ }
1382
+
1383
+ /**
1384
+ * Manages the collection of a data model paired with a guild id.
1385
+ */
1386
+ declare abstract class GuildIdManager<V> extends BaseManager<V> {
1387
+ /**
1388
+ * Add an item to the collection.
1389
+ *
1390
+ * The item is not added when there is already one for the same guild.
1391
+ * @param idOrInstance - The guild id, or anything that can be resolved to a guild id
1392
+ * @param data - The item to add
1393
+ * @returns This manager, to allow chaining
1394
+ * @throws {@link DisTubeError} When the value cannot be resolved to a guild id
1395
+ */
1396
+ add(idOrInstance: GuildIdResolvable, data: V): this;
1397
+ /**
1398
+ * Get the item of a guild.
1399
+ * @param idOrInstance - The guild id, or anything that can be resolved to a guild id
1400
+ * @returns The item of the guild, or `undefined` when there is none
1401
+ * @throws {@link DisTubeError} When the value cannot be resolved to a guild id
1402
+ */
1403
+ get(idOrInstance: GuildIdResolvable): V | undefined;
1404
+ /**
1405
+ * Remove the item of a guild.
1406
+ * @param idOrInstance - The guild id, or anything that can be resolved to a guild id
1407
+ * @returns `true` when an item was removed, `false` otherwise
1408
+ * @throws {@link DisTubeError} When the value cannot be resolved to a guild id
1409
+ */
1410
+ remove(idOrInstance: GuildIdResolvable): boolean;
1411
+ /**
1412
+ * Check whether a guild has an item.
1413
+ * @param idOrInstance - The guild id, or anything that can be resolved to a guild id
1414
+ * @returns `true` when there is an item for the guild
1415
+ * @throws {@link DisTubeError} When the value cannot be resolved to a guild id
1416
+ */
1417
+ has(idOrInstance: GuildIdResolvable): boolean;
1418
+ }
1419
+
1420
+ /**
1421
+ * Manages voice connections
1422
+ */
1423
+ declare class DisTubeVoiceManager extends GuildIdManager<DisTubeVoice> {
1424
+ /**
1425
+ * Create a {@link DisTubeVoice} instance
1426
+ * @param channel - A voice channel to join
1427
+ * @returns The voice connection of the guild
1428
+ * @throws {@link DisTubeError} When the guild already has a voice connection
1429
+ * that is not managed by DisTube
1430
+ */
1431
+ create(channel: VoiceBasedChannel): DisTubeVoice;
1432
+ /**
1433
+ * Join a voice channel and wait until the connection is ready
1434
+ * @param channel - A voice channel to join
1435
+ * @returns The voice connection of the guild
1436
+ * @throws {@link DisTubeError} When the connection cannot be established
1437
+ */
1438
+ join(channel: VoiceBasedChannel): Promise<DisTubeVoice>;
1439
+ /**
1440
+ * Leave the connected voice channel in a guild
1441
+ * @param guild - Queue Resolvable
1442
+ * @returns Nothing
1443
+ */
1444
+ leave(guild: GuildIdResolvable): void;
1445
+ }
1446
+
1447
+ /**
1448
+ * Queue manager
1449
+ */
1450
+ declare class QueueManager extends GuildIdManager<Queue> {
1451
+ #private;
1452
+ /**
1453
+ * Create a {@link Queue}
1454
+ * @param channel - A voice channel
1455
+ * @param textChannel - Default text channel
1456
+ * @returns The created queue
1457
+ * @throws {@link DisTubeError} When the guild already has a queue, or when
1458
+ * the voice channel cannot be joined
1459
+ */
1460
+ create(channel: VoiceBasedChannel, textChannel?: GuildTextBasedChannel): Promise<Queue>;
1461
+ /**
1462
+ * Handle the queue when a Song finish
1463
+ * @param queue - queue
1464
+ * @returns A promise that resolves when the next song is playing
1465
+ */
1466
+ handleSongFinish(queue: Queue): Promise<void>;
1467
+ /**
1468
+ * Play a song on voice connection with queue properties
1469
+ * @param queue - The guild queue to play
1470
+ * @param emitPlaySong - Whether or not emit {@link Events.PLAY_SONG} event
1471
+ * @param options - Optional options
1472
+ * @param options.keepSongOnError - Whether the current song has to stay in the
1473
+ * queue when the stream cannot be started
1474
+ * @returns A promise that resolves when the song is playing
1475
+ * @throws {@link DisTubeError} When the song does not have any stream URL
1476
+ */
1477
+ playSong(queue: Queue, emitPlaySong?: boolean, options?: {
1478
+ keepSongOnError?: boolean;
1479
+ }): Promise<void>;
1480
+ }
1481
+
1482
+ /**
1483
+ * A request of the stream server.
1484
+ */
1485
+ interface StreamRequest {
1486
+ /**
1487
+ * The path after the source, e.g. `v/abc123`.
1488
+ */
1489
+ path: string;
1490
+ /**
1491
+ * The parsed query parameters.
1492
+ */
1493
+ query: URLSearchParams;
1494
+ /**
1495
+ * The byte offset the client asked for, or `0`.
1496
+ */
1497
+ offset: number;
1498
+ /**
1499
+ * Aborted when the client disconnects.
1500
+ */
1501
+ signal: AbortSignal;
1502
+ /**
1503
+ * The raw request.
1504
+ */
1505
+ request: IncomingMessage;
1506
+ }
1507
+ /**
1508
+ * The response of a stream handler.
1509
+ */
1510
+ interface StreamResponse {
1511
+ /**
1512
+ * The audio bytes.
1513
+ */
1514
+ body: Readable | AsyncIterable<Uint8Array>;
1515
+ /**
1516
+ * The content type. Default: `application/octet-stream`.
1517
+ */
1518
+ contentType?: string;
1519
+ /**
1520
+ * The status code. Default: `200`.
1521
+ */
1522
+ status?: number;
1523
+ /**
1524
+ * The total size of the stream, when it is known.
1525
+ *
1526
+ * It is required to answer the range requests.
1527
+ */
1528
+ size?: number;
1529
+ /**
1530
+ * Extra headers.
1531
+ */
1532
+ headers?: Record<string, string | number>;
1533
+ }
1534
+ /**
1535
+ * The handler of a source.
1536
+ */
1537
+ type StreamHandler = (req: StreamRequest) => Promise<StreamResponse | null | undefined> | StreamResponse | null | undefined;
1538
+ /**
1539
+ * A handle to release a resource.
1540
+ */
1541
+ interface Disposable {
1542
+ /**
1543
+ * Release the resource.
1544
+ * @returns Nothing
1545
+ */
1546
+ dispose(): void;
1547
+ }
1548
+ /**
1549
+ * Options of the stream server.
1550
+ */
1551
+ interface StreamServerOptions {
1552
+ /**
1553
+ * The port of the server. `0` (the default) lets the operating system pick a
1554
+ * free one, which is what a plugin should use: a fixed port makes the next
1555
+ * instance fail with `EADDRINUSE`.
1556
+ */
1557
+ port?: number;
1558
+ /**
1559
+ * The prefix of the URLs. A random one is generated by default, so the other
1560
+ * local processes cannot guess them.
1561
+ */
1562
+ prefix?: string;
1563
+ }
1564
+ /**
1565
+ * A local HTTP server that the plugins use to stream the audio.
1566
+ *
1567
+ * Every plugin that cannot hand out a static URL to FFmpeg needs an HTTP
1568
+ * server: a source that has to be decrypted, captured or negotiated cannot be
1569
+ * fetched by FFmpeg directly. Instead of every plugin running its own server,
1570
+ * they register a handler on this one.
1571
+ *
1572
+ * The server is started on the first registration and it is closed by
1573
+ * {@link DisTube#destroy}.
1574
+ */
1575
+ declare class StreamServer {
1576
+ #private;
1577
+ /**
1578
+ * Create a stream server.
1579
+ * @param options - Optional options
1580
+ */
1581
+ constructor({ port, prefix }?: StreamServerOptions);
1582
+ /**
1583
+ * The prefix of the URLs of the server.
1584
+ */
1585
+ get prefix(): string;
1586
+ /**
1587
+ * The base URL of the server, e.g. `http://127.0.0.1:51234`.
1588
+ *
1589
+ * @throws When the server is not started yet.
1590
+ */
1591
+ get baseUrl(): string;
1592
+ /**
1593
+ * Register a source.
1594
+ *
1595
+ * The handler is called for every request of that source. Return `null` to
1596
+ * answer a `404`.
1597
+ * @param source - The identifier of the source
1598
+ * @param handler - The handler of the source
1599
+ * @returns A handle to unregister the source
1600
+ * @example
1601
+ * ```ts
1602
+ * const disposable = distube.streams.register("my-source", async req => ({
1603
+ * body: Readable.from(Buffer.from("audio")),
1604
+ * contentType: "audio/mpeg",
1605
+ * }));
1606
+ * ```
1607
+ */
1608
+ register(source: string, handler: StreamHandler): Disposable;
1609
+ /**
1610
+ * Build the URL of a stream.
1611
+ *
1612
+ * The server is started when it is not running yet.
1613
+ * @param source - The identifier of the source
1614
+ * @param path - The path after the source
1615
+ * @param query - The query parameters
1616
+ * @returns The URL of the stream
1617
+ * @example
1618
+ * ```ts
1619
+ * const url = await distube.streams.url("my-source", "abc123", { token: "secret" });
1620
+ * ```
1621
+ */
1622
+ url(source: string, path?: string, query?: Record<string, string | number | boolean>): Promise<string>;
1623
+ /**
1624
+ * Close the server and release every handler.
1625
+ * @returns A promise that resolves when the server is closed
1626
+ */
1627
+ close(): Promise<void>;
1628
+ }
1629
+
1630
+ /**
1631
+ * The table of the error messages of DisTube.
1632
+ *
1633
+ * Every entry is the message of one error code. A message can be a template
1634
+ * that receives the arguments of the error.
1635
+ */
1636
+ declare const ERROR_MESSAGES: {
1637
+ /**
1638
+ * A value does not have the expected type.
1639
+ *
1640
+ * It is raised when an argument of a public method is not of the type that
1641
+ * the method expects, e.g. when a voice channel is not a voice channel.
1642
+ */
1643
+ INVALID_TYPE: (expected: (number | string) | readonly (number | string)[], got: any, name?: string) => string;
1644
+ /**
1645
+ * A number is not in the expected range.
1646
+ *
1647
+ * It is raised when a numeric argument is out of the range that the method
1648
+ * accepts, e.g. a negative volume.
1649
+ */
1650
+ NUMBER_COMPARE: (name: string, expected: string, value: number) => string;
1651
+ /**
1652
+ * An array is empty.
1653
+ *
1654
+ * It is raised when an argument that must hold at least one element is
1655
+ * empty, e.g. the songs of a custom playlist.
1656
+ */
1657
+ EMPTY_ARRAY: (name: string) => string;
1658
+ /**
1659
+ * An array does not have any valid element.
1660
+ *
1661
+ * It is raised when every element of an array was filtered out, e.g. when
1662
+ * all the songs of an array are invalid.
1663
+ */
1664
+ EMPTY_FILTERED_ARRAY: (name: string, type: string) => string;
1665
+ /**
1666
+ * A string is empty.
1667
+ *
1668
+ * It is raised when a string argument that must not be empty is empty.
1669
+ */
1670
+ EMPTY_STRING: (name: string) => string;
1671
+ /**
1672
+ * An object has a key that is not allowed.
1673
+ *
1674
+ * It is raised when an options object has a key that DisTube does not know,
1675
+ * e.g. `{ emitNewSong: true }` instead of `{ emitNewSongOnly: true }`.
1676
+ */
1677
+ INVALID_KEY: (obj: string, key: string) => string;
1678
+ /**
1679
+ * A required key is missing.
1680
+ *
1681
+ * It is raised when an object does not have a key that DisTube needs.
1682
+ */
1683
+ MISSING_KEY: (obj: string, key: string) => string;
1684
+ /**
1685
+ * Several required keys are missing.
1686
+ *
1687
+ * It is raised when an object does not have the keys that DisTube needs.
1688
+ */
1689
+ MISSING_KEYS: (obj: string, key: string[], all: boolean) => string;
1690
+ /**
1691
+ * The Discord.js client does not have the required intents.
1692
+ *
1693
+ * It is raised when the `GuildVoiceStates` intent is missing: DisTube
1694
+ * cannot work without it.
1695
+ */
1696
+ MISSING_INTENTS: (i: string) => string;
1697
+ /**
1698
+ * A DisTube option that is needed is disabled.
1699
+ *
1700
+ * It is raised when a feature cannot work because one of its options is
1701
+ * disabled, e.g. {@link Queue#previous} when
1702
+ * {@link DisTubeOptions.savePreviousSongs} is `false`.
1703
+ */
1704
+ DISABLED_OPTION: (o: string) => string;
1705
+ /**
1706
+ * A DisTube option that must be disabled is enabled.
1707
+ *
1708
+ * It is raised when a feature cannot work because one of its options is
1709
+ * enabled.
1710
+ */
1711
+ ENABLED_OPTION: (o: string) => string;
1712
+ /**
1713
+ * The user is not in any voice channel.
1714
+ *
1715
+ * It is raised when a command needs the voice channel of the user, but the
1716
+ * user is not connected to any voice channel.
1717
+ */
1718
+ NOT_IN_VOICE: string;
1719
+ /**
1720
+ * The voice channel is full.
1721
+ *
1722
+ * It is raised when the bot cannot join a voice channel because it is
1723
+ * full.
1724
+ */
1725
+ VOICE_FULL: string;
1726
+ /**
1727
+ * The guild already has a voice connection that DisTube does not manage.
1728
+ *
1729
+ * It is raised when DisTube cannot create a voice connection because
1730
+ * another one already exists in the guild.
1731
+ */
1732
+ VOICE_ALREADY_CREATED: string;
1733
+ /**
1734
+ * The voice connection could not be established in time.
1735
+ *
1736
+ * It is raised when the connection did not become ready before
1737
+ * {@link JOIN_TIMEOUT_MS}.
1738
+ */
1739
+ VOICE_CONNECT_FAILED: (s: number) => string;
1740
+ /**
1741
+ * The bot does not have the permission to join the voice channel.
1742
+ *
1743
+ * It is raised when the bot cannot join a voice channel because of a missing
1744
+ * permission.
1745
+ */
1746
+ VOICE_MISSING_PERMS: string;
1747
+ /**
1748
+ * The voice connection could not be restored.
1749
+ *
1750
+ * It is raised when every reconnection attempt of
1751
+ * {@link RECONNECT_MAX_ATTEMPTS} failed.
1752
+ */
1753
+ VOICE_RECONNECT_FAILED: string;
1754
+ /**
1755
+ * The voice channel belongs to another guild.
1756
+ *
1757
+ * It is raised when a voice connection is asked to join a voice channel of
1758
+ * another guild.
1759
+ */
1760
+ VOICE_DIFFERENT_GUILD: string;
1761
+ /**
1762
+ * The voice channel belongs to another client.
1763
+ *
1764
+ * It is raised when a voice connection is asked to join a voice channel
1765
+ * that was created by another Discord.js client.
1766
+ */
1767
+ VOICE_DIFFERENT_CLIENT: string;
1768
+ /**
1769
+ * The FFmpeg process exited with an unexpected code.
1770
+ *
1771
+ * It is raised when the FFmpeg process that decodes the audio exits with a
1772
+ * code that is neither `0` nor `255`.
1773
+ */
1774
+ FFMPEG_EXITED: (code: number) => string;
1775
+ /**
1776
+ * FFmpeg is not installed at the given path.
1777
+ *
1778
+ * It is raised when the FFmpeg executable cannot be spawned, e.g. when
1779
+ * {@link DisTubeOptions.ffmpeg} points to a path that does not exist.
1780
+ */
1781
+ FFMPEG_NOT_INSTALLED: (path: string) => string;
1782
+ /**
1783
+ * No encryption library is available.
1784
+ *
1785
+ * It is raised when Discord cannot decrypt the audio: neither the
1786
+ * `aes-256-gcm` cipher of Node.js nor one of the supported third-party
1787
+ * encryption libraries is available.
1788
+ */
1789
+ ENCRYPTION_LIBRARIES_MISSING: string;
1790
+ /**
1791
+ * The guild does not have a playing queue.
1792
+ *
1793
+ * It is raised when a queue operation is used in a guild that has no
1794
+ * {@link Queue}.
1795
+ */
1796
+ NO_QUEUE: string;
1797
+ /**
1798
+ * The guild already has a queue.
1799
+ *
1800
+ * It is raised when a {@link Queue} is created for a guild that already
1801
+ * has one.
1802
+ */
1803
+ QUEUE_EXIST: string;
1804
+ /**
1805
+ * The queue has been stopped already.
1806
+ *
1807
+ * It is raised when an operation needs a running queue, but the queue was
1808
+ * stopped.
1809
+ */
1810
+ QUEUE_STOPPED: string;
1811
+ /**
1812
+ * The queue is already paused.
1813
+ *
1814
+ * It is raised when {@link Queue#pause} is used on a paused queue.
1815
+ */
1816
+ PAUSED: string;
1817
+ /**
1818
+ * The queue is already playing.
1819
+ *
1820
+ * It is raised when {@link Queue#resume} is used on a queue that is not
1821
+ * paused.
1822
+ */
1823
+ RESUMED: string;
1824
+ /**
1825
+ * The queue does not have any previous song.
1826
+ *
1827
+ * It is raised when {@link Queue#previous} is used on a queue without any
1828
+ * history.
1829
+ */
1830
+ NO_PREVIOUS: string;
1831
+ /**
1832
+ * The queue does not have any up next song.
1833
+ *
1834
+ * It is raised when a jump goes past the end of the queue while the
1835
+ * autoplay mode is disabled.
1836
+ */
1837
+ NO_UP_NEXT: string;
1838
+ /**
1839
+ * The queue does not have any song at the given position.
1840
+ *
1841
+ * It is raised when {@link Queue#jump} is used with a position that is out
1842
+ * of the bounds of the queue.
1843
+ */
1844
+ NO_SONG_POSITION: string;
1845
+ /**
1846
+ * The queue does not have any playing song.
1847
+ *
1848
+ * It is raised when a related song is requested but the queue is empty.
1849
+ */
1850
+ NO_PLAYING_SONG: string;
1851
+ /**
1852
+ * The track is stuck and does not produce any audio.
1853
+ *
1854
+ * It is raised when a track stays in the "buffering" state for longer than
1855
+ * {@link DisTubeOptions.stuckThreshold} milliseconds. The queue skips it.
1856
+ */
1857
+ TRACK_STUCK: string;
1858
+ /**
1859
+ * There is no extractor plugin.
1860
+ *
1861
+ * It is raised when a search is requested but no {@link ExtractorPlugin} is
1862
+ * registered in {@link DisTubeOptions.plugins}.
1863
+ */
1864
+ NO_EXTRACTOR_PLUGIN: string;
1865
+ /**
1866
+ * No related song could be found.
1867
+ *
1868
+ * It is raised when the autoplay mode is enabled and no plugin could find
1869
+ * a related song for the current one.
1870
+ */
1871
+ NO_RELATED: string;
1872
+ /**
1873
+ * The related song cannot be played.
1874
+ *
1875
+ * It is raised when the related song of the autoplay mode cannot be
1876
+ * played.
1877
+ */
1878
+ CANNOT_PLAY_RELATED: string;
1879
+ /**
1880
+ * The video is unavailable.
1881
+ *
1882
+ * It is raised when the source of the song does not have the video anymore,
1883
+ * e.g. when it was removed or when it is private.
1884
+ */
1885
+ UNAVAILABLE_VIDEO: string;
1886
+ /**
1887
+ * No playable format was found.
1888
+ *
1889
+ * It is raised when the source of the song does not have any format that
1890
+ * FFmpeg can play.
1891
+ */
1892
+ UNPLAYABLE_FORMATS: string;
1893
+ /**
1894
+ * The content is age-restricted and cannot be played in this channel.
1895
+ *
1896
+ * It is raised when an age-restricted song is played in a non-NSFW channel
1897
+ * while {@link DisTubeOptions.nsfw} is `false`.
1898
+ */
1899
+ NON_NSFW: string;
1900
+ /**
1901
+ * The url is not supported.
1902
+ *
1903
+ * It is raised when no plugin of {@link DisTubeOptions.plugins} can handle
1904
+ * the url.
1905
+ */
1906
+ NOT_SUPPORTED_URL: string;
1907
+ /**
1908
+ * No plugin supports the song.
1909
+ *
1910
+ * It is raised when no plugin of {@link DisTubeOptions.plugins} can play
1911
+ * the song.
1912
+ */
1913
+ NOT_SUPPORTED_SONG: (song: string) => string;
1914
+ /**
1915
+ * The array does not have any valid song.
1916
+ *
1917
+ * It is raised when every element of the `songs` array of
1918
+ * {@link DisTube#createCustomPlaylist} is neither a {@link Song} nor a
1919
+ * valid url.
1920
+ */
1921
+ NO_VALID_SONG: string;
1922
+ /**
1923
+ * The input cannot be resolved to a song or a playlist.
1924
+ *
1925
+ * It is raised when the input of {@link DisTubeHandler#resolve} is neither
1926
+ * a url, nor a {@link Song}, nor a {@link Playlist}.
1927
+ */
1928
+ CANNOT_RESOLVE_SONG: (t: any) => string;
1929
+ /**
1930
+ * The stream url of the song cannot be found.
1931
+ *
1932
+ * It is raised when the plugin of the song does not return a stream url.
1933
+ */
1934
+ CANNOT_GET_STREAM_URL: (song: string) => string;
1935
+ /**
1936
+ * The search query of the song cannot be built.
1937
+ *
1938
+ * It is raised when the plugin of the song cannot build a query to look for
1939
+ * a playable version of it.
1940
+ */
1941
+ CANNOT_GET_SEARCH_QUERY: (song: string) => string;
1942
+ /**
1943
+ * No song was found for the query.
1944
+ *
1945
+ * It is raised when no plugin of {@link DisTubeOptions.plugins} has any
1946
+ * result for the search query.
1947
+ */
1948
+ NO_RESULT: (query: string) => string;
1949
+ /**
1950
+ * The song does not have any stream url.
1951
+ *
1952
+ * It is raised when a song is played while it does not have a stream url
1953
+ * attached to it.
1954
+ */
1955
+ NO_STREAM_URL: (song: string) => string;
1956
+ /**
1957
+ * Every video of the playlist was filtered out.
1958
+ *
1959
+ * It is raised when a playlist does not have any valid video left, e.g.
1960
+ * because all of them were age-restricted and the channel is not NSFW.
1961
+ */
1962
+ EMPTY_FILTERED_PLAYLIST: string;
1963
+ /**
1964
+ * The playlist does not have any valid video.
1965
+ *
1966
+ * It is raised when a playlist is empty.
1967
+ */
1968
+ EMPTY_PLAYLIST: string;
1969
+ };
1970
+ type ErrorMessage = typeof ERROR_MESSAGES;
1971
+ type ErrorCode = keyof ErrorMessage;
1972
+ type StaticErrorCode = {
1973
+ [K in ErrorCode]-?: ErrorMessage[K] extends string ? K : never;
1974
+ }[ErrorCode];
1975
+ type TemplateErrorCode = Exclude<keyof typeof ERROR_MESSAGES, StaticErrorCode>;
1976
+ /**
1977
+ * The error raised by DisTube.
1978
+ *
1979
+ * Every error of the library is a `DisTubeError`: it has a machine readable
1980
+ * `errorCode` and a human readable message that is built from the code.
1981
+ *
1982
+ * @example
1983
+ * ```ts
1984
+ * try {
1985
+ * await distube.play(channel, "Never gonna give you up");
1986
+ * } catch (error) {
1987
+ * if (error instanceof DisTubeError && error.errorCode === "NO_RESULT") {
1988
+ * // No song was found for the query.
1989
+ * }
1990
+ * }
1991
+ * ```
1992
+ */
1993
+ declare class DisTubeError<T extends string = any> extends Error {
1994
+ /**
1995
+ * The code of the error, e.g. `NO_RESULT`.
1996
+ */
1997
+ errorCode: string;
1998
+ /**
1999
+ * Create a DisTube error with a static error code.
2000
+ * @param code - The code of the error
2001
+ */
2002
+ constructor(code: T extends StaticErrorCode ? T : never);
2003
+ /**
2004
+ * Create a DisTube error with a templated error code.
2005
+ * @param code - The code of the error
2006
+ * @param args - The arguments of the message template of the code
2007
+ */
2008
+ constructor(code: T extends TemplateErrorCode ? T : never, ...args: Parameters<ErrorMessage[typeof code]>);
2009
+ /**
2010
+ * Create a DisTube error with a templated error code.
2011
+ * @param code - The code of the error
2012
+ * @param _ - Not used: it prevents this overload from being selected
2013
+ */
2014
+ constructor(code: TemplateErrorCode, _: never);
2015
+ /**
2016
+ * Create a DisTube error with a custom message.
2017
+ * @param code - The code of the error
2018
+ * @param message - The custom message of the error
2019
+ */
2020
+ constructor(code: T extends ErrorCode ? never : T, message: string);
2021
+ /**
2022
+ * Create a {@link DisTubeError} with a custom message.
2023
+ *
2024
+ * The default message of an error code is a generic template. Use this factory
2025
+ * when you need to tell the user what exactly went wrong, or when you want to
2026
+ * keep the original error as the `cause` of the error.
2027
+ *
2028
+ * It is polymorphic: calling it on a subclass creates an instance of that
2029
+ * subclass.
2030
+ *
2031
+ * @param code - The error code
2032
+ * @param message - The custom message
2033
+ * @param options - Optional options
2034
+ * @param options.cause - The original error that caused this one
2035
+ * @returns The created error
2036
+ */
2037
+ static withMessage<T extends string = any>(code: T, message: string, options?: {
2038
+ cause?: unknown;
2039
+ }): DisTubeError<T>;
2040
+ /**
2041
+ * The name of the error, with its code.
2042
+ * @returns The name of the error, e.g. `DisTubeError [NO_RESULT]`
2043
+ */
2044
+ get name(): string;
2045
+ /**
2046
+ * The code of the error, e.g. `NO_RESULT`.
2047
+ *
2048
+ * It is an alias of {@link DisTubeError.errorCode}.
2049
+ * @returns The code of the error
2050
+ */
2051
+ get code(): string;
2052
+ }
2053
+
2054
+ /**
2055
+ * Manage filters of a playing {@link Queue}
2056
+ */
2057
+ declare class FilterManager extends BaseManager<Filter> {
2058
+ #private;
2059
+ /**
2060
+ * The queue to manage
2061
+ */
2062
+ queue: Queue;
2063
+ /**
2064
+ * Create a filter manager for a queue.
2065
+ * @param queue - The queue to manage
2066
+ */
2067
+ constructor(queue: Queue);
2068
+ /**
2069
+ * Enable a filter or multiple filters to the manager
2070
+ * @param filterOrFilters - The filter or filters to enable
2071
+ * @param override - Wether or not override the applied filter with new filter value
2072
+ * @returns This manager, to allow chaining
2073
+ * @throws {@link DisTubeError} When a filter is not a valid {@link FilterResolvable}
2074
+ * @example
2075
+ * ```ts
2076
+ * queue.filters.add("bassboost");
2077
+ * ```
2078
+ */
2079
+ add(filterOrFilters: FilterResolvable | FilterResolvable[], override?: boolean): this;
2080
+ /**
2081
+ * Clear enabled filters of the manager
2082
+ * @returns This manager, to allow chaining
2083
+ */
2084
+ clear(): this;
2085
+ /**
2086
+ * Set the filters applied to the manager
2087
+ * @param filters - The filters to apply
2088
+ * @returns This manager, to allow chaining
2089
+ * @throws {@link DisTubeError} When the array is invalid, or when a filter is
2090
+ * not a valid {@link FilterResolvable}
2091
+ */
2092
+ set(filters: FilterResolvable[]): this;
2093
+ /**
2094
+ * Disable a filter or multiple filters
2095
+ * @param filterOrFilters - The filter or filters to disable
2096
+ * @returns This manager, to allow chaining
2097
+ * @throws {@link DisTubeError} When a filter is not a valid {@link FilterResolvable}
2098
+ */
2099
+ remove(filterOrFilters: FilterResolvable | FilterResolvable[]): this;
2100
+ /**
2101
+ * Check whether a filter enabled or not
2102
+ * @param filter - The filter to check
2103
+ * @returns `true` when the filter is enabled
2104
+ * @throws {@link DisTubeError} When the filter is not a valid {@link FilterResolvable}
2105
+ */
2106
+ has(filter: FilterResolvable): boolean;
2107
+ /**
2108
+ * Array of enabled filter names
2109
+ */
2110
+ get names(): string[];
2111
+ /**
2112
+ * Array of enabled filters
2113
+ */
2114
+ get values(): Filter[];
2115
+ /**
2116
+ * The FFmpeg arguments of the enabled filters.
2117
+ *
2118
+ * It is the `af` output argument of the FFmpeg process.
2119
+ */
2120
+ get ffmpegArgs(): FFmpegArg;
2121
+ /**
2122
+ * The names of the enabled filters, as a comma separated string.
2123
+ * @returns The names of the enabled filters
2124
+ */
2125
+ toString(): string;
2126
+ }
2127
+
2128
+ /**
2129
+ * Task queuing system
2130
+ *
2131
+ * It makes sure that the tasks of a {@link Queue} are processed one after the
2132
+ * other, instead of all at the same time.
2133
+ */
2134
+ declare class TaskQueue {
2135
+ #private;
2136
+ /**
2137
+ * Waits for last task finished and queues a new task
2138
+ * @param isPlay - Whether the task is a play task
2139
+ * @returns A promise that resolves when the last queued task is finished
2140
+ */
2141
+ queuing(isPlay?: boolean): Promise<void>;
2142
+ /**
2143
+ * Removes the finished task and processes the next task
2144
+ * @returns Nothing
2145
+ */
2146
+ resolve(): void;
2147
+ /**
2148
+ * The remaining number of tasks
2149
+ */
2150
+ get remaining(): number;
2151
+ /**
2152
+ * Whether or not having a play task
2153
+ */
2154
+ get hasPlayTask(): boolean;
2155
+ }
2156
+
2157
+ /**
2158
+ * Represents a queue.
2159
+ */
2160
+ declare class Queue extends DisTubeBase {
2161
+ #private;
2162
+ /**
2163
+ * Queue id (Guild id)
2164
+ */
2165
+ readonly id: Snowflake;
2166
+ /**
2167
+ * Voice connection of this queue.
2168
+ */
2169
+ voice: DisTubeVoice;
2170
+ /**
2171
+ * List of songs in the queue (The first one is the playing song)
2172
+ */
2173
+ songs: Song[];
2174
+ /**
2175
+ * List of the previous songs.
2176
+ */
2177
+ previousSongs: Song[];
2178
+ /**
2179
+ * Whether stream is currently stopped.
2180
+ */
2181
+ stopped: boolean;
2182
+ /**
2183
+ * Whether or not the stream is currently paused.
2184
+ *
2185
+ * It is also `true` once the queue has been stopped, so that `!queue.paused`
2186
+ * stays `false` as soon as the queue is not playing anymore.
2187
+ */
2188
+ paused: boolean;
2189
+ /**
2190
+ * Type of repeat mode (`0` is disabled, `1` is repeating a song, `2` is repeating
2191
+ * all the queue). Default value: `0` (disabled)
2192
+ */
2193
+ repeatMode: RepeatMode;
2194
+ /**
2195
+ * Whether or not the autoplay mode is enabled. Default value: `false`
2196
+ */
2197
+ autoplay: boolean;
2198
+ /**
2199
+ * FFmpeg arguments for the current queue. Default value is defined with {@link DisTubeOptions}.ffmpeg.args.
2200
+ * `af` output argument will be replaced with {@link Queue#filters} manager
2201
+ */
2202
+ ffmpegArgs: FFmpegArgs;
2203
+ /**
2204
+ * The text channel of the Queue. (Default: where the first command is called).
2205
+ */
2206
+ textChannel?: GuildTextBasedChannel;
2207
+ /**
2208
+ * What time in the song to begin (in seconds).
2209
+ * @internal
2210
+ */
2211
+ _beginTime: number;
2212
+ /**
2213
+ * Whether or not the queue is being updated manually (skip, jump, previous)
2214
+ * @internal
2215
+ */
2216
+ _manualUpdate: boolean;
2217
+ /**
2218
+ * Task queuing system
2219
+ * @internal
2220
+ */
2221
+ _taskQueue: TaskQueue;
2222
+ /**
2223
+ * {@link DisTubeVoice} listener
2224
+ * @internal
2225
+ */
2226
+ _listeners?: DisTubeVoiceEvents;
2227
+ /**
2228
+ * Create a queue for the guild
2229
+ * @param distube - DisTube
2230
+ * @param voice - Voice connection
2231
+ * @param textChannel - Default text channel
2232
+ */
2233
+ constructor(distube: DisTube, voice: DisTubeVoice, textChannel?: GuildTextBasedChannel);
2234
+ /**
2235
+ * The client user as a `GuildMember` of this queue's guild
2236
+ */
2237
+ get clientMember(): discord_js.GuildMember | undefined;
2238
+ /**
2239
+ * The filter manager of the queue
2240
+ */
2241
+ get filters(): FilterManager;
2242
+ /**
2243
+ * Whether or not the queue is still active.
2244
+ *
2245
+ * It is `false` only when the queue has been stopped. A paused queue is still
2246
+ * active.
2247
+ */
2248
+ get isActive(): boolean;
2249
+ /**
2250
+ * Formatted duration string.
2251
+ */
2252
+ get formattedDuration(): string;
2253
+ /**
2254
+ * Queue's duration.
2255
+ */
2256
+ get duration(): number;
2257
+ /**
2258
+ * What time in the song is playing (in seconds).
2259
+ */
2260
+ get currentTime(): number;
2261
+ /**
2262
+ * Formatted {@link Queue#currentTime} string.
2263
+ */
2264
+ get formattedCurrentTime(): string;
2265
+ /**
2266
+ * The voice channel playing in.
2267
+ */
2268
+ get voiceChannel(): discord_js.VoiceBasedChannel | null;
2269
+ /**
2270
+ * Get or set the stream volume. Default value: `50`.
2271
+ */
2272
+ get volume(): number;
2273
+ /**
2274
+ * Set the stream volume.
2275
+ * @param value - The volume percentage, from `0` to `100`
2276
+ * @throws {@link DisTubeError} When the volume is not a number, or when it is
2277
+ * negative
2278
+ */
2279
+ set volume(value: number);
2280
+ /**
2281
+ * Add a song or a list of songs to the queue.
2282
+ * @throws {DisTubeError}
2283
+ * @param song - Song to add
2284
+ * @param position - Position to add, \<= 0 to add to the end of the queue
2285
+ * @returns The guild queue
2286
+ * @example
2287
+ * ```ts
2288
+ * queue.addToQueue(song);
2289
+ * ```
2290
+ */
2291
+ addToQueue(song: Song | Song[], position?: number): Queue;
2292
+ /**
2293
+ /**
2294
+ * Pause the guild stream
2295
+ * @returns The guild queue
2296
+ * @throws {@link DisTubeError} When the queue is already paused
2297
+ * @example
2298
+ * ```ts
2299
+ * await queue.pause();
2300
+ * ```
2301
+ */
2302
+ pause(): Promise<Queue>;
2303
+ /**
2304
+ * Resume the guild stream
2305
+ * @returns The guild queue
2306
+ * @throws {@link DisTubeError} When the queue is not paused
2307
+ * @example
2308
+ * ```ts
2309
+ * await queue.resume();
2310
+ * ```
2311
+ */
2312
+ resume(): Promise<Queue>;
2313
+ /**
2314
+ * Set the guild stream's volume
2315
+ * @param percent - The percentage of volume you want to set
2316
+ * @returns The guild queue
2317
+ * @throws {@link DisTubeError} When the volume is not a number, or when it is
2318
+ * negative
2319
+ */
2320
+ setVolume(percent: number): Queue;
2321
+ /**
2322
+ * Skip the playing song if there is a next song in the queue. <info>If {@link
2323
+ * Queue#autoplay} is `true` and there is no up next song, DisTube will add and
2324
+ * play a related song.</info>
2325
+ * @param options - Skip options
2326
+ * @returns The song will skip to
2327
+ * @throws {@link DisTubeError} When there is no up next song, or when the
2328
+ * position is out of the bounds of the queue
2329
+ * @example
2330
+ * ```ts
2331
+ * await queue.skip();
2332
+ * ```
2333
+ */
2334
+ skip(options?: JumpOptions): Promise<Song>;
2335
+ /**
2336
+ * Play the previous song if exists
2337
+ * @returns The guild queue
2338
+ * @throws {@link DisTubeError} When {@link DisTubeOptions.savePreviousSongs} is
2339
+ * disabled, or when the queue does not have any previous song
2340
+ */
2341
+ previous(): Promise<Song>;
2342
+ /**
2343
+ * Shuffle the queue's songs
2344
+ * @returns The guild queue
2345
+ */
2346
+ shuffle(): Promise<Queue>;
2347
+ /**
2348
+ * Jump to the song position in the queue. The next one is 1, 2,... The previous
2349
+ * one is -1, -2,...
2350
+ * if `num` is invalid number
2351
+ * @param position - The song position to play
2352
+ * @param options - Skip options
2353
+ * @returns The new Song will be played
2354
+ * @throws {@link DisTubeError} When the position is invalid, when there is no
2355
+ * up next song, or when {@link DisTubeOptions.savePreviousSongs} is disabled
2356
+ * and the jump is backwards
2357
+ */
2358
+ jump(position: number, options?: JumpOptions): Promise<Song>;
2359
+ /**
2360
+ * Set the repeat mode of the guild queue.
2361
+ * Toggle mode `(Disabled -> Song -> Queue -> Disabled ->...)` if `mode` is `undefined`
2362
+ * @param mode - The repeat modes (toggle if `undefined`)
2363
+ * @returns The new repeat mode
2364
+ * @throws {@link DisTubeError} When the mode is not a valid {@link RepeatMode}
2365
+ */
2366
+ setRepeatMode(mode?: RepeatMode): RepeatMode;
2367
+ /**
2368
+ * Set the playing time to another position
2369
+ * @param time - Time in seconds
2370
+ * @returns The guild queue
2371
+ * @throws {@link DisTubeError} When the time is not a number, or when it is
2372
+ * negative
2373
+ * @example
2374
+ * ```ts
2375
+ * await queue.seek(60);
2376
+ * ```
2377
+ */
2378
+ seek(time: number): Promise<Queue>;
2379
+ /**
2380
+ * Internal implementation of addRelatedSong without task queue protection.
2381
+ * Used by methods that already hold the task queue lock.
2382
+ * @param song - The song to get related songs from. Defaults to the current playing song.
2383
+ * @returns A promise that resolves to the added song
2384
+ * @throws {@link DisTubeError} When the queue does not have any playing song,
2385
+ * or when no related song could be found
2386
+ * @internal
2387
+ */
2388
+ _addRelatedSong(song?: Song): Promise<Song>;
2389
+ /**
2390
+ * Add a related song of the playing song to the queue
2391
+ * @param song - The song to get related songs from. Defaults to the current playing song.
2392
+ * @returns The added song
2393
+ * @throws {@link DisTubeError} When the queue does not have any playing song,
2394
+ * or when no related song could be found
2395
+ */
2396
+ addRelatedSong(song?: Song): Promise<Song>;
2397
+ /**
2398
+ * Stop the guild stream and delete the queue
2399
+ * @returns A promise that resolves when the queue is stopped
2400
+ */
2401
+ stop(): Promise<void>;
2402
+ /**
2403
+ * Remove the queue from the manager
2404
+ * @returns Nothing
2405
+ */
2406
+ remove(): void;
2407
+ /**
2408
+ * Toggle autoplay mode
2409
+ * @returns Autoplay mode state
2410
+ */
2411
+ toggleAutoplay(): boolean;
2412
+ /**
2413
+ * Play the first song in the queue
2414
+ * @param emitPlaySong - Whether or not emit {@link Events.PLAY_SONG} event
2415
+ * @returns A promise that resolves when the song is playing
2416
+ * @throws {@link DisTubeError} When the queue has been stopped
2417
+ */
2418
+ play(emitPlaySong?: boolean): Promise<void>;
2419
+ /**
2420
+ * Restart the current stream with the current FFmpeg arguments, keeping the
2421
+ * playback position.
2422
+ *
2423
+ * The FFmpeg audio filters are applied when the stream is created, so the stream
2424
+ * has to be recreated whenever the filters change.
2425
+ *
2426
+ * Unlike a regular playback error, a failure while restarting the stream does
2427
+ * **not** remove the current song from the queue.
2428
+ * @returns A promise that resolves when the stream is restarted
2429
+ * @internal
2430
+ */
2431
+ _restartStream(): Promise<void>;
2432
+ }
2433
+
2434
+ /**
2435
+ * The result of a search.
2436
+ *
2437
+ * It is the result type of every search, at the plugin level and at the
2438
+ * DisTube level.
2439
+ */
2440
+ declare class SearchResult<T = unknown> {
2441
+ /**
2442
+ * The query of the search.
2443
+ */
2444
+ readonly query: string;
2445
+ /**
2446
+ * The kind of result that was looked for.
2447
+ */
2448
+ readonly queryType: SearchResultType;
2449
+ /**
2450
+ * The songs that were found.
2451
+ */
2452
+ readonly songs: Song<T>[];
2453
+ /**
2454
+ * The playlist that was found, when the search returned one.
2455
+ */
2456
+ readonly playlist?: Playlist<T>;
2457
+ /**
2458
+ * The identifiers of the plugins that contributed to the result.
2459
+ */
2460
+ readonly sources: string[];
2461
+ /**
2462
+ * Create a search result.
2463
+ * @param query - The query of the search
2464
+ * @param options - Optional data
2465
+ * @param options.songs - The songs that were found
2466
+ * @param options.playlist - The playlist that was found
2467
+ * @param options.queryType - The kind of result that was looked for
2468
+ * @param options.sources - The identifiers of the plugins that contributed
2469
+ * to the result
2470
+ * @example
2471
+ * ```ts
2472
+ * const result = new SearchResult("Never gonna give you up", { songs: [song] });
2473
+ * ```
2474
+ */
2475
+ constructor(query: string, { songs, playlist, queryType, sources, }?: {
2476
+ songs?: Song<T>[];
2477
+ playlist?: Playlist<T>;
2478
+ queryType?: SearchResultType;
2479
+ sources?: string[];
2480
+ });
2481
+ /**
2482
+ * Whether the search returned nothing.
2483
+ * @returns `true` when the result has neither songs nor a playlist
2484
+ */
2485
+ isEmpty(): boolean;
2486
+ /**
2487
+ * Whether the search returned songs.
2488
+ * @returns `true` when the result has at least one song
2489
+ */
2490
+ hasSongs(): boolean;
2491
+ /**
2492
+ * Whether the search returned a playlist.
2493
+ * @returns `true` when the result has a playlist
2494
+ */
2495
+ hasPlaylist(): boolean;
2496
+ /**
2497
+ * A plain object representation of the result.
2498
+ * @returns The plain object representation of the result
2499
+ */
2500
+ toJSON(): object;
2501
+ }
2502
+
2503
+ /**
2504
+ * DisTube class
2505
+ */
2506
+ declare class DisTube extends TypedEmitter<TypedDisTubeEvents> {
2507
+ #private;
2508
+ /**
2509
+ * @event
2510
+ * Emitted after DisTube add a new playlist to the playing {@link Queue}.
2511
+ * @param queue - The guild queue
2512
+ * @param playlist - Playlist info
2513
+ */
2514
+ static readonly [Events.ADD_LIST]: (queue: Queue, playlist: Playlist) => Awaitable;
2515
+ /**
2516
+ * @event
2517
+ * Emitted after DisTube add a new song to the playing {@link Queue}.
2518
+ * @param queue - The guild queue
2519
+ * @param song - Added song
2520
+ */
2521
+ static readonly [Events.ADD_SONG]: (queue: Queue, song: Song) => Awaitable;
2522
+ /**
2523
+ * @event
2524
+ * Emitted when the {@link Queue} is deleted with any reasons.
2525
+ * @param queue - The guild queue
2526
+ */
2527
+ static readonly [Events.DELETE_QUEUE]: (queue: Queue) => Awaitable;
2528
+ /**
2529
+ * @event
2530
+ * Emitted when the bot is disconnected to a voice channel.
2531
+ * @param queue - The guild queue
2532
+ */
2533
+ static readonly [Events.DISCONNECT]: (queue: Queue) => Awaitable;
2534
+ /**
2535
+ * @event
2536
+ * Emitted when the {@link Queue} runs out of songs to play.
2537
+ * @param queue - The guild queue
2538
+ */
2539
+ static readonly [Events.EMPTY]: (queue: Queue) => Awaitable;
2540
+ /**
2541
+ * @event
2542
+ * Emitted when DisTube encounters an error while playing songs.
2543
+ * @param error - error
2544
+ * @param queue - The queue encountered the error
2545
+ * @param song - The playing song when encountered the error
2546
+ */
2547
+ static readonly [Events.ERROR]: (error: Error, queue: Queue, song?: Song) => Awaitable;
2548
+ /**
2549
+ * @event
2550
+ * Emitted for logging FFmpeg debug information.
2551
+ * @param debug - Debug message string.
2552
+ */
2553
+ static readonly [Events.FFMPEG_DEBUG]: (debug: string) => Awaitable;
2554
+ /**
2555
+ * @event
2556
+ * Emitted to provide debug information from DisTube's operation.
2557
+ * Useful for troubleshooting or logging purposes.
2558
+ *
2559
+ * @param debug - Debug message string.
2560
+ */
2561
+ static readonly [Events.DEBUG]: (debug: string) => Awaitable;
2562
+ /**
2563
+ * @event
2564
+ * Emitted when there is no more song in the queue and {@link Queue#autoplay} is `false`.
2565
+ * @param queue - The guild queue
2566
+ */
2567
+ static readonly [Events.FINISH]: (queue: Queue) => Awaitable;
2568
+ /**
2569
+ * @event
2570
+ * Emitted when DisTube finished a song.
2571
+ * @param queue - The guild queue
2572
+ * @param song - Finished song
2573
+ */
2574
+ static readonly [Events.FINISH_SONG]: (queue: Queue, song: Song) => Awaitable;
2575
+ /**
2576
+ * @event
2577
+ * Emitted when DisTube initialize a queue to change queue default properties.
2578
+ * @param queue - The guild queue
2579
+ */
2580
+ static readonly [Events.INIT_QUEUE]: (queue: Queue) => Awaitable;
2581
+ /**
2582
+ * @event
2583
+ * Emitted when {@link Queue#autoplay} is `true`, {@link Queue#songs} is empty, and
2584
+ * DisTube cannot find related songs to play.
2585
+ * @param queue - The guild queue
2586
+ * @param error - The error that occurred while looking for related songs
2587
+ */
2588
+ static readonly [Events.NO_RELATED]: (queue: Queue, error: DisTubeError) => Awaitable;
2589
+ /**
2590
+ * @event
2591
+ * Emitted when DisTube play a song.
2592
+ * If {@link DisTubeOptions}.emitNewSongOnly is `true`, this event is not emitted
2593
+ * when looping a song or next song is the previous one.
2594
+ * @param queue - The guild queue
2595
+ * @param song - Playing song
2596
+ */
2597
+ static readonly [Events.PLAY_SONG]: (queue: Queue, song: Song) => Awaitable;
2598
+ /**
2599
+ * DisTube internal handler
2600
+ */
2601
+ readonly handler: DisTubeHandler;
2602
+ /**
2603
+ * DisTube options
2604
+ */
2605
+ readonly options: Options;
2606
+ /**
2607
+ * Discord.js v14 client
2608
+ */
2609
+ readonly client: Client;
2610
+ /**
2611
+ * Queues manager
2612
+ */
2613
+ readonly queues: QueueManager;
2614
+ /**
2615
+ * DisTube voice connections manager
2616
+ */
2617
+ readonly voices: DisTubeVoiceManager;
2618
+ /**
2619
+ * DisTube plugins
2620
+ */
2621
+ readonly plugins: DisTubePlugin[];
2622
+ /**
2623
+ * The local HTTP server the plugins use to stream the audio.
2624
+ *
2625
+ * A plugin that cannot hand out a static URL to FFmpeg registers a handler on
2626
+ * it, instead of running its own server.
2627
+ */
2628
+ readonly streams: StreamServer;
2629
+ /**
2630
+ * DisTube ffmpeg audio filters
2631
+ */
2632
+ readonly filters: Filters;
2633
+ /**
2634
+ * Create a new DisTube class.
2635
+ * @throws {@link DisTubeError}
2636
+ * @param client - Discord.JS client
2637
+ * @param opts - Custom DisTube options
2638
+ * @example
2639
+ * ```ts
2640
+ * const distube = new DisTube(client, { nsfw: false });
2641
+ * ```
2642
+ */
2643
+ constructor(client: Client, opts?: DisTubeOptions);
2644
+ /**
2645
+ * Create a DisTube instance and wait for the plugins to be initialized.
2646
+ *
2647
+ * Use it when a plugin does asynchronous work in its `init` method: the
2648
+ * constructor cannot await it.
2649
+ * @param client - The Discord.js client
2650
+ * @param opts - Optional options
2651
+ * @returns The DisTube instance
2652
+ * @example
2653
+ * ```ts
2654
+ * const distube = await DisTube.create(client, { plugins: [new YoutubePlugin()] });
2655
+ * ```
2656
+ */
2657
+ static create(client: Client, opts?: DisTubeOptions): Promise<DisTube>;
2658
+ /**
2659
+ * Emit an event of the DisTube instance.
2660
+ *
2661
+ * The special {@link Events.ERROR} event is handled differently than the other
2662
+ * events: Node.js throws an `ERR_UNHANDLED_ERROR` when the special `"error"`
2663
+ * event is emitted without any listener, which crashes the whole process.
2664
+ *
2665
+ * Instead of crashing, DisTube follows {@link DisTubeOptions.unhandledError}
2666
+ * (`"log"` by default).
2667
+ * @param event - The event name
2668
+ * @param args - The event arguments
2669
+ * @returns `true` when the event had listeners, `false` otherwise
2670
+ */
2671
+ emit<U extends keyof TypedDisTubeEvents>(event: U, ...args: Parameters<TypedDisTubeEvents[U]>): boolean;
2672
+ /**
2673
+ * DisTube version
2674
+ */
2675
+ static get version(): string;
2676
+ /**
2677
+ * DisTube version
2678
+ */
2679
+ get version(): string;
2680
+ /**
2681
+ * Play / add a song or playlist from url.
2682
+ * Search and play a song (with {@link ExtractorPlugin}) if it is not a valid url.
2683
+ * @throws {@link DisTubeError}
2684
+ * @param voiceChannel - The channel will be joined if the bot isn't in any channels, the bot will be
2685
+ * moved to this channel if {@link DisTubeOptions}.joinNewVoiceChannel is `true`
2686
+ * @param song - URL | Search string | {@link Song} | {@link Playlist}
2687
+ * @param options - Optional options
2688
+ * @returns A promise that resolves when the song is added to the queue
2689
+ * @example
2690
+ * ```ts
2691
+ * await distube.play(channel, "Never gonna give you up", { message });
2692
+ * ```
2693
+ */
2694
+ play<T = unknown>(voiceChannel: VoiceBasedChannel, song: string | Song | Playlist, options?: PlayOptions<T>): Promise<void>;
2695
+ /**
2696
+ * Create a custom playlist
2697
+ * @param songs - Array of url or Song
2698
+ * @param options - Optional options
2699
+ * @returns The created playlist
2700
+ * @throws {@link DisTubeError} When the array is empty, or when it does not
2701
+ * have any valid song
2702
+ */
2703
+ createCustomPlaylist(songs: (string | Song)[], { member, parallel, metadata, name, source, url, thumbnail }?: CustomPlaylistOptions): Promise<Playlist>;
2704
+ /**
2705
+ * Get the guild queue
2706
+ * @param guild - The type can be resolved to give a {@link Queue}
2707
+ * @returns The queue of the guild, or `undefined` when there is none
2708
+ * @example
2709
+ * ```ts
2710
+ * const queue = distube.getQueue(guildId);
2711
+ * ```
2712
+ */
2713
+ getQueue(guild: GuildIdResolvable): Queue | undefined;
2714
+ /**
2715
+ * Get a plugin by the identifier of its source.
2716
+ *
2717
+ * It matches the {@link Plugin.source} of the plugin, or one of its
2718
+ * {@link Plugin.aliases}. The identifier of the class is used when the
2719
+ * plugin does not define a source (`YoutubePlugin` -> `youtube`).
2720
+ * @param source - The identifier of the source
2721
+ * @returns The plugin, or `undefined` when there is none
2722
+ * @example
2723
+ * ```ts
2724
+ * const plugin = distube.getPlugin("youtube");
2725
+ * ```
2726
+ */
2727
+ getPlugin(source: string): DisTubePlugin | undefined;
2728
+ /**
2729
+ * Search for the songs of the plugins.
2730
+ *
2731
+ * The plugins are used in the order they were registered. When
2732
+ * {@link ResolveOptions.source} is given, only the matching plugin is used.
2733
+ * @param query - The search query
2734
+ * @param options - Optional options
2735
+ * @returns The result of the search
2736
+ * @example
2737
+ * ```ts
2738
+ * const result = await distube.search("Never gonna give you up", { limit: 5 });
2739
+ * ```
2740
+ */
2741
+ search<T = unknown>(query: string, options?: SearchOptions<T>): Promise<SearchResult<T>>;
2742
+ /**
2743
+ /**
2744
+ /**
2745
+ /**
2746
+ * Emit error event
2747
+ * @param error - error
2748
+ * @param queue - The queue encountered the error
2749
+ * @param song - The playing song when encountered the error
2750
+ * @returns Nothing
2751
+ */
2752
+ emitError(error: Error, queue: Queue, song?: Song): void;
2753
+ /**
2754
+ * Emit debug event
2755
+ * @param message - debug message
2756
+ * @returns Nothing
2757
+ */
2758
+ debug(message: string): void;
2759
+ /**
2760
+ * Destroy the DisTube instance.
2761
+ *
2762
+ * Stops every queue, leaves every voice channel, destroys every plugin and
2763
+ * removes every listener.
2764
+ * Call it before your Discord.js client is destroyed to release all resources.
2765
+ * @returns A promise that resolves when every resource is released
2766
+ * @example
2767
+ * ```ts
2768
+ * await distube.destroy();
2769
+ * ```
2770
+ */
2771
+ destroy(): Promise<void>;
2772
+ }
2773
+
2774
+ /**
2775
+ * The base class of every DisTube internal that needs a reference to the
2776
+ * {@link DisTube} instance.
2777
+ */
2778
+ declare abstract class DisTubeBase {
2779
+ /**
2780
+ * The DisTube instance this object belongs to.
2781
+ */
2782
+ distube: DisTube;
2783
+ /**
2784
+ * Create a new base object.
2785
+ * @param distube - The DisTube instance
2786
+ */
2787
+ constructor(distube: DisTube);
2788
+ /**
2789
+ * Emit the {@link DisTube} of this base
2790
+ * @param eventName - Event name
2791
+ * @param args - arguments
2792
+ * @returns `true` when the event had listeners, `false` otherwise
2793
+ */
2794
+ emit(eventName: keyof DisTubeEvents, ...args: any): boolean;
2795
+ /**
2796
+ * Emit error event
2797
+ * @param error - error
2798
+ * @param queue - The queue encountered the error
2799
+ * @param song - The playing song when encountered the error
2800
+ * @returns Nothing
2801
+ */
2802
+ emitError(error: Error, queue: Queue, song?: Song): void;
2803
+ /**
2804
+ * Emit debug event
2805
+ * @param message - debug message
2806
+ * @returns Nothing
2807
+ */
2808
+ debug(message: string): void;
2809
+ /**
2810
+ * The queue manager
2811
+ */
2812
+ get queues(): QueueManager;
2813
+ /**
2814
+ * The voice manager
2815
+ */
2816
+ get voices(): DisTubeVoiceManager;
2817
+ /**
2818
+ * Discord.js client
2819
+ */
2820
+ get client(): Client;
2821
+ /**
2822
+ * DisTube options
2823
+ */
2824
+ get options(): Options;
2825
+ /**
2826
+ * DisTube handler
2827
+ */
2828
+ get handler(): DisTubeHandler;
2829
+ /**
2830
+ * DisTube plugins
2831
+ */
2832
+ get plugins(): DisTubePlugin[];
2833
+ }
2834
+
2835
+ /**
2836
+ * DisTube Plugin
2837
+ */
2838
+ declare abstract class Plugin {
2839
+ /**
2840
+ * Type of the plugin
2841
+ */
2842
+ abstract readonly type: PluginType;
2843
+ /**
2844
+ * The identifier of the source of the plugin.
2845
+ *
2846
+ * It defaults to the name of the class, lowercased, without the `Plugin`
2847
+ * suffix (`YoutubePlugin` -> `youtube`).
2848
+ *
2849
+ * It is used to route a search to a plugin, and to find a plugin with
2850
+ * {@link DisTube#getPlugin}.
2851
+ */
2852
+ readonly source?: string;
2853
+ /**
2854
+ * Additional identifiers of the source of the plugin, e.g. `["yt"]`.
2855
+ */
2856
+ readonly aliases?: string[];
2857
+ /**
2858
+ * Whether the songs of this plugin can be played directly.
2859
+ *
2860
+ * When it is `false`, the songs of the plugin are resolved to a playable
2861
+ * version by another plugin. It defaults to `true`.
2862
+ */
2863
+ readonly playable?: boolean;
2864
+ /**
2865
+ * DisTube
2866
+ */
2867
+ distube: DisTube;
2868
+ /**
2869
+ * Initialize the plugin.
2870
+ *
2871
+ * It can be asynchronous: use {@link DisTube.create} to wait for the
2872
+ * initialization of the plugins.
2873
+ * @param distube - The DisTube instance
2874
+ * @returns Nothing, or a promise that resolves when the plugin is initialized
2875
+ * @example
2876
+ * ```ts
2877
+ * override async init(distube: DisTube) {
2878
+ * this.client = await createSession();
2879
+ * }
2880
+ * ```
2881
+ */
2882
+ init(distube: DisTube): void | Promise<void>;
2883
+ /**
2884
+ * Every identifier of this plugin: its {@link Plugin.source} and its
2885
+ * {@link Plugin.aliases}, lowercased.
2886
+ *
2887
+ * The static properties of the class are used when the instance ones are not
2888
+ * defined, so a plugin can declare them either way.
2889
+ */
2890
+ get identifiers(): string[];
2891
+ /**
2892
+ * The local HTTP server of the DisTube instance.
2893
+ *
2894
+ * Register a handler on it when the plugin cannot hand out a static URL to
2895
+ * FFmpeg, instead of running its own server.
2896
+ */
2897
+ get streams(): StreamServer;
2898
+ /**
2899
+ * Search for a song of the source.
2900
+ *
2901
+ * Override it to enable the search of your source. It returns `null` by
2902
+ * default, because a source that cannot be searched does not have any result.
2903
+ * @param _query - Search query
2904
+ * @param _options - Optional options
2905
+ * @returns The song that was found, or `null`
2906
+ * @example
2907
+ * ```ts
2908
+ * override async searchSong(query: string): Promise<Song | null> {
2909
+ * return findSong(query);
2910
+ * }
2911
+ * ```
2912
+ */
2913
+ searchSong<T>(_query: string, _options: ResolveOptions<T>): Awaitable<Song<T> | null>;
2914
+ /**
2915
+ * Search for the songs of the source.
2916
+ *
2917
+ * The default implementation returns the single result of
2918
+ * {@link Plugin#searchSong}. Override it to return more results, or to return
2919
+ * a playlist.
2920
+ * @param query - Search query
2921
+ * @param options - Optional options
2922
+ * @returns The result of the search
2923
+ * @example
2924
+ * ```ts
2925
+ * const result = await plugin.search("Never gonna give you up", { limit: 5 });
2926
+ * ```
2927
+ */
2928
+ search<T>(query: string, options?: SearchOptions<T>): Promise<SearchResult<T>>;
2929
+ /**
2930
+ * Create the query used to find a playable version of a song.
2931
+ *
2932
+ * It is used when the plugin cannot play the songs it resolves.
2933
+ * @param song - Input song
2934
+ * @returns The search query
2935
+ * @example
2936
+ * ```ts
2937
+ * override createSearchQuery(song: Song): string {
2938
+ * return `${song.name} ${song.uploader?.name}`;
2939
+ * }
2940
+ * ```
2941
+ */
2942
+ createSearchQuery<T>(song: Song<T>): Awaitable<string>;
2943
+ /**
2944
+ * Get related songs from a supported url.
2945
+ *
2946
+ * Override it to enable the autoplay for your source. Return an empty array
2947
+ * when your source does not have any related songs.
2948
+ * @param _song - Input song
2949
+ * @returns The related songs
2950
+ */
2951
+ getRelatedSongs(_song: Song): Awaitable<Song[]>;
2952
+ /**
2953
+ * Destroy the plugin.
2954
+ *
2955
+ * It is called when the {@link DisTube} instance is destroyed. Override it to
2956
+ * release every resource held by the plugin (HTTP servers, timers, browser
2957
+ * sessions, ...).
2958
+ * @returns Nothing, or a promise that resolves when the plugin is destroyed
2959
+ */
2960
+ destroy(): void | Promise<void>;
2961
+ }
2962
+
2963
+ /**
2964
+ * This plugin can extract the info, search, and play a song directly from its source
2965
+ */
2966
+ declare abstract class ExtractorPlugin extends Plugin {
2967
+ /**
2968
+ * The type of the plugin.
2969
+ */
2970
+ readonly type: PluginType;
2971
+ /**
2972
+ * Check if the url is working with this plugin
2973
+ * @param url - Input url
2974
+ * @returns `true` when the plugin can handle the url
2975
+ */
2976
+ abstract validate(url: string): Awaitable<boolean>;
2977
+ /**
2978
+ * Resolve the validated url to a {@link Song} or a {@link Playlist}.
2979
+ * @param url - URL
2980
+ * @param options - Optional options
2981
+ * @returns The resolved song or playlist
2982
+ */
2983
+ abstract resolve<T>(url: string, options: ResolveOptions<T>): Awaitable<Song<T> | Playlist<T>>;
2984
+ /**
2985
+ * Get the stream url from {@link Song#url}. Returns {@link Song#url} by default.
2986
+ * Not needed if the plugin plays song from YouTube.
2987
+ * @param song - Input song
2988
+ * @returns The url of the audio stream
2989
+ */
2990
+ abstract getStreamURL<T>(song: Song<T>): Awaitable<string>;
2991
+ }
2992
+
2993
+ /**
2994
+ * This plugin only can extract the info from supported links, but not play song directly from its source
2995
+ *
2996
+ * @deprecated Use {@link ExtractorPlugin} with `playable: false` instead.
2997
+ */
2998
+ declare abstract class InfoExtractorPlugin extends ExtractorPlugin {
2999
+ /**
3000
+ * The type of the plugin.
3001
+ */
3002
+ readonly type: PluginType;
3003
+ /**
3004
+ * The songs of this plugin are resolved to a playable version by another
3005
+ * plugin.
3006
+ */
3007
+ readonly playable = false;
3008
+ /**
3009
+ * Check if the url is working with this plugin
3010
+ * @param url - Input url
3011
+ * @returns `true` when the plugin can handle the url
3012
+ */
3013
+ abstract validate(url: string): Awaitable<boolean>;
3014
+ /**
3015
+ * Resolve the validated url to a {@link Song} or a {@link Playlist}.
3016
+ * @param url - URL
3017
+ * @param options - Optional options
3018
+ * @returns The resolved song or playlist
3019
+ */
3020
+ abstract resolve<T>(url: string, options: ResolveOptions<T>): Awaitable<Song<T> | Playlist<T>>;
3021
+ /**
3022
+ * Create a search query to be used in {@link ExtractorPlugin#searchSong}
3023
+ * @param song - Input song
3024
+ * @returns The search query
3025
+ */
3026
+ abstract createSearchQuery<T>(song: Song<T>): Awaitable<string>;
3027
+ /**
3028
+ * This plugin cannot play the songs it resolves, so it never has a stream url.
3029
+ * @param _song - Input song
3030
+ * @returns Nothing: it always throws
3031
+ * @throws {@link PluginError} Always, with the code `NO_STREAM`
3032
+ */
3033
+ getStreamURL<T>(_song: Song<T>): Promise<string>;
3034
+ }
3035
+
3036
+ /**
3037
+ * This plugin can extract and play song from supported links, but cannot search for songs from its source
3038
+ */
3039
+ declare abstract class PlayableExtractorPlugin extends ExtractorPlugin {
3040
+ /**
3041
+ * The type of the plugin.
3042
+ */
3043
+ readonly type: PluginType;
3044
+ /**
3045
+ * Check if the url is working with this plugin
3046
+ * @param url - Input url
3047
+ * @returns `true` when the plugin can handle the url
3048
+ */
3049
+ abstract validate(url: string): Awaitable<boolean>;
3050
+ /**
3051
+ * Resolve the validated url to a {@link Song} or a {@link Playlist}.
3052
+ * @param url - URL
3053
+ * @param options - Optional options
3054
+ * @returns The resolved song or playlist
3055
+ */
3056
+ abstract resolve<T>(url: string, options: ResolveOptions<T>): Awaitable<Song<T> | Playlist<T>>;
3057
+ /**
3058
+ * Get the stream url from {@link Song#url}. Returns {@link Song#url} by default.
3059
+ * Not needed if the plugin plays song from YouTube.
3060
+ * @param song - Input song
3061
+ * @returns The url of the audio stream
3062
+ */
3063
+ abstract getStreamURL<T>(song: Song<T>): Awaitable<string>;
3064
+ }
3065
+
3066
+ /**
3067
+ * The error codes a plugin can raise.
3068
+ */
3069
+ declare enum PluginErrorCode {
3070
+ /**
3071
+ * The URL is not supported by the plugin.
3072
+ */
3073
+ UNSUPPORTED_URL = "UNSUPPORTED_URL",
3074
+ /**
3075
+ * The song, the playlist or the album was not found.
3076
+ */
3077
+ NOT_FOUND = "NOT_FOUND",
3078
+ /**
3079
+ * The plugin could not get a playable stream for the song.
3080
+ */
3081
+ NO_STREAM = "NO_STREAM",
3082
+ /**
3083
+ * The source is temporarily unavailable: rate limit, server error or network
3084
+ * failure.
3085
+ */
3086
+ SOURCE_UNAVAILABLE = "SOURCE_UNAVAILABLE",
3087
+ /**
3088
+ * The content is age-restricted.
3089
+ */
3090
+ AGE_RESTRICTED = "AGE_RESTRICTED"
3091
+ }
3092
+ /**
3093
+ * The error raised by a plugin.
3094
+ *
3095
+ * It extends {@link DisTubeError}, so the code of the error is available with
3096
+ * `error.errorCode` and the error can be caught with `instanceof DisTubeError`.
3097
+ */
3098
+ declare class PluginError<T extends PluginErrorCode = PluginErrorCode> extends DisTubeError<T> {
3099
+ /**
3100
+ * Create a plugin error.
3101
+ * @param code - The error code
3102
+ * @param message - The message. It defaults to the one of the error code.
3103
+ * @param options - Optional options
3104
+ * @param options.cause - The original error that caused this one
3105
+ * @example
3106
+ * ```ts
3107
+ * throw new PluginError(PluginErrorCode.NOT_FOUND);
3108
+ * ```
3109
+ */
3110
+ constructor(code: T, message?: string, options?: {
3111
+ cause?: unknown;
3112
+ });
3113
+ /**
3114
+ * The name of the error, with its code.
3115
+ * @returns The name of the error, e.g. `PluginError [NOT_FOUND]`
3116
+ */
3117
+ get name(): string;
3118
+ }
3119
+
3120
+ /**
3121
+ * Format duration to string
3122
+ * @param sec - Duration in seconds
3123
+ * @returns The formatted duration, e.g. `01:23` or `01:02:03`
3124
+ */
3125
+ declare function formatDuration(sec: number): string;
3126
+ declare const SUPPORTED_PROTOCOL: readonly ["https:", "http:", "file:"];
3127
+ /**
3128
+ * Check if the string is an URL
3129
+ * @param input - input
3130
+ * @returns `true` when the input is an URL with a supported protocol
3131
+ */
3132
+ declare function isURL(input: any): input is `${(typeof SUPPORTED_PROTOCOL)[number]}//${string}`;
3133
+ /**
3134
+ * Check if the Client has enough intents to using DisTube
3135
+ * @param options - options
3136
+ * @returns Nothing
3137
+ * @throws {@link DisTubeError} When the `GuildVoiceStates` intent is missing
3138
+ */
3139
+ declare function checkIntents(options: ClientOptions): void;
3140
+ /**
3141
+ * Check if the voice channel is empty
3142
+ * @param voiceState - voiceState
3143
+ * @returns `true` when there is no human user in the voice channel of the state
3144
+ */
3145
+ declare function isVoiceChannelEmpty(voiceState: VoiceState): boolean;
3146
+ /**
3147
+ * Check if the value is a valid Discord snowflake.
3148
+ * @param id - The value to check
3149
+ * @returns `true` when the value is a valid snowflake
3150
+ */
3151
+ declare function isSnowflake(id: any): id is Snowflake;
3152
+ /**
3153
+ * Check if the value is a Discord.js guild member.
3154
+ * @param member - The value to check
3155
+ * @returns `true` when the value looks like a guild member
3156
+ */
3157
+ declare function isMemberInstance(member: any): member is GuildMember;
3158
+ /**
3159
+ * Check if the value is a Discord.js guild text based channel.
3160
+ * @param channel - The value to check
3161
+ * @returns `true` when the value looks like a guild text based channel
3162
+ */
3163
+ declare function isTextChannelInstance(channel: any): channel is GuildTextBasedChannel;
3164
+ /**
3165
+ * Check if the value is a Discord.js message.
3166
+ * @param message - The value to check
3167
+ * @returns `true` when the value looks like a message
3168
+ */
3169
+ declare function isMessageInstance(message: any): message is Message<true>;
3170
+ /**
3171
+ * Check if the value is a Discord.js voice based channel.
3172
+ * @param channel - The value to check
3173
+ * @returns `true` when the value looks like a voice based channel
3174
+ */
3175
+ declare function isSupportedVoiceChannel(channel: any): channel is VoiceBasedChannel;
3176
+ /**
3177
+ * Check if the value is a Discord.js guild.
3178
+ * @param guild - The value to check
3179
+ * @returns `true` when the value looks like a guild
3180
+ */
3181
+ declare function isGuildInstance(guild: any): guild is Guild;
3182
+ /**
3183
+ * Resolve a guild id from anything that can be resolved to a guild id.
3184
+ * @param resolvable - The value to resolve
3185
+ * @returns The id of the guild
3186
+ * @throws {@link DisTubeError} When the value cannot be resolved to a guild id
3187
+ */
3188
+ declare function resolveGuildId(resolvable: GuildIdResolvable): Snowflake;
3189
+ /**
3190
+ * Check if the value is a Discord.js client.
3191
+ * @param client - The value to check
3192
+ * @returns `true` when the value looks like a client
3193
+ */
3194
+ declare function isClientInstance(client: any): client is Client;
3195
+ /**
3196
+ * Check that an object does not have any key that is not in a source.
3197
+ * @param target - The object to check
3198
+ * @param source - The valid keys, or the object that holds them
3199
+ * @param sourceName - The name of the source, used in the error message
3200
+ * @returns Nothing
3201
+ * @throws {@link DisTubeError} When the target is not an object, or when it has
3202
+ * an invalid key
3203
+ */
3204
+ declare function checkInvalidKey(target: Record<string, any>, source: Record<string, any> | string[], sourceName: string): void;
3205
+ /**
3206
+ * Check if the value is a plain object.
3207
+ * @param obj - The value to check
3208
+ * @returns `true` when the value is an object and not an array nor `null`
3209
+ */
3210
+ declare function isObject(obj: any): obj is object;
3211
+ /**
3212
+ * The keys of a type, as an array.
3213
+ */
3214
+ type KeyOf<T> = T extends object ? (keyof T)[] : [];
3215
+ /**
3216
+ * Get the keys of an object.
3217
+ * @param obj - The object
3218
+ * @returns The keys of the object, or an empty array when it is not an object
3219
+ */
3220
+ declare function objectKeys<T>(obj: T): KeyOf<T>;
3221
+ /**
3222
+ * Check if the channel is age-restricted.
3223
+ * @param channel - The channel to check
3224
+ * @returns `true` when the channel is a NSFW channel
3225
+ */
3226
+ declare function isNsfwChannel(channel?: GuildTextBasedChannel): boolean;
3227
+ /**
3228
+ * The falsy values of JavaScript.
3229
+ */
3230
+ type Falsy = undefined | null | false | 0 | "";
3231
+ /**
3232
+ * Check if a value is not falsy.
3233
+ * @param x - The value to check
3234
+ * @returns `true` when the value is not falsy
3235
+ */
3236
+ declare const isTruthy: <T>(x: T | Falsy) => x is T;
3237
+ /**
3238
+ * Handle an error that was emitted through the special `"error"` event without
3239
+ * any listener.
3240
+ *
3241
+ * Node.js throws an `ERR_UNHANDLED_ERROR` in that situation, which crashes the
3242
+ * whole process. DisTube handles it gracefully instead.
3243
+ * @param error - The error
3244
+ * @param behavior - The behavior to apply. Defaults to `"log"`.
3245
+ * @returns Nothing
3246
+ * @throws The given error when the behavior is `"throw"`
3247
+ */
3248
+ declare function handleUnhandledError(error: Error, behavior?: UnhandledErrorBehavior): void;
3249
+ /**
3250
+ * Check that an encryption library is available.
3251
+ *
3252
+ * Discord encrypts the audio with DAVE, so a cipher is required to play it.
3253
+ * The `aes-256-gcm` cipher of Node.js is used when it is available, otherwise
3254
+ * one of the supported third-party libraries is used.
3255
+ * @returns `true` when an encryption library is available
3256
+ */
3257
+ declare const checkEncryptionLibraries: () => Promise<boolean>;
3258
+
3259
+ export { AUDIO_CHANNELS, AUDIO_SAMPLE_RATE, BaseManager, DEFAULT_VOLUME, DisTube, DisTubeBase, DisTubeError, DisTubeHandler, DisTubeStream, DisTubeVoice, DisTubeVoiceManager, Events, ExtractorPlugin, FilterManager, GuildIdManager, HTTP_REDIRECT_CODES, InfoExtractorPlugin, JOIN_TIMEOUT_MS, MAX_REDIRECT_DEPTH, Options, PlayableExtractorPlugin, Playlist, Plugin, PluginError, PluginErrorCode, PluginType, Queue, QueueManager, RECONNECT_MAX_ATTEMPTS, RECONNECT_TIMEOUT_MS, RepeatMode, STUCK_THRESHOLD_MS, SearchResult, SearchResultType, Song, StreamServer, TaskQueue, checkEncryptionLibraries, checkFFmpeg, checkIntents, checkInvalidKey, DisTube as default, defaultFilters, defaultOptions, formatDuration, handleUnhandledError, isClientInstance, isGuildInstance, isMemberInstance, isMessageInstance, isNsfwChannel, isObject, isSnowflake, isSupportedVoiceChannel, isTextChannelInstance, isTruthy, isURL, isVoiceChannelEmpty, objectKeys, resolveGuildId, version };
3260
+ export type { Awaitable, CustomPlaylistOptions, DisTubeEvents, DisTubeOptions, DisTubePlugin, DisTubeVoiceEvents, Disposable, FFmpegArg, FFmpegArgs, FFmpegOptions, Falsy, Filter, FilterResolvable, Filters, GuildIdResolvable, JumpOptions, KeyOf, PlayHandlerOptions, PlayOptions, PlaylistInfo, RelatedSong, ResolveOptions, ResolvePlaylistOptions, SearchOptions, SongInfo, StreamHandler, StreamOptions, StreamRequest, StreamResponse, StreamServerOptions, TypedDisTubeEvents, UnhandledErrorBehavior };