distube 4.0.0-dev.2 → 4.0.0-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +593 -8
  3. package/dist/index.js +2360 -22
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +2300 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +67 -40
  8. package/dist/DisTube.d.ts +0 -54
  9. package/dist/DisTube.d.ts.map +0 -1
  10. package/dist/DisTube.js +0 -279
  11. package/dist/DisTube.js.map +0 -1
  12. package/dist/constant.d.ts +0 -27
  13. package/dist/constant.d.ts.map +0 -1
  14. package/dist/constant.js +0 -47
  15. package/dist/constant.js.map +0 -1
  16. package/dist/core/DisTubeBase.d.ts +0 -14
  17. package/dist/core/DisTubeBase.d.ts.map +0 -1
  18. package/dist/core/DisTubeBase.js +0 -31
  19. package/dist/core/DisTubeBase.js.map +0 -1
  20. package/dist/core/DisTubeHandler.d.ts +0 -27
  21. package/dist/core/DisTubeHandler.d.ts.map +0 -1
  22. package/dist/core/DisTubeHandler.js +0 -230
  23. package/dist/core/DisTubeHandler.js.map +0 -1
  24. package/dist/core/DisTubeOptions.d.ts +0 -23
  25. package/dist/core/DisTubeOptions.d.ts.map +0 -1
  26. package/dist/core/DisTubeOptions.js +0 -90
  27. package/dist/core/DisTubeOptions.js.map +0 -1
  28. package/dist/core/DisTubeStream.d.ts +0 -19
  29. package/dist/core/DisTubeStream.d.ts.map +0 -1
  30. package/dist/core/DisTubeStream.js +0 -72
  31. package/dist/core/DisTubeStream.js.map +0 -1
  32. package/dist/core/index.d.ts +0 -7
  33. package/dist/core/index.d.ts.map +0 -1
  34. package/dist/core/index.js +0 -19
  35. package/dist/core/index.js.map +0 -1
  36. package/dist/core/manager/BaseManager.d.ts +0 -7
  37. package/dist/core/manager/BaseManager.d.ts.map +0 -1
  38. package/dist/core/manager/BaseManager.js +0 -16
  39. package/dist/core/manager/BaseManager.js.map +0 -1
  40. package/dist/core/manager/FilterManager.d.ts +0 -16
  41. package/dist/core/manager/FilterManager.d.ts.map +0 -1
  42. package/dist/core/manager/FilterManager.js +0 -88
  43. package/dist/core/manager/FilterManager.js.map +0 -1
  44. package/dist/core/manager/GuildIdManager.d.ts +0 -9
  45. package/dist/core/manager/GuildIdManager.d.ts.map +0 -1
  46. package/dist/core/manager/GuildIdManager.js +0 -25
  47. package/dist/core/manager/GuildIdManager.js.map +0 -1
  48. package/dist/core/manager/QueueManager.d.ts +0 -11
  49. package/dist/core/manager/QueueManager.d.ts.map +0 -1
  50. package/dist/core/manager/QueueManager.js +0 -172
  51. package/dist/core/manager/QueueManager.js.map +0 -1
  52. package/dist/core/manager/index.d.ts +0 -5
  53. package/dist/core/manager/index.d.ts.map +0 -1
  54. package/dist/core/manager/index.js +0 -17
  55. package/dist/core/manager/index.js.map +0 -1
  56. package/dist/core/voice/DisTubeVoice.d.ts +0 -32
  57. package/dist/core/voice/DisTubeVoice.d.ts.map +0 -1
  58. package/dist/core/voice/DisTubeVoice.js +0 -190
  59. package/dist/core/voice/DisTubeVoice.js.map +0 -1
  60. package/dist/core/voice/DisTubeVoiceManager.d.ts +0 -10
  61. package/dist/core/voice/DisTubeVoiceManager.d.ts.map +0 -1
  62. package/dist/core/voice/DisTubeVoiceManager.js +0 -36
  63. package/dist/core/voice/DisTubeVoiceManager.js.map +0 -1
  64. package/dist/core/voice/index.d.ts +0 -3
  65. package/dist/core/voice/index.d.ts.map +0 -1
  66. package/dist/core/voice/index.js +0 -15
  67. package/dist/core/voice/index.js.map +0 -1
  68. package/dist/index.d.ts.map +0 -1
  69. package/dist/plugin/http.d.ts +0 -10
  70. package/dist/plugin/http.d.ts.map +0 -1
  71. package/dist/plugin/http.js +0 -18
  72. package/dist/plugin/http.js.map +0 -1
  73. package/dist/plugin/https.d.ts +0 -19
  74. package/dist/plugin/https.d.ts.map +0 -1
  75. package/dist/plugin/https.js +0 -47
  76. package/dist/plugin/https.js.map +0 -1
  77. package/dist/plugin/index.d.ts +0 -3
  78. package/dist/plugin/index.d.ts.map +0 -1
  79. package/dist/plugin/index.js +0 -15
  80. package/dist/plugin/index.js.map +0 -1
  81. package/dist/struct/CustomPlugin.d.ts +0 -10
  82. package/dist/struct/CustomPlugin.d.ts.map +0 -1
  83. package/dist/struct/CustomPlugin.js +0 -16
  84. package/dist/struct/CustomPlugin.js.map +0 -1
  85. package/dist/struct/DisTubeError.d.ts +0 -55
  86. package/dist/struct/DisTubeError.d.ts.map +0 -1
  87. package/dist/struct/DisTubeError.js +0 -64
  88. package/dist/struct/DisTubeError.js.map +0 -1
  89. package/dist/struct/ExtractorPlugin.d.ts +0 -13
  90. package/dist/struct/ExtractorPlugin.d.ts.map +0 -1
  91. package/dist/struct/ExtractorPlugin.js +0 -16
  92. package/dist/struct/ExtractorPlugin.js.map +0 -1
  93. package/dist/struct/Playlist.d.ts +0 -25
  94. package/dist/struct/Playlist.d.ts.map +0 -1
  95. package/dist/struct/Playlist.js +0 -77
  96. package/dist/struct/Playlist.js.map +0 -1
  97. package/dist/struct/Plugin.d.ts +0 -17
  98. package/dist/struct/Plugin.d.ts.map +0 -1
  99. package/dist/struct/Plugin.js +0 -37
  100. package/dist/struct/Plugin.js.map +0 -1
  101. package/dist/struct/Queue.d.ts +0 -49
  102. package/dist/struct/Queue.d.ts.map +0 -1
  103. package/dist/struct/Queue.js +0 -272
  104. package/dist/struct/Queue.js.map +0 -1
  105. package/dist/struct/SearchResult.d.ts +0 -19
  106. package/dist/struct/SearchResult.d.ts.map +0 -1
  107. package/dist/struct/SearchResult.js +0 -30
  108. package/dist/struct/SearchResult.js.map +0 -1
  109. package/dist/struct/Song.d.ts +0 -43
  110. package/dist/struct/Song.d.ts.map +0 -1
  111. package/dist/struct/Song.js +0 -138
  112. package/dist/struct/Song.js.map +0 -1
  113. package/dist/struct/TaskQueue.d.ts +0 -8
  114. package/dist/struct/TaskQueue.d.ts.map +0 -1
  115. package/dist/struct/TaskQueue.js +0 -39
  116. package/dist/struct/TaskQueue.js.map +0 -1
  117. package/dist/struct/index.d.ts +0 -10
  118. package/dist/struct/index.d.ts.map +0 -1
  119. package/dist/struct/index.js +0 -22
  120. package/dist/struct/index.js.map +0 -1
  121. package/dist/tsconfig.tsbuildinfo +0 -1
  122. package/dist/type.d.ts +0 -104
  123. package/dist/type.d.ts.map +0 -1
  124. package/dist/type.js +0 -3
  125. package/dist/type.js.map +0 -1
  126. package/dist/util.d.ts +0 -22
  127. package/dist/util.d.ts.map +0 -1
  128. package/dist/util.js +0 -189
  129. package/dist/util.js.map +0 -1
package/README.md CHANGED
@@ -23,7 +23,7 @@ A Discord.js module to simplify your music commands and play songs with audio fi
23
23
 
24
24
  ## Features
25
25
 
26
- - Build on `@discordjs/voice`
26
+ - Based on `@discordjs/voice`
27
27
  - Easy to use and customize
28
28
  - Support YouTube and audio link
29
29
  - Audio filters (bassboost, nightcore, vaporwave,...)
package/dist/index.d.ts CHANGED
@@ -1,8 +1,593 @@
1
- export * from "./type";
2
- export * from "./constant";
3
- export * from "./struct";
4
- export * from "./util";
5
- export * from "./core";
6
- export * from "./plugin";
7
- export { DisTube, DisTube as default, version } from "./DisTube";
8
- //# sourceMappingURL=index.d.ts.map
1
+ import ytdl from '@distube/ytdl-core';
2
+ import * as discord_js from 'discord.js';
3
+ import { GuildTextBasedChannel, Message, Snowflake, VoiceBasedChannel, VoiceState, Guild, GuildMember, Interaction, User, Client, Collection, ClientOptions } from 'discord.js';
4
+ import ytpl from '@distube/ytpl';
5
+ import { Video, Playlist as Playlist$1 } from '@distube/ytsr';
6
+ import { TypedEmitter } from 'tiny-typed-emitter';
7
+ import { FFmpeg } from 'prism-media';
8
+ import { StreamType, AudioPlayer, VoiceConnection, AudioResource, VoiceConnectionStatus, AudioPlayerStatus } from '@discordjs/voice';
9
+ import * as _discordjs_collection from '@discordjs/collection';
10
+ import { EventEmitter } from 'node:events';
11
+ import https from 'https';
12
+ import http from 'http';
13
+
14
+ declare type Awaitable<T = any> = T | PromiseLike<T>;
15
+ declare type DisTubeVoiceEvents = {
16
+ disconnect: (error?: Error) => Awaitable;
17
+ error: (error: Error) => Awaitable;
18
+ finish: () => Awaitable;
19
+ };
20
+ declare type DisTubeEvents = {
21
+ error: (channel: GuildTextBasedChannel | undefined, error: Error) => Awaitable;
22
+ addList: (queue: Queue, playlist: Playlist) => Awaitable;
23
+ addSong: (queue: Queue, song: Song) => Awaitable;
24
+ playSong: (queue: Queue, song: Song) => Awaitable;
25
+ finishSong: (queue: Queue, song: Song) => Awaitable;
26
+ empty: (queue: Queue) => Awaitable;
27
+ finish: (queue: Queue) => Awaitable;
28
+ initQueue: (queue: Queue) => Awaitable;
29
+ noRelated: (queue: Queue) => Awaitable;
30
+ disconnect: (queue: Queue) => Awaitable;
31
+ deleteQueue: (queue: Queue) => Awaitable;
32
+ searchCancel: (message: Message<true>, query: string) => Awaitable;
33
+ searchNoResult: (message: Message<true>, query: string) => Awaitable;
34
+ searchDone: (message: Message<true>, answer: Message<true>, query: string) => Awaitable;
35
+ searchInvalidAnswer: (message: Message<true>, answer: Message<true>, query: string) => Awaitable;
36
+ searchResult: (message: Message<true>, results: SearchResult[], query: string) => Awaitable;
37
+ };
38
+ interface Filter {
39
+ name: string;
40
+ value: string;
41
+ }
42
+ declare type FilterResolvable = string | Filter;
43
+ declare type Filters = Record<string, string>;
44
+ interface DisTubeOptions {
45
+ plugins?: (CustomPlugin | ExtractorPlugin)[];
46
+ emitNewSongOnly?: boolean;
47
+ leaveOnFinish?: boolean;
48
+ leaveOnStop?: boolean;
49
+ leaveOnEmpty?: boolean;
50
+ emptyCooldown?: number;
51
+ savePreviousSongs?: boolean;
52
+ searchSongs?: number;
53
+ searchCooldown?: number;
54
+ youtubeCookie?: string;
55
+ youtubeIdentityToken?: string;
56
+ customFilters?: Filters;
57
+ ytdlOptions?: ytdl.downloadOptions;
58
+ nsfw?: boolean;
59
+ emitAddSongWhenCreatingQueue?: boolean;
60
+ emitAddListWhenCreatingQueue?: boolean;
61
+ }
62
+ declare type GuildIdResolvable = Queue | DisTubeVoice | Snowflake | Message | GuildTextBasedChannel | VoiceBasedChannel | VoiceState | Guild | GuildMember | Interaction | string;
63
+ interface OtherSongInfo {
64
+ src?: string;
65
+ id?: string;
66
+ title?: string;
67
+ name?: string;
68
+ is_live?: boolean;
69
+ isLive?: boolean;
70
+ _duration_raw?: string | number;
71
+ duration?: string | number;
72
+ webpage_url?: string;
73
+ url: string;
74
+ thumbnail?: string;
75
+ related?: RelatedSong[];
76
+ view_count?: string | number;
77
+ views?: string | number;
78
+ like_count?: string | number;
79
+ likes?: string | number;
80
+ dislike_count?: string | number;
81
+ dislikes?: string | number;
82
+ repost_count?: string | number;
83
+ reposts?: string | number;
84
+ uploader?: string | {
85
+ name: string;
86
+ url: string;
87
+ };
88
+ uploader_url?: string;
89
+ age_limit?: string | number;
90
+ chapters?: Chapter[];
91
+ age_restricted?: boolean;
92
+ }
93
+ interface Chapter {
94
+ title: string;
95
+ start_time: number;
96
+ }
97
+ interface PlaylistInfo {
98
+ source: string;
99
+ member?: GuildMember;
100
+ user?: User;
101
+ songs: Song[];
102
+ name?: string;
103
+ url?: string;
104
+ thumbnail?: string;
105
+ }
106
+ declare type RelatedSong = Omit<Song, "related">;
107
+ declare type PlayHandlerOptions = {
108
+ skip?: boolean;
109
+ position?: number;
110
+ textChannel?: GuildTextBasedChannel;
111
+ };
112
+ interface PlayOptions extends PlayHandlerOptions, ResolveOptions<any> {
113
+ message?: Message;
114
+ }
115
+ interface ResolveOptions<T = unknown> {
116
+ member?: GuildMember;
117
+ metadata?: T;
118
+ }
119
+ interface ResolvePlaylistOptions<T = unknown> extends ResolveOptions<T> {
120
+ source?: string;
121
+ }
122
+ interface CustomPlaylistOptions {
123
+ member?: GuildMember;
124
+ properties?: Record<string, any>;
125
+ parallel?: boolean;
126
+ metadata?: any;
127
+ }
128
+ declare enum RepeatMode {
129
+ DISABLED = 0,
130
+ SONG = 1,
131
+ QUEUE = 2
132
+ }
133
+ declare enum PluginType {
134
+ CUSTOM = "custom",
135
+ EXTRACTOR = "extractor"
136
+ }
137
+ declare enum SearchResultType {
138
+ VIDEO = "video",
139
+ PLAYLIST = "playlist"
140
+ }
141
+
142
+ declare const defaultFilters: Filters;
143
+ declare const defaultOptions: {
144
+ plugins: never[];
145
+ emitNewSongOnly: boolean;
146
+ leaveOnEmpty: boolean;
147
+ leaveOnFinish: boolean;
148
+ leaveOnStop: boolean;
149
+ savePreviousSongs: boolean;
150
+ searchSongs: number;
151
+ ytdlOptions: {};
152
+ searchCooldown: number;
153
+ emptyCooldown: number;
154
+ nsfw: boolean;
155
+ emitAddSongWhenCreatingQueue: boolean;
156
+ emitAddListWhenCreatingQueue: boolean;
157
+ joinNewVoiceChannel: boolean;
158
+ };
159
+
160
+ declare const ERROR_MESSAGES: {
161
+ INVALID_TYPE: (expected: (number | string) | readonly (number | string)[], got: any, name?: string | undefined) => string;
162
+ NUMBER_COMPARE: (name: string, expected: string, value: number) => string;
163
+ EMPTY_ARRAY: (name: string) => string;
164
+ EMPTY_FILTERED_ARRAY: (name: string, type: string) => string;
165
+ EMPTY_STRING: (name: string) => string;
166
+ INVALID_KEY: (obj: string, key: string) => string;
167
+ MISSING_KEY: (obj: string, key: string) => string;
168
+ MISSING_KEYS: (obj: string, key: string[], all: boolean) => string;
169
+ MISSING_INTENTS: (i: string) => string;
170
+ DISABLED_OPTION: (o: string) => string;
171
+ ENABLED_OPTION: (o: string) => string;
172
+ NOT_IN_VOICE: string;
173
+ VOICE_FULL: string;
174
+ VOICE_CONNECT_FAILED: (s: number) => string;
175
+ VOICE_MISSING_PERMS: string;
176
+ VOICE_RECONNECT_FAILED: string;
177
+ VOICE_DIFFERENT_GUILD: string;
178
+ NO_QUEUE: string;
179
+ QUEUE_EXIST: string;
180
+ PAUSED: string;
181
+ RESUMED: string;
182
+ NO_PREVIOUS: string;
183
+ NO_UP_NEXT: string;
184
+ NO_SONG_POSITION: string;
185
+ NO_PLAYING: string;
186
+ NO_RESULT: string;
187
+ NO_RELATED: string;
188
+ CANNOT_PLAY_RELATED: string;
189
+ UNAVAILABLE_VIDEO: string;
190
+ UNPLAYABLE_FORMATS: string;
191
+ NON_NSFW: string;
192
+ NOT_SUPPORTED_URL: string;
193
+ CANNOT_RESOLVE_SONG: (t: any) => string;
194
+ NO_VALID_SONG: string;
195
+ EMPTY_FILTERED_PLAYLIST: string;
196
+ EMPTY_PLAYLIST: string;
197
+ };
198
+ declare type ErrorMessage = typeof ERROR_MESSAGES;
199
+ declare type ErrorCode = keyof ErrorMessage;
200
+ declare type StaticErrorCode = {
201
+ [K in ErrorCode]-?: ErrorMessage[K] extends string ? K : never;
202
+ }[ErrorCode];
203
+ declare type TemplateErrorCode = Exclude<keyof typeof ERROR_MESSAGES, StaticErrorCode>;
204
+ declare class DisTubeError<T extends string> extends Error {
205
+ errorCode: string;
206
+ constructor(code: StaticErrorCode);
207
+ constructor(code: T extends TemplateErrorCode ? T : never, ...args: Parameters<ErrorMessage[typeof code]>);
208
+ constructor(code: TemplateErrorCode, _: never);
209
+ constructor(code: T extends ErrorCode ? "This is built-in error code" : T, message: string);
210
+ get name(): string;
211
+ get code(): string;
212
+ }
213
+
214
+ declare class TaskQueue {
215
+ #private;
216
+ queuing(resolveInfo?: boolean): Promise<void>;
217
+ resolve(): void;
218
+ get remaining(): number;
219
+ get hasResolveTask(): boolean;
220
+ }
221
+
222
+ declare class Playlist<T = unknown> implements PlaylistInfo {
223
+ #private;
224
+ source: string;
225
+ songs: Song[];
226
+ name: string;
227
+ url?: string;
228
+ thumbnail?: string;
229
+ [x: string]: any;
230
+ constructor(playlist: Song[] | ytpl.result | PlaylistInfo, options?: {
231
+ member?: GuildMember;
232
+ properties?: Record<string, any>;
233
+ metadata?: T;
234
+ });
235
+ get duration(): number;
236
+ get formattedDuration(): string;
237
+ get member(): GuildMember | undefined;
238
+ set member(member: GuildMember | undefined);
239
+ get user(): discord_js.User | undefined;
240
+ get metadata(): T;
241
+ set metadata(metadata: T);
242
+ }
243
+
244
+ declare class SearchResult {
245
+ source: "youtube";
246
+ type: SearchResultType;
247
+ id: string;
248
+ name: string;
249
+ url: string;
250
+ views?: number;
251
+ isLive?: boolean;
252
+ duration?: number;
253
+ formattedDuration?: string;
254
+ thumbnail?: string;
255
+ uploader: {
256
+ name?: string;
257
+ url?: string;
258
+ };
259
+ constructor(info: Video | Playlist$1);
260
+ }
261
+
262
+ declare class Song<T = unknown> {
263
+ #private;
264
+ source: string;
265
+ formats?: ytdl.videoFormat[];
266
+ id?: string;
267
+ name?: string;
268
+ isLive: boolean;
269
+ duration: number;
270
+ formattedDuration?: string;
271
+ url: string;
272
+ streamURL?: string;
273
+ thumbnail?: string;
274
+ related: RelatedSong[];
275
+ views: number;
276
+ likes: number;
277
+ dislikes: number;
278
+ uploader: {
279
+ name?: string;
280
+ url?: string;
281
+ };
282
+ age_restricted: boolean;
283
+ chapters: Chapter[];
284
+ reposts: number;
285
+ constructor(info: ytdl.videoInfo | SearchResult | OtherSongInfo | ytdl.relatedVideo | RelatedSong, options?: {
286
+ member?: GuildMember;
287
+ source?: string;
288
+ metadata?: T;
289
+ });
290
+ _patchYouTube(i: ytdl.videoInfo | SearchResult): void;
291
+ _patchOther(info: OtherSongInfo): void;
292
+ get playlist(): Playlist | undefined;
293
+ set playlist(playlist: Playlist | undefined);
294
+ get member(): GuildMember | undefined;
295
+ set member(member: GuildMember | undefined);
296
+ get user(): discord_js.User | undefined;
297
+ get metadata(): T;
298
+ set metadata(metadata: T);
299
+ }
300
+
301
+ declare class Options {
302
+ #private;
303
+ plugins: (CustomPlugin | ExtractorPlugin)[];
304
+ emitNewSongOnly: boolean;
305
+ leaveOnFinish: boolean;
306
+ leaveOnStop: boolean;
307
+ leaveOnEmpty: boolean;
308
+ emptyCooldown: number;
309
+ savePreviousSongs: boolean;
310
+ searchSongs: number;
311
+ searchCooldown: number;
312
+ youtubeCookie?: string;
313
+ youtubeIdentityToken?: string;
314
+ customFilters?: Filters;
315
+ ytdlOptions: ytdl.getInfoOptions;
316
+ nsfw: boolean;
317
+ emitAddSongWhenCreatingQueue: boolean;
318
+ emitAddListWhenCreatingQueue: boolean;
319
+ joinNewVoiceChannel: boolean;
320
+ constructor(options: DisTubeOptions);
321
+ }
322
+
323
+ declare abstract class DisTubeBase {
324
+ distube: DisTube;
325
+ constructor(distube: DisTube);
326
+ emit(eventName: keyof DisTubeEvents, ...args: any): boolean;
327
+ emitError(error: Error, channel?: GuildTextBasedChannel): void;
328
+ get queues(): QueueManager;
329
+ get voices(): DisTubeVoiceManager;
330
+ get client(): Client;
331
+ get options(): Options;
332
+ get handler(): DisTubeHandler;
333
+ }
334
+
335
+ interface StreamOptions {
336
+ seek?: number;
337
+ ffmpegArgs?: string[];
338
+ isLive?: boolean;
339
+ }
340
+ declare const chooseBestVideoFormat: (formats: ytdl.videoFormat[], isLive?: boolean) => ytdl.videoFormat;
341
+ declare class DisTubeStream {
342
+ static YouTube(formats: ytdl.videoFormat[] | undefined, options?: StreamOptions): DisTubeStream;
343
+ static DirectLink(url: string, options?: StreamOptions): DisTubeStream;
344
+ type: StreamType.Raw;
345
+ stream: FFmpeg;
346
+ url: string;
347
+ constructor(url: string, options: StreamOptions);
348
+ }
349
+
350
+ declare abstract class BaseManager<V> extends DisTubeBase {
351
+ collection: Collection<string, V>;
352
+ get size(): number;
353
+ }
354
+
355
+ declare abstract class GuildIdManager<V> extends BaseManager<V> {
356
+ add(idOrInstance: GuildIdResolvable, data: V): this | _discordjs_collection.Collection<string, V>;
357
+ get(idOrInstance: GuildIdResolvable): V | undefined;
358
+ remove(idOrInstance: GuildIdResolvable): boolean;
359
+ has(idOrInstance: GuildIdResolvable): boolean;
360
+ }
361
+
362
+ declare class QueueManager extends GuildIdManager<Queue> {
363
+ #private;
364
+ create(channel: VoiceBasedChannel, song: Song[] | Song, textChannel?: GuildTextBasedChannel): Promise<Queue | true>;
365
+ createStream(queue: Queue): DisTubeStream;
366
+ playSong(queue: Queue): Promise<boolean>;
367
+ }
368
+
369
+ declare class FilterManager extends BaseManager<FilterResolvable> {
370
+ #private;
371
+ queue: Queue;
372
+ constructor(queue: Queue);
373
+ add(filterOrFilters: FilterResolvable | FilterResolvable[], override?: boolean): this;
374
+ clear(): this;
375
+ set(filters: FilterResolvable[]): this;
376
+ remove(filterOrFilters: FilterResolvable | FilterResolvable[]): this;
377
+ has(filter: FilterResolvable): boolean;
378
+ get names(): string[];
379
+ get values(): string[];
380
+ toString(): string;
381
+ }
382
+
383
+ declare class DisTubeVoice extends TypedEmitter<DisTubeVoiceEvents> {
384
+ #private;
385
+ readonly id: Snowflake;
386
+ readonly voices: DisTubeVoiceManager;
387
+ readonly audioPlayer: AudioPlayer;
388
+ connection: VoiceConnection;
389
+ audioResource?: AudioResource;
390
+ emittedError: boolean;
391
+ isDisconnected: boolean;
392
+ constructor(voiceManager: DisTubeVoiceManager, channel: VoiceBasedChannel);
393
+ get channel(): VoiceBasedChannel;
394
+ set channel(channel: VoiceBasedChannel);
395
+ join(channel?: VoiceBasedChannel): Promise<DisTubeVoice>;
396
+ leave(error?: Error): void;
397
+ stop(force?: boolean): void;
398
+ play(stream: DisTubeStream): void;
399
+ set volume(volume: number);
400
+ get volume(): number;
401
+ get playbackDuration(): number;
402
+ pause(): void;
403
+ unpause(): void;
404
+ get selfDeaf(): boolean;
405
+ get selfMute(): boolean;
406
+ setSelfDeaf(selfDeaf: boolean): boolean;
407
+ setSelfMute(selfMute: boolean): boolean;
408
+ get voiceState(): VoiceState | undefined;
409
+ }
410
+
411
+ declare class DisTubeVoiceManager extends GuildIdManager<DisTubeVoice> {
412
+ create(channel: VoiceBasedChannel): DisTubeVoice;
413
+ join(channel: VoiceBasedChannel): Promise<DisTubeVoice>;
414
+ leave(guild: GuildIdResolvable): void;
415
+ }
416
+
417
+ declare class DisTubeHandler extends DisTubeBase {
418
+ constructor(distube: DisTube);
419
+ get ytdlOptions(): ytdl.getInfoOptions;
420
+ getYouTubeInfo(url: string, basic?: boolean): Promise<ytdl.videoInfo>;
421
+ resolve<T = unknown>(song: Song<T>, options?: Omit<ResolveOptions, "metadata">): Promise<Song<T>>;
422
+ resolve<T = unknown>(song: Playlist<T>, options?: Omit<ResolveOptions, "metadata">): Promise<Playlist<T>>;
423
+ resolve<T = unknown>(song: string | SearchResult, options?: ResolveOptions<T>): Promise<Song<T> | Playlist<T>>;
424
+ resolve<T = unknown>(song: ytdl.videoInfo | OtherSongInfo | ytdl.relatedVideo, options?: ResolveOptions<T>): Promise<Song<T>>;
425
+ resolve<T = unknown>(song: Playlist, options: ResolveOptions<T>): Promise<Playlist<T>>;
426
+ resolve(song: string | ytdl.videoInfo | Song | Playlist | SearchResult | OtherSongInfo | ytdl.relatedVideo, options?: ResolveOptions): Promise<Song | Playlist>;
427
+ resolvePlaylist<T = unknown>(playlist: Playlist<T> | Song<T>[] | string, options?: Omit<ResolvePlaylistOptions, "metadata">): Promise<Playlist<T>>;
428
+ resolvePlaylist<T = undefined>(playlist: Playlist | Song[] | string, options: ResolvePlaylistOptions<T>): Promise<Playlist<T>>;
429
+ resolvePlaylist(playlist: Playlist | Song[] | string, options?: ResolvePlaylistOptions): Promise<Playlist>;
430
+ searchSong(message: Message<true>, query: string): Promise<SearchResult | null>;
431
+ createSearchMessageCollector<R extends SearchResult | Song | Playlist>(message: Message<true>, results: Array<R>, query?: string): Promise<R | null>;
432
+ playPlaylist(voiceChannel: VoiceBasedChannel, playlist: Playlist, options?: PlayHandlerOptions): Promise<void>;
433
+ playSong(voiceChannel: VoiceBasedChannel, song: Song, options?: PlayHandlerOptions): Promise<void>;
434
+ }
435
+
436
+ declare class Queue extends DisTubeBase {
437
+ #private;
438
+ readonly id: Snowflake;
439
+ voice: DisTubeVoice;
440
+ songs: Song[];
441
+ previousSongs: Song[];
442
+ stopped: boolean;
443
+ _next: boolean;
444
+ _prev: boolean;
445
+ playing: boolean;
446
+ paused: boolean;
447
+ repeatMode: RepeatMode;
448
+ autoplay: boolean;
449
+ beginTime: number;
450
+ textChannel?: GuildTextBasedChannel;
451
+ _emptyTimeout?: NodeJS.Timeout;
452
+ clientMember: GuildMember;
453
+ _taskQueue: TaskQueue;
454
+ _listeners?: DisTubeVoiceEvents;
455
+ constructor(distube: DisTube, voice: DisTubeVoice, song: Song | Song[], textChannel?: GuildTextBasedChannel);
456
+ get filters(): FilterManager;
457
+ get formattedDuration(): string;
458
+ get duration(): number;
459
+ get currentTime(): number;
460
+ get formattedCurrentTime(): string;
461
+ get voiceChannel(): discord_js.VoiceBasedChannel | null;
462
+ get volume(): number;
463
+ set volume(value: number);
464
+ addToQueue(song: Song | Song[], position?: number): Queue;
465
+ pause(): Queue;
466
+ resume(): Queue;
467
+ setVolume(percent: number): Queue;
468
+ skip(): Promise<Song>;
469
+ previous(): Promise<Song>;
470
+ shuffle(): Promise<Queue>;
471
+ jump(position: number): Promise<Song>;
472
+ setRepeatMode(mode?: RepeatMode): RepeatMode;
473
+ seek(time: number): Queue;
474
+ addRelatedSong(): Promise<Song>;
475
+ stop(): Promise<void>;
476
+ remove(): void;
477
+ toggleAutoplay(): boolean;
478
+ }
479
+
480
+ declare abstract class Plugin {
481
+ abstract type: PluginType;
482
+ distube: DisTube;
483
+ init(distube: DisTube): void;
484
+ emit(eventName: keyof DisTubeEvents, ...args: any): boolean;
485
+ emitError(error: Error, channel?: GuildTextBasedChannel): void;
486
+ get queues(): QueueManager;
487
+ get voices(): DisTubeVoiceManager;
488
+ get client(): Client;
489
+ get options(): Options;
490
+ get handler(): DisTubeHandler;
491
+ validate(_string: string): Awaitable<boolean>;
492
+ getStreamURL(url: string): Awaitable<string>;
493
+ getRelatedSongs(_url: string): Awaitable<RelatedSong[]>;
494
+ }
495
+
496
+ declare abstract class CustomPlugin extends Plugin {
497
+ readonly type = PluginType.CUSTOM;
498
+ abstract play(voiceChannel: VoiceBasedChannel, song: string, options: PlayOptions): Awaitable<void>;
499
+ }
500
+
501
+ declare abstract class ExtractorPlugin extends Plugin {
502
+ readonly type = PluginType.EXTRACTOR;
503
+ abstract resolve<T = unknown>(url: string, options: {
504
+ member?: GuildMember;
505
+ metadata?: T;
506
+ }): Awaitable<Song<T> | Playlist<T>>;
507
+ }
508
+
509
+ declare function formatDuration(sec: number): string;
510
+ declare function toSecond(input: any): number;
511
+ declare function parseNumber(input: any): number;
512
+ declare function isURL(input: any): input is `http://${string}` | `https://${string}`;
513
+ declare function checkIntents(options: ClientOptions): void;
514
+ declare function isVoiceChannelEmpty(voiceState: VoiceState): boolean;
515
+ declare function isSnowflake(id: any): id is Snowflake;
516
+ declare function isMemberInstance(member: any): member is GuildMember;
517
+ declare function isTextChannelInstance(channel: any): channel is GuildTextBasedChannel;
518
+ declare function isMessageInstance(message: any): message is Message<true>;
519
+ declare function isSupportedVoiceChannel(channel: any): channel is VoiceBasedChannel;
520
+ declare function isGuildInstance(guild: any): guild is Guild;
521
+ declare function resolveGuildId(resolvable: GuildIdResolvable): Snowflake;
522
+ declare function isClientInstance(client: any): client is Client;
523
+ declare function checkInvalidKey(target: Record<string, any>, source: Record<string, any> | string[], sourceName: string): void;
524
+ declare function entersState<T extends VoiceConnection | AudioPlayer>(target: T, status: T extends VoiceConnection ? VoiceConnectionStatus : AudioPlayerStatus, maxTime: number): Promise<EventEmitter | T>;
525
+ declare function isObject(obj: any): obj is object;
526
+ declare function isRecord(obj: any): obj is Record<string, unknown>;
527
+
528
+ declare class HTTPPlugin extends ExtractorPlugin {
529
+ validate(url: string): Promise<boolean>;
530
+ resolve(url: string, options?: {
531
+ member?: GuildMember;
532
+ metadata?: any;
533
+ }): Promise<Song<any>>;
534
+ }
535
+
536
+ declare const getResponseHeaders: (httpModule: typeof http | typeof https, url: string) => Promise<http.IncomingHttpHeaders>;
537
+ declare const validateAudioURL: (httpModule: typeof http | typeof https, protocol: string, url: string) => Promise<boolean>;
538
+ declare const resolveHttpSong: (url: string, options: {
539
+ source: "http" | "https";
540
+ member?: GuildMember;
541
+ metadata?: any;
542
+ }) => Promise<Song<any>>;
543
+ declare class HTTPSPlugin extends ExtractorPlugin {
544
+ validate(url: string): Promise<boolean>;
545
+ resolve(url: string, options?: {
546
+ member?: GuildMember;
547
+ metadata?: any;
548
+ }): Promise<Song<any>>;
549
+ }
550
+
551
+ declare const version: string;
552
+ declare class DisTube extends TypedEmitter<DisTubeEvents> {
553
+ readonly handler: DisTubeHandler;
554
+ readonly options: Options;
555
+ readonly client: Client;
556
+ readonly queues: QueueManager;
557
+ readonly voices: DisTubeVoiceManager;
558
+ readonly extractorPlugins: ExtractorPlugin[];
559
+ readonly customPlugins: CustomPlugin[];
560
+ readonly filters: Filters;
561
+ constructor(client: Client, otp?: DisTubeOptions);
562
+ static get version(): string;
563
+ get version(): string;
564
+ play(voiceChannel: VoiceBasedChannel, song: string | Song | SearchResult | Playlist, options?: PlayOptions): Promise<void>;
565
+ createCustomPlaylist(songs: (string | Song | SearchResult)[], options?: {
566
+ member?: GuildMember;
567
+ properties?: Record<string, any>;
568
+ parallel?: boolean;
569
+ metadata?: any;
570
+ }): Promise<Playlist>;
571
+ search(string: string, options?: {
572
+ type?: "video" | "playlist";
573
+ limit?: number;
574
+ safeSearch?: boolean;
575
+ retried?: boolean;
576
+ }): Promise<Array<SearchResult>>;
577
+ getQueue(guild: GuildIdResolvable): Queue | undefined;
578
+ pause(guild: GuildIdResolvable): Queue;
579
+ resume(guild: GuildIdResolvable): Queue;
580
+ stop(guild: GuildIdResolvable): Promise<void>;
581
+ setVolume(guild: GuildIdResolvable, percent: number): Queue;
582
+ skip(guild: GuildIdResolvable): Promise<Song>;
583
+ previous(guild: GuildIdResolvable): Promise<Song>;
584
+ shuffle(guild: GuildIdResolvable): Promise<Queue>;
585
+ jump(guild: GuildIdResolvable, num: number): Promise<Song>;
586
+ setRepeatMode(guild: GuildIdResolvable, mode?: number): number;
587
+ toggleAutoplay(guild: GuildIdResolvable): boolean;
588
+ addRelatedSong(guild: GuildIdResolvable): Promise<Song>;
589
+ seek(guild: GuildIdResolvable, time: number): Queue;
590
+ emitError(error: Error, channel?: GuildTextBasedChannel): void;
591
+ }
592
+
593
+ export { Awaitable, BaseManager, Chapter, CustomPlaylistOptions, CustomPlugin, DisTube, DisTubeBase, DisTubeError, DisTubeEvents, DisTubeHandler, DisTubeOptions, DisTubeStream, DisTubeVoice, DisTubeVoiceEvents, DisTubeVoiceManager, ExtractorPlugin, Filter, FilterManager, FilterResolvable, Filters, GuildIdManager, GuildIdResolvable, HTTPPlugin, HTTPSPlugin, Options, OtherSongInfo, PlayHandlerOptions, PlayOptions, Playlist, PlaylistInfo, Plugin, PluginType, Queue, QueueManager, RelatedSong, RepeatMode, ResolveOptions, ResolvePlaylistOptions, SearchResult, SearchResultType, Song, TaskQueue, checkIntents, checkInvalidKey, chooseBestVideoFormat, DisTube as default, defaultFilters, defaultOptions, entersState, formatDuration, getResponseHeaders, isClientInstance, isGuildInstance, isMemberInstance, isMessageInstance, isObject, isRecord, isSnowflake, isSupportedVoiceChannel, isTextChannelInstance, isURL, isVoiceChannelEmpty, parseNumber, resolveGuildId, resolveHttpSong, toSecond, validateAudioURL, version };