distube 4.0.0-dev.1 → 4.0.0-dev.2

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 (89) hide show
  1. package/dist/DisTube.d.ts +13 -480
  2. package/dist/DisTube.d.ts.map +1 -1
  3. package/dist/DisTube.js +30 -544
  4. package/dist/DisTube.js.map +1 -1
  5. package/dist/constant.d.ts +0 -97
  6. package/dist/constant.d.ts.map +1 -1
  7. package/dist/constant.js +0 -97
  8. package/dist/constant.js.map +1 -1
  9. package/dist/core/DisTubeBase.d.ts +0 -40
  10. package/dist/core/DisTubeBase.d.ts.map +1 -1
  11. package/dist/core/DisTubeBase.js +0 -44
  12. package/dist/core/DisTubeBase.js.map +1 -1
  13. package/dist/core/DisTubeHandler.d.ts +2 -68
  14. package/dist/core/DisTubeHandler.d.ts.map +1 -1
  15. package/dist/core/DisTubeHandler.js +6 -68
  16. package/dist/core/DisTubeHandler.js.map +1 -1
  17. package/dist/core/DisTubeStream.d.ts +0 -33
  18. package/dist/core/DisTubeStream.d.ts.map +1 -1
  19. package/dist/core/DisTubeStream.js +0 -36
  20. package/dist/core/DisTubeStream.js.map +1 -1
  21. package/dist/core/manager/BaseManager.d.ts +1 -16
  22. package/dist/core/manager/BaseManager.d.ts.map +1 -1
  23. package/dist/core/manager/BaseManager.js +2 -28
  24. package/dist/core/manager/BaseManager.js.map +1 -1
  25. package/dist/core/manager/FilterManager.d.ts +16 -0
  26. package/dist/core/manager/FilterManager.d.ts.map +1 -0
  27. package/dist/core/manager/FilterManager.js +88 -0
  28. package/dist/core/manager/FilterManager.js.map +1 -0
  29. package/dist/core/manager/GuildIdManager.d.ts +9 -0
  30. package/dist/core/manager/GuildIdManager.d.ts.map +1 -0
  31. package/dist/core/manager/GuildIdManager.js +25 -0
  32. package/dist/core/manager/GuildIdManager.js.map +1 -0
  33. package/dist/core/manager/QueueManager.d.ts +4 -26
  34. package/dist/core/manager/QueueManager.d.ts.map +1 -1
  35. package/dist/core/manager/QueueManager.js +27 -48
  36. package/dist/core/manager/QueueManager.js.map +1 -1
  37. package/dist/core/manager/index.d.ts +2 -0
  38. package/dist/core/manager/index.d.ts.map +1 -1
  39. package/dist/core/manager/index.js +2 -0
  40. package/dist/core/manager/index.js.map +1 -1
  41. package/dist/core/voice/DisTubeVoice.d.ts +0 -50
  42. package/dist/core/voice/DisTubeVoice.d.ts.map +1 -1
  43. package/dist/core/voice/DisTubeVoice.js +8 -68
  44. package/dist/core/voice/DisTubeVoice.js.map +1 -1
  45. package/dist/core/voice/DisTubeVoiceManager.d.ts +2 -33
  46. package/dist/core/voice/DisTubeVoiceManager.d.ts.map +1 -1
  47. package/dist/core/voice/DisTubeVoiceManager.js +1 -32
  48. package/dist/core/voice/DisTubeVoiceManager.js.map +1 -1
  49. package/dist/struct/CustomPlugin.d.ts +0 -41
  50. package/dist/struct/CustomPlugin.d.ts.map +1 -1
  51. package/dist/struct/CustomPlugin.js +0 -34
  52. package/dist/struct/CustomPlugin.js.map +1 -1
  53. package/dist/struct/ExtractorPlugin.d.ts +0 -32
  54. package/dist/struct/ExtractorPlugin.d.ts.map +1 -1
  55. package/dist/struct/ExtractorPlugin.js +0 -23
  56. package/dist/struct/ExtractorPlugin.js.map +1 -1
  57. package/dist/struct/Playlist.d.ts +0 -29
  58. package/dist/struct/Playlist.d.ts.map +1 -1
  59. package/dist/struct/Playlist.js +0 -54
  60. package/dist/struct/Playlist.js.map +1 -1
  61. package/dist/struct/Plugin.d.ts +0 -58
  62. package/dist/struct/Plugin.d.ts.map +1 -1
  63. package/dist/struct/Plugin.js +0 -62
  64. package/dist/struct/Plugin.js.map +1 -1
  65. package/dist/struct/Queue.d.ts +10 -177
  66. package/dist/struct/Queue.d.ts.map +1 -1
  67. package/dist/struct/Queue.js +49 -256
  68. package/dist/struct/Queue.js.map +1 -1
  69. package/dist/struct/SearchResult.d.ts +0 -8
  70. package/dist/struct/SearchResult.d.ts.map +1 -1
  71. package/dist/struct/SearchResult.js +0 -47
  72. package/dist/struct/SearchResult.js.map +1 -1
  73. package/dist/struct/Song.d.ts +0 -35
  74. package/dist/struct/Song.d.ts.map +1 -1
  75. package/dist/struct/Song.js +0 -121
  76. package/dist/struct/Song.js.map +1 -1
  77. package/dist/struct/TaskQueue.d.ts +0 -20
  78. package/dist/struct/TaskQueue.d.ts.map +1 -1
  79. package/dist/struct/TaskQueue.js +0 -25
  80. package/dist/struct/TaskQueue.js.map +1 -1
  81. package/dist/tsconfig.tsbuildinfo +1 -1
  82. package/dist/type.d.ts +6 -71
  83. package/dist/type.d.ts.map +1 -1
  84. package/dist/type.js.map +1 -1
  85. package/dist/util.d.ts +0 -29
  86. package/dist/util.d.ts.map +1 -1
  87. package/dist/util.js +2 -38
  88. package/dist/util.js.map +1 -1
  89. package/package.json +13 -4
package/dist/DisTube.d.ts CHANGED
@@ -3,10 +3,6 @@ import { DisTubeHandler, DisTubeVoiceManager, Options, Playlist, Queue, QueueMan
3
3
  import type { Client, GuildMember, GuildTextBasedChannel, Message, VoiceBasedChannel } from "discord.js";
4
4
  import type { CustomPlugin, DisTubeEvents, DisTubeOptions, ExtractorPlugin, Filters, GuildIdResolvable } from ".";
5
5
  export declare const version: string;
6
- /**
7
- * DisTube class
8
- * @extends EventEmitter
9
- */
10
6
  export declare class DisTube extends TypedEmitter<DisTubeEvents> {
11
7
  readonly handler: DisTubeHandler;
12
8
  readonly options: Options;
@@ -16,506 +12,43 @@ export declare class DisTube extends TypedEmitter<DisTubeEvents> {
16
12
  readonly extractorPlugins: ExtractorPlugin[];
17
13
  readonly customPlugins: CustomPlugin[];
18
14
  readonly filters: Filters;
19
- /**
20
- * Create a new DisTube class.
21
- * @param {Discord.Client} client Discord.JS client
22
- * @param {DisTubeOptions} [otp] Custom DisTube options
23
- * @example
24
- * const Discord = require('discord.js'),
25
- * DisTube = require('distube'),
26
- * client = new Discord.Client();
27
- * // Create a new DisTube
28
- * const distube = new DisTube.default(client, { searchSongs: 10 });
29
- * // client.DisTube = distube // make it access easily
30
- * client.login("Your Discord Bot Token")
31
- */
32
15
  constructor(client: Client, otp?: DisTubeOptions);
33
16
  static get version(): string;
34
- /**
35
- * DisTube version
36
- * @type {string}
37
- */
38
17
  get version(): string;
39
- /**
40
- * Play / add a song or playlist from url. Search and play a song if it is not a valid url.
41
- *
42
- * @param {Discord.BaseGuildVoiceChannel} voiceChannel The voice channel will be joined
43
- * @param {string|Song|SearchResult|Playlist} song URL | Search string |
44
- * {@link Song} | {@link SearchResult} | {@link Playlist}
45
- * @param {Object} [options] Optional options
46
- * @param {boolean} [options.skip=false]
47
- * Skip the playing song (if exists) and play the added song/playlist if `position` is 1.
48
- * If `position` is defined and not equal to 1, it will skip to the next song instead of the added song
49
- * @param {number} [options.position=0] Position of the song/playlist to add to the queue,
50
- * <= 0 to add to the end of the queue.
51
- * @param {boolean} [options.unshift=false] (DEPRECATED) Add the song/playlist to the beginning of the queue
52
- * (after the playing song if exists)
53
- * @param {Discord.GuildMember} [options.member] Requested user (default is your bot)
54
- * @param {Discord.BaseGuildTextChannel} [options.textChannel] Default {@link Queue#textChannel}
55
- * @param {Discord.Message} [options.message] Called message (For built-in search events. If this is a {@link https://developer.mozilla.org/en-US/docs/Glossary/Falsy|falsy value}, it will play the first result instead)
56
- * @param {*} [options.metadata] Optional metadata that can be attached to the song/playlist will be played,
57
- * This is useful for identification purposes when the song/playlist is passed around in events.
58
- * See {@link Song#metadata} or {@link Playlist#metadata}
59
- * @example
60
- * client.on('message', (message) => {
61
- * if (!message.content.startsWith(config.prefix)) return;
62
- * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
63
- * const command = args.shift();
64
- * if (command == "play")
65
- * distube.play(message.member.voice?.channel, args.join(" "), {
66
- * member: message.member,
67
- * textChannel: message.channel,
68
- * message
69
- * });
70
- * });
71
- * @returns {Promise<void>}
72
- */
73
18
  play(voiceChannel: VoiceBasedChannel, song: string | Song | SearchResult | Playlist, options?: {
74
19
  skip?: boolean;
75
- unshift?: boolean;
76
20
  position?: number;
77
21
  member?: GuildMember;
78
22
  textChannel?: GuildTextBasedChannel;
79
23
  message?: Message;
80
24
  metadata?: any;
81
25
  }): Promise<void>;
82
- /**
83
- * Create a custom playlist
84
- * @returns {Promise<Playlist>}
85
- * @param {Array<string|Song|SearchResult>} songs Array of url, Song or SearchResult
86
- * @param {Object} [options] Optional options
87
- * @param {Discord.GuildMember} [options.message] A message from guild channel | A guild member
88
- * @param {Object} [options.properties] Additional properties such as `name`
89
- * @param {boolean} [options.parallel=true] Whether or not fetch the songs in parallel
90
- * @param {*} [options.metadata] Metadata
91
- * @example
92
- * const songs = ["https://www.youtube.com/watch?v=xxx", "https://www.youtube.com/watch?v=yyy"];
93
- * const playlist = await distube.createCustomPlaylist(songs, {
94
- * member: message.member,
95
- * properties: { name: "My playlist name" },
96
- * parallel: true
97
- * });
98
- * distube.play(voiceChannel, playlist, { ... });
99
- */
100
26
  createCustomPlaylist(songs: (string | Song | SearchResult)[], options?: {
101
27
  member?: GuildMember;
102
28
  properties?: Record<string, any>;
103
29
  parallel?: boolean;
104
30
  metadata?: any;
105
31
  }): Promise<Playlist>;
106
- /**
107
- * Search for a song. You can customize how user answers instead of send a number.
108
- * Then use {@link DisTube#play} to play it.
109
- *
110
- * @param {string} string The string search for
111
- * @param {Object} options Search options
112
- * @param {number} [options.limit=10] Limit the results
113
- * @param {'video'|'playlist'} [options.type='video'] Type of results (`video` or `playlist`).
114
- * @param {boolean} [options.safeSearch=false] Whether or not use safe search (YouTube restricted mode)
115
- * @throws {Error}
116
- * @returns {Promise<Array<SearchResult>>} Array of results
117
- */
118
32
  search(string: string, options?: {
119
33
  type?: "video" | "playlist";
120
34
  limit?: number;
121
35
  safeSearch?: boolean;
122
36
  retried?: boolean;
123
37
  }): Promise<Array<SearchResult>>;
124
- /**
125
- * Get the guild queue
126
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
127
- * @returns {Queue?}
128
- * @throws {Error}
129
- * @example
130
- * client.on('message', (message) => {
131
- * if (!message.content.startsWith(config.prefix)) return;
132
- * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
133
- * const command = args.shift();
134
- * if (command == "queue") {
135
- * const queue = distube.getQueue(message);
136
- * message.channel.send('Current queue:\n' + queue.songs.map((song, id) =>
137
- * `**${id+1}**. [${song.name}](${song.url}) - \`${song.formattedDuration}\``
138
- * ).join("\n"));
139
- * }
140
- * });
141
- */
142
- getQueue(queue: GuildIdResolvable): Queue | undefined;
143
- /**
144
- * Pause the guild stream
145
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
146
- * @returns {Queue} The guild queue
147
- * @throws {Error}
148
- */
149
- pause(queue: GuildIdResolvable): Queue;
150
- /**
151
- * Resume the guild stream
152
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
153
- * @returns {Queue} The guild queue
154
- * @throws {Error}
155
- */
156
- resume(queue: GuildIdResolvable): Queue;
157
- /**
158
- * Stop the guild stream
159
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
160
- * @returns {Promise<void>}
161
- * @throws {Error}
162
- * @example
163
- * client.on('message', (message) => {
164
- * if (!message.content.startsWith(config.prefix)) return;
165
- * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
166
- * const command = args.shift();
167
- * if (command == "stop") {
168
- * distube.stop(message);
169
- * message.channel.send("Stopped the queue!");
170
- * }
171
- * });
172
- */
173
- stop(queue: GuildIdResolvable): Promise<void>;
174
- /**
175
- * Set the guild stream's volume
176
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
177
- * @param {number} percent The percentage of volume you want to set
178
- * @returns {Queue} The guild queue
179
- * @throws {Error}
180
- * @example
181
- * client.on('message', (message) => {
182
- * if (!message.content.startsWith(config.prefix)) return;
183
- * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
184
- * const command = args.shift();
185
- * if (command == "volume")
186
- * distube.setVolume(message, Number(args[0]));
187
- * });
188
- */
189
- setVolume(queue: GuildIdResolvable, percent: number): Queue;
190
- /**
191
- * Skip the playing song if there is a next song in the queue.
192
- * <info>If {@link Queue#autoplay} is `true` and there is no up next song,
193
- * DisTube will add and play a related song.</info>
194
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
195
- * @returns {Promise<Song>} The new Song will be played
196
- * @throws {Error}
197
- * @example
198
- * client.on('message', (message) => {
199
- * if (!message.content.startsWith(config.prefix)) return;
200
- * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
201
- * const command = args.shift();
202
- * if (command == "skip")
203
- * distube.skip(message);
204
- * });
205
- */
206
- skip(queue: GuildIdResolvable): Promise<Song>;
207
- /**
208
- * Play the previous song
209
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
210
- * @returns {Promise<Song>} The new Song will be played
211
- * @throws {Error}
212
- * @example
213
- * client.on('message', (message) => {
214
- * if (!message.content.startsWith(config.prefix)) return;
215
- * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
216
- * const command = args.shift();
217
- * if (command == "previous")
218
- * distube.previous(message);
219
- * });
220
- */
221
- previous(queue: GuildIdResolvable): Promise<Song>;
222
- /**
223
- * Shuffle the guild queue songs
224
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
225
- * @returns {Promise<Queue>} The guild queue
226
- * @example
227
- * client.on('message', (message) => {
228
- * if (!message.content.startsWith(config.prefix)) return;
229
- * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
230
- * const command = args.shift();
231
- * if (command == "shuffle")
232
- * distube.shuffle(message);
233
- * });
234
- */
235
- shuffle(queue: GuildIdResolvable): Promise<Queue>;
236
- /**
237
- * Jump to the song number in the queue.
238
- * The next one is 1, 2,...
239
- * The previous one is -1, -2,...
240
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
241
- * @param {number} num The song number to play
242
- * @returns {Promise<Queue>} The guild queue
243
- * @throws {Error} if `num` is invalid number (0 < num < {@link Queue#songs}.length)
244
- * @example
245
- * client.on('message', (message) => {
246
- * if (!message.content.startsWith(config.prefix)) return;
247
- * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
248
- * const command = args.shift();
249
- * if (command == "jump")
250
- * distube.jump(message, parseInt(args[0]))
251
- * .catch(err => message.channel.send("Invalid song number."));
252
- * });
253
- */
254
- jump(queue: GuildIdResolvable, num: number): Promise<Queue>;
255
- /**
256
- * Set the repeat mode of the guild queue.\
257
- * Toggle mode `(Disabled -> Song -> Queue -> Disabled ->...)` if `mode` is `undefined`
258
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
259
- * @param {RepeatMode?} [mode] The repeat modes (toggle if `undefined`)
260
- * @returns {RepeatMode} The new repeat mode
261
- * @example
262
- * client.on('message', (message) => {
263
- * if (!message.content.startsWith(config.prefix)) return;
264
- * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
265
- * const command = args.shift();
266
- * if (command == "repeat") {
267
- * let mode = distube.setRepeatMode(message, parseInt(args[0]));
268
- * mode = mode ? mode == 2 ? "Repeat queue" : "Repeat song" : "Off";
269
- * message.channel.send("Set repeat mode to `" + mode + "`");
270
- * }
271
- * });
272
- * @example
273
- * const { RepeatMode } = require("distube");
274
- * let mode;
275
- * switch(distube.setRepeatMode(message, parseInt(args[0]))) {
276
- * case RepeatMode.DISABLED:
277
- * mode = "Off";
278
- * break;
279
- * case RepeatMode.SONG:
280
- * mode = "Repeat a song";
281
- * break;
282
- * case RepeatMode.QUEUE:
283
- * mode = "Repeat all queue";
284
- * break;
285
- * }
286
- * message.channel.send("Set repeat mode to `" + mode + "`");
287
- */
288
- setRepeatMode(queue: GuildIdResolvable, mode?: number): number;
289
- /**
290
- * Toggle autoplay mode
291
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
292
- * @returns {boolean} Autoplay mode state
293
- * @throws {Error}
294
- * @example
295
- * client.on('message', (message) => {
296
- * if (!message.content.startsWith(config.prefix)) return;
297
- * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
298
- * const command = args.shift();
299
- * if (command == "autoplay") {
300
- * const mode = distube.toggleAutoplay(message);
301
- * message.channel.send("Set autoplay mode to `" + (mode ? "On" : "Off") + "`");
302
- * }
303
- * });
304
- */
305
- toggleAutoplay(queue: GuildIdResolvable): boolean;
306
- /**
307
- * Add related song to the queue
308
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
309
- * @returns {Promise<Song>} The guild queue
310
- */
311
- addRelatedSong(queue: GuildIdResolvable): Promise<Song>;
312
- /**
313
- * Enable or disable filter(s) of the queue.
314
- * Available filters: {@link Filters}
315
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
316
- * @param {string|false} filter A filter name, `false` to clear all the filters
317
- * @param {boolean} [force=false] Force enable the input filter(s) even if it's enabled
318
- * @returns {Array<string>} Enabled filters.
319
- * @example
320
- * client.on('message', (message) => {
321
- * if (!message.content.startsWith(config.prefix)) return;
322
- * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
323
- * const command = args.shift();
324
- * if ([`3d`, `bassboost`, `echo`, `karaoke`, `nightcore`, `vaporwave`].includes(command)) {
325
- * const filter = distube.setFilter(message, command);
326
- * message.channel.send("Current queue filter: " + (filter.join(", ") || "Off"));
327
- * }
328
- * });
329
- */
330
- setFilter(queue: GuildIdResolvable, filter: string | false, force?: boolean): Array<string>;
331
- /**
332
- * Set the playing time to another position
333
- * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}
334
- * @param {number} time Time in seconds
335
- * @returns {Queue} Seeked queue
336
- * @example
337
- * client.on('message', message => {
338
- * if (!message.content.startsWith(config.prefix)) return;
339
- * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
340
- * const command = args.shift();
341
- * if (command = 'seek')
342
- * distube.seek(message, Number(args[0]));
343
- * });
344
- */
345
- seek(queue: GuildIdResolvable, time: number): Queue;
346
- /**
347
- * Emit error event
348
- * @param {Error} error error
349
- * @param {Discord.BaseGuildTextChannel} [channel] Text channel where the error is encountered.
350
- * @private
351
- */
38
+ getQueue(guild: GuildIdResolvable): Queue | undefined;
39
+ pause(guild: GuildIdResolvable): Queue;
40
+ resume(guild: GuildIdResolvable): Queue;
41
+ stop(guild: GuildIdResolvable): Promise<void>;
42
+ setVolume(guild: GuildIdResolvable, percent: number): Queue;
43
+ skip(guild: GuildIdResolvable): Promise<Song>;
44
+ previous(guild: GuildIdResolvable): Promise<Song>;
45
+ shuffle(guild: GuildIdResolvable): Promise<Queue>;
46
+ jump(guild: GuildIdResolvable, num: number): Promise<Song>;
47
+ setRepeatMode(guild: GuildIdResolvable, mode?: number): number;
48
+ toggleAutoplay(guild: GuildIdResolvable): boolean;
49
+ addRelatedSong(guild: GuildIdResolvable): Promise<Song>;
50
+ seek(guild: GuildIdResolvable, time: number): Queue;
352
51
  emitError(error: Error, channel?: GuildTextBasedChannel): void;
353
52
  }
354
53
  export default DisTube;
355
- /**
356
- * Emitted after DisTube add a new playlist to the playing {@link Queue}.
357
- *
358
- * @event DisTube#addList
359
- * @param {Queue} queue The guild queue
360
- * @param {Playlist} playlist Playlist info
361
- * @example
362
- * distube.on("addList", (queue, playlist) => queue.textChannel.send(
363
- * `Added \`${playlist.name}\` playlist (${playlist.songs.length} songs) to the queue!`
364
- * ));
365
- */
366
- /**
367
- * Emitted after DisTube add a new song to the playing {@link Queue}.
368
- *
369
- * @event DisTube#addSong
370
- * @param {Queue} queue The guild queue
371
- * @param {Song} song Added song
372
- * @example
373
- * distube.on("addSong", (queue, song) => queue.textChannel.send(
374
- * `Added ${song.name} - \`${song.formattedDuration}\` to the queue by ${song.user}.`
375
- * ));
376
- */
377
- /**
378
- * Emitted when there is no user in the voice channel,
379
- * {@link DisTubeOptions}.leaveOnEmpty is `true` and there is a playing queue.
380
- *
381
- * If there is no playing queue (stopped and {@link DisTubeOptions}.leaveOnStop is `false`),
382
- * it will leave the channel without emitting this event.
383
- * @event DisTube#empty
384
- * @param {Queue} queue The guild queue
385
- * @example
386
- * distube.on("empty", queue => queue.textChannel.send("Channel is empty. Leaving the channel"))
387
- */
388
- /**
389
- * Emitted when DisTube encounters an error.
390
- *
391
- * @event DisTube#error
392
- * @param {Discord.BaseGuildTextChannel} channel Text channel where the error is encountered.
393
- * @param {Error} error The error encountered
394
- * @example
395
- * distube.on("error", (channel, error) => channel.send(
396
- * "An error encountered: " + error
397
- * ));
398
- */
399
- /**
400
- * Emitted when there is no more song in the queue and {@link Queue#autoplay} is `false`.
401
- * DisTube will leave voice channel if {@link DisTubeOptions}.leaveOnFinish is `true`.
402
- *
403
- * @event DisTube#finish
404
- * @param {Queue} queue The guild queue
405
- * @example
406
- * distube.on("finish", queue => queue.textChannel.send("No more song in queue"));
407
- */
408
- /**
409
- * Emitted when DisTube initialize a queue to change queue default properties.
410
- *
411
- * @event DisTube#initQueue
412
- * @param {Queue} queue The guild queue
413
- * @example
414
- * distube.on("initQueue", queue => {
415
- * queue.autoplay = false;
416
- * queue.volume = 100;
417
- * });
418
- */
419
- /**
420
- * Emitted when {@link Queue#autoplay} is `true`, {@link Queue#songs} is empty,
421
- * and DisTube cannot find related songs to play.
422
- *
423
- * @event DisTube#noRelated
424
- * @param {Queue} queue The guild queue
425
- * @example
426
- * distube.on("noRelated", queue => queue.textChannel.send("Can't find related video to play."));
427
- */
428
- /**
429
- * Emitted when DisTube play a song.
430
- *
431
- * If {@link DisTubeOptions}.emitNewSongOnly is `true`,
432
- * this event is not emitted when looping a song or next song is the previous one.
433
- *
434
- * @event DisTube#playSong
435
- * @param {Queue} queue The guild queue
436
- * @param {Song} song Playing song
437
- * @example
438
- * distube.on("playSong", (queue, song) => queue.textChannel.send(
439
- * `Playing \`${song.name}\` - \`${song.formattedDuration}\`\nRequested by: ${song.user}`
440
- * ));
441
- */
442
- /**
443
- * Emitted when DisTube cannot find any results for the query.
444
- *
445
- * @event DisTube#searchNoResult
446
- * @param {Discord.Message} message The user message called play method
447
- * @param {string} query The search query
448
- * @example
449
- * distube.on("searchNoResult", (message, query) => message.channel.send(`No result found for ${query}!`));
450
- */
451
- /**
452
- * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,
453
- * and song param of {@link DisTube#play} is invalid url.
454
- * DisTube will wait for user's next message to choose a song manually.
455
- * <info>{@link https://support.google.com/youtube/answer/7354993|Safe search} is enabled
456
- * if {@link DisTubeOptions}.nsfw is disabled and the message's channel is not a nsfw channel.</info>
457
- *
458
- * @event DisTube#searchResult
459
- * @param {Discord.Message} message The user message called play method
460
- * @param {Array<SearchResult>} results Searched results
461
- * @param {string} query The search query
462
- * @example
463
- * // DisTubeOptions.searchSongs > 0
464
- * distube.on("searchResult", (message, results) => {
465
- * message.channel.send(`**Choose an option from below**\n${
466
- * results.map((song, i) => `**${i + 1}**. ${song.name} - \`${song.formattedDuration}\``).join("\n")
467
- * }\n*Enter anything else or wait 60 seconds to cancel*`);
468
- * });
469
- */
470
- /**
471
- * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,
472
- * and the search canceled due to {@link DisTubeOptions|DisTubeOptions.searchTimeout}.
473
- *
474
- * @event DisTube#searchCancel
475
- * @param {Discord.Message} message The user message called play method
476
- * @param {string} query The search query
477
- * @example
478
- * // DisTubeOptions.searchSongs > 0
479
- * distube.on("searchCancel", (message) => message.channel.send(`Searching canceled`));
480
- */
481
- /**
482
- * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,
483
- * and the search canceled due to user's next message is not a number or out of results range.
484
- *
485
- * @event DisTube#searchInvalidAnswer
486
- * @param {Discord.Message} message The user message called play method
487
- * @param {Discord.Message} answer The answered message of user
488
- * @param {string} query The search query
489
- * @example
490
- * // DisTubeOptions.searchSongs > 0
491
- * distube.on("searchInvalidAnswer", (message) => message.channel.send(`You answered an invalid number!`));
492
- */
493
- /**
494
- * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,
495
- * and after the user chose a search result to play.
496
- *
497
- * @event DisTube#searchDone
498
- * @param {Discord.Message} message The user message called play method
499
- * @param {Discord.Message} answer The answered message of user
500
- * @param {string} query The search query
501
- */
502
- /**
503
- * Emitted when the bot is disconnected to a voice channel.
504
- *
505
- * @event DisTube#disconnect
506
- * @param {Queue} queue The guild queue
507
- */
508
- /**
509
- * Emitted when a {@link Queue} is deleted with any reasons.
510
- *
511
- * @event DisTube#deleteQueue
512
- * @param {Queue} queue The guild queue
513
- */
514
- /**
515
- * Emitted when DisTube finished a song.
516
- *
517
- * @event DisTube#finishSong
518
- * @param {Queue} queue The guild queue
519
- * @param {Song} song Finished song
520
- */
521
54
  //# sourceMappingURL=DisTube.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DisTube.d.ts","sourceRoot":"","sources":["../src/DisTube.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAEL,cAAc,EACd,mBAAmB,EAGnB,OAAO,EACP,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,IAAI,EAOL,MAAM,GAAG,CAAC;AACX,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,qBAAqB,EAAE,OAAO,EAAe,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACtH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,GAAG,CAAC;AAIlH,eAAO,MAAQ,OAAO,QAAoD,CAAC;AAE3E;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,YAAY,CAAC,aAAa,CAAC;IACtD,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IAC7C,QAAQ,C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