distube 3.3.2 → 4.0.0-dev.0

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 (57) hide show
  1. package/README.md +6 -8
  2. package/dist/DisTube.d.ts +0 -77
  3. package/dist/DisTube.d.ts.map +1 -1
  4. package/dist/DisTube.js +42 -129
  5. package/dist/DisTube.js.map +1 -1
  6. package/dist/constant.d.ts +0 -4
  7. package/dist/constant.d.ts.map +1 -1
  8. package/dist/constant.js +0 -4
  9. package/dist/constant.js.map +1 -1
  10. package/dist/core/DisTubeHandler.d.ts +0 -21
  11. package/dist/core/DisTubeHandler.d.ts.map +1 -1
  12. package/dist/core/DisTubeHandler.js +8 -56
  13. package/dist/core/DisTubeHandler.js.map +1 -1
  14. package/dist/core/DisTubeOptions.d.ts +0 -2
  15. package/dist/core/DisTubeOptions.d.ts.map +1 -1
  16. package/dist/core/DisTubeOptions.js +0 -13
  17. package/dist/core/DisTubeOptions.js.map +1 -1
  18. package/dist/core/voice/DisTubeVoice.d.ts.map +1 -1
  19. package/dist/core/voice/DisTubeVoice.js +1 -3
  20. package/dist/core/voice/DisTubeVoice.js.map +1 -1
  21. package/dist/core/voice/index.d.ts +0 -1
  22. package/dist/core/voice/index.d.ts.map +1 -1
  23. package/dist/core/voice/index.js +0 -1
  24. package/dist/core/voice/index.js.map +1 -1
  25. package/dist/plugin/index.d.ts +0 -1
  26. package/dist/plugin/index.d.ts.map +1 -1
  27. package/dist/plugin/index.js +0 -1
  28. package/dist/plugin/index.js.map +1 -1
  29. package/dist/struct/DisTubeError.d.ts +0 -1
  30. package/dist/struct/DisTubeError.d.ts.map +1 -1
  31. package/dist/struct/DisTubeError.js +0 -2
  32. package/dist/struct/DisTubeError.js.map +1 -1
  33. package/dist/struct/Playlist.d.ts +0 -7
  34. package/dist/struct/Playlist.d.ts.map +1 -1
  35. package/dist/struct/Playlist.js +14 -11
  36. package/dist/struct/Playlist.js.map +1 -1
  37. package/dist/struct/Song.d.ts +0 -3
  38. package/dist/struct/Song.d.ts.map +1 -1
  39. package/dist/struct/Song.js +11 -9
  40. package/dist/struct/Song.js.map +1 -1
  41. package/dist/tsconfig.tsbuildinfo +1 -1
  42. package/dist/type.d.ts +0 -4
  43. package/dist/type.d.ts.map +1 -1
  44. package/dist/type.js.map +1 -1
  45. package/dist/util.d.ts +0 -1
  46. package/dist/util.d.ts.map +1 -1
  47. package/dist/util.js +15 -26
  48. package/dist/util.js.map +1 -1
  49. package/package.json +14 -15
  50. package/dist/core/voice/DJSAdapter.d.ts +0 -4
  51. package/dist/core/voice/DJSAdapter.d.ts.map +0 -1
  52. package/dist/core/voice/DJSAdapter.js +0 -58
  53. package/dist/core/voice/DJSAdapter.js.map +0 -1
  54. package/dist/plugin/youtube-dl.d.ts +0 -12
  55. package/dist/plugin/youtube-dl.d.ts.map +0 -1
  56. package/dist/plugin/youtube-dl.js +0 -70
  57. package/dist/plugin/youtube-dl.js.map +0 -1
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  <img alt="node-current" src="https://img.shields.io/node/v/distube?logo=node.js&logoColor=white&style=flat-square">
8
8
  <img alt="npm peer dependency version" src="https://img.shields.io/npm/dependency-version/distube/peer/discord.js?label=discord.js&logo=discord&logoColor=white&style=flat-square">
9
9
  <img alt="Depfu" src="https://img.shields.io/depfu/skick1234/DisTube?style=flat-square">
10
- <img alt="Codecov branch" src="https://img.shields.io/codecov/c/github/skick1234/DisTube?logo=codecov&logoColor=white&style=flat-square&token=WWDYRRSEQW">
10
+ <img alt="Codecov branch" src="https://img.shields.io/codecov/c/github/skick1234/DisTube/main?logo=codecov&logoColor=white&style=flat-square&token=WWDYRRSEQW">
11
11
  <br>
12
12
  <img alt="npm" src="https://img.shields.io/npm/dt/distube?logo=npm&style=flat-square">
13
13
  <img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/skick1234/DisTube?logo=github&logoColor=white&style=flat-square">
@@ -25,25 +25,24 @@ A Discord.js module to simplify your music commands and play songs with audio fi
25
25
 
26
26
  - Build on `@discordjs/voice`
27
27
  - Easy to use and customize
28
- - Support YouTube, SoundCloud, Facebook, and [700+ more sites](https://ytdl-org.github.io/youtube-dl/supportedsites.html)
28
+ - Support YouTube and audio link
29
29
  - Audio filters (bassboost, nightcore, vaporwave,...)
30
30
  - Autoplay related songs
31
31
  - Plugin system to support more sites ([Plugin List](https://distube.js.org/#/docs/DisTube/stable/plugin/list))
32
32
 
33
- ### Requirement
33
+ ## Requirement
34
34
 
35
- - Node v12 or higher
36
- - [discord.js](https://discord.js.org) v12 or **v13 _(Recommended)_**
35
+ - Node.js 16.9.0 or higher
36
+ - [discord.js](https://discord.js.org) v14
37
37
  - [@discordjs/voice](https://github.com/discordjs/voice)
38
38
  - [FFmpeg](https://www.ffmpeg.org/download.html)
39
39
  - [@discordjs/opus](https://github.com/discordjs/opus)
40
40
  - [sodium](https://www.npmjs.com/package/sodium) or [libsodium-wrappers](https://www.npmjs.com/package/libsodium-wrappers)
41
- - [python](https://www.python.org/) _(Optional - For [`youtube-dl`](https://youtube-dl.org/) to support [700+ more sites](https://ytdl-org.github.io/youtube-dl/supportedsites.html).)_
42
41
 
43
42
  ## Installation
44
43
 
45
44
  ```npm
46
- npm install distube@latest
45
+ npm install distube@dev
47
46
  ```
48
47
 
49
48
  ## Documentation
@@ -61,4 +60,3 @@ Read DisTube's definitions, properties and events details in the [Documentation
61
60
  - [node-ytdl-core](https://github.com/fent/node-ytdl-core): YouTube scraper ([DisTube Fork](https://github.com/distubejs/node-ytdl-core))
62
61
  - [node-ytsr](https://github.com/TimeForANinja/node-ytsr): YouTube search scraper ([DisTube Fork](https://github.com/distubejs/ytsr))
63
62
  - [node-ytpl](https://github.com/TimeForANinja/node-ytpl): YouTube playlist resolver ([DisTube Fork](https://github.com/distubejs/ytpl))
64
- - [youtube-dl-exec](https://github.com/microlinkhq/youtube-dl-exec): [`youtube-dl`](https://youtube-dl.org/) wrapper
package/dist/DisTube.d.ts CHANGED
@@ -71,54 +71,6 @@ export declare class DisTube extends TypedEmitter<DisTubeEvents> {
71
71
  * @returns {Promise<void>}
72
72
  */
73
73
  play(voiceChannel: VoiceBasedChannel, song: string | Song | SearchResult | Playlist, options?: {
74
- skip?: boolean;
75
- position?: number;
76
- member?: GuildMember;
77
- textChannel?: GuildTextBasedChannel;
78
- message?: Message;
79
- metadata?: any;
80
- }): Promise<void>;
81
- /** @deprecated Message parameter is deprecated, use VoiceChannel instead. */
82
- play(message: Message<true>, song: string | Song | SearchResult | Playlist, options?: {
83
- skip?: boolean;
84
- unshift?: boolean;
85
- metadata?: any;
86
- }): Promise<void>;
87
- /** @deprecated `options.unshift` is deprecated, use `options.position` instead */
88
- play(voiceChannel: VoiceBasedChannel, song: string | Song | SearchResult | Playlist, options?: {
89
- skip?: boolean;
90
- /** @deprecated Use `options.position` instead */
91
- unshift?: boolean;
92
- position?: number;
93
- member?: GuildMember;
94
- textChannel?: GuildTextBasedChannel;
95
- message?: Message;
96
- metadata?: any;
97
- }): Promise<void>;
98
- /**
99
- * Play / add a song or playlist from url. Search and play a song if it is not a valid url.
100
- *
101
- * @returns {Promise<void>}
102
- * @param {Discord.BaseGuildVoiceChannel} voiceChannel The voice channel will be joined
103
- * @param {string|Song|SearchResult|Playlist} song URL | Search string |
104
- * {@link Song} | {@link SearchResult} | {@link Playlist}
105
- * @param {Object} [options] Optional options
106
- * @param {boolean} [options.skip=false]
107
- * Skip the playing song (if exists) and play the added song/playlist if `position` is 1.
108
- * If `position` is defined and not equal to 1, it will skip to the next song instead of the added song
109
- * @param {number} [options.position=0] Position of the song/playlist to add to the queue,
110
- * <= 0 to add to the end of the queue.
111
- * @param {boolean} [options.unshift=false] (DEPRECATED) Add the song/playlist to the beginning of the queue
112
- * (after the playing song if exists)
113
- * @param {Discord.GuildMember} [options.member] Requested user (default is your bot)
114
- * @param {Discord.BaseGuildTextChannel} [options.textChannel] Default {@link Queue#textChannel}
115
- * @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)
116
- * @param {*} [options.metadata] Optional metadata that can be attached to the song/playlist will be played,
117
- * This is useful for identification purposes when the song/playlist is passed around in events.
118
- * See {@link Song#metadata} or {@link Playlist#metadata}
119
- * @deprecated Use {@link DisTube#play} instead
120
- */
121
- playVoiceChannel(voiceChannel: VoiceBasedChannel, song: string | Song | SearchResult | Playlist, options?: {
122
74
  skip?: boolean;
123
75
  unshift?: boolean;
124
76
  position?: number;
@@ -151,35 +103,6 @@ export declare class DisTube extends TypedEmitter<DisTubeEvents> {
151
103
  parallel?: boolean;
152
104
  metadata?: any;
153
105
  }): Promise<Playlist>;
154
- /**
155
- * <info>Shorthand method of {@link DisTube#createCustomPlaylist} and {@link DisTube#play}
156
- *
157
- * If you doesn't have a user message (interaction,...),
158
- * see {@link DisTube#createCustomPlaylist} example</info>
159
- *
160
- * Play or add array of video urls.
161
- * {@link DisTube#event:playSong} or {@link DisTube#event:addList} will be emitted
162
- * with `playlist`'s properties include `properties` parameter's properties such as
163
- * `user`, `songs`, `duration`, `formattedDuration`, `thumbnail` like {@link Playlist}
164
- * @returns {Promise<void>}
165
- * @param {Discord.Message} message A message from guild channel
166
- * @param {Array<string|Song|SearchResult>} songs Array of url, Song or SearchResult
167
- * @param {Object} [properties={}] Additional properties for playlist such as `name`
168
- * @param {Object} [options] Optional options
169
- * @param {boolean} [options.skip=false] Skip the playing song (if exists) and play the added song/playlist instantly
170
- * @param {boolean} [options.unshift=false] Add the song/playlist to the beginning of the queue
171
- * (after the playing song if exists)
172
- * @param {boolean} [options.parallel=true] Whether or not fetch the songs in parallel
173
- * @deprecated Use {@link DisTube#createCustomPlaylist} and {@link DisTube#play} instead
174
- */
175
- playCustomPlaylist(message: Message<true>, songs: Array<string | Song | SearchResult>, properties?: Record<string, any>, options?: {
176
- skip?: boolean;
177
- /** @deprecated */
178
- unshift?: boolean;
179
- position?: number;
180
- parallel?: boolean;
181
- metadata?: any;
182
- }): Promise<void>;
183
106
  /**
184
107
  * Search for a song. You can customize how user answers instead of send a number.
185
108
  * Then use {@link DisTube#play} to play it.
@@ -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,EAQL,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;AAMlH,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,CAAC,aAAa,EAAE,YAAY,EAAE,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;;;;OAYG;gBACS,MAAM,EAAE,MAAM,EAAE,GAAG,GAAE,cAAmB;IAsDpD,MAAM,KAAK,OAAO,WAEjB;IAED;;;OAGG;IACH,IAAI,OAAO,WAEV;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;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GAMG"}
package/dist/DisTube.js CHANGED
@@ -9,7 +9,6 @@ const ytsr_1 = __importDefault(require("@distube/ytsr"));
9
9
  const util_1 = require("./util");
10
10
  const tiny_typed_emitter_1 = require("tiny-typed-emitter");
11
11
  const _1 = require(".");
12
- // TODO: remove deprecated stuff on the next major version
13
12
  // Cannot be `import` as it's not under TS root dir
14
13
  // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
15
14
  exports.version = require("../package.json").version;
@@ -70,8 +69,6 @@ class DisTube extends tiny_typed_emitter_1.TypedEmitter {
70
69
  this.filters = { ..._1.defaultFilters, ...this.options.customFilters };
71
70
  // Default plugin
72
71
  this.options.plugins.push(new _1.HTTPPlugin(), new _1.HTTPSPlugin());
73
- if (this.options.youtubeDL)
74
- this.options.plugins.push(new _1.YouTubeDLPlugin(this.options.updateYouTubeDL));
75
72
  this.options.plugins.map(p => p.init(this));
76
73
  /**
77
74
  * Extractor Plugins
@@ -96,42 +93,50 @@ class DisTube extends tiny_typed_emitter_1.TypedEmitter {
96
93
  get version() {
97
94
  return exports.version;
98
95
  }
96
+ /**
97
+ * Play / add a song or playlist from url. Search and play a song if it is not a valid url.
98
+ *
99
+ * @param {Discord.BaseGuildVoiceChannel} voiceChannel The voice channel will be joined
100
+ * @param {string|Song|SearchResult|Playlist} song URL | Search string |
101
+ * {@link Song} | {@link SearchResult} | {@link Playlist}
102
+ * @param {Object} [options] Optional options
103
+ * @param {boolean} [options.skip=false]
104
+ * Skip the playing song (if exists) and play the added song/playlist if `position` is 1.
105
+ * If `position` is defined and not equal to 1, it will skip to the next song instead of the added song
106
+ * @param {number} [options.position=0] Position of the song/playlist to add to the queue,
107
+ * <= 0 to add to the end of the queue.
108
+ * @param {boolean} [options.unshift=false] (DEPRECATED) Add the song/playlist to the beginning of the queue
109
+ * (after the playing song if exists)
110
+ * @param {Discord.GuildMember} [options.member] Requested user (default is your bot)
111
+ * @param {Discord.BaseGuildTextChannel} [options.textChannel] Default {@link Queue#textChannel}
112
+ * @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)
113
+ * @param {*} [options.metadata] Optional metadata that can be attached to the song/playlist will be played,
114
+ * This is useful for identification purposes when the song/playlist is passed around in events.
115
+ * See {@link Song#metadata} or {@link Playlist#metadata}
116
+ * @example
117
+ * client.on('message', (message) => {
118
+ * if (!message.content.startsWith(config.prefix)) return;
119
+ * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
120
+ * const command = args.shift();
121
+ * if (command == "play")
122
+ * distube.play(message.member.voice?.channel, args.join(" "), {
123
+ * member: message.member,
124
+ * textChannel: message.channel,
125
+ * message
126
+ * });
127
+ * });
128
+ * @returns {Promise<void>}
129
+ */
99
130
  async play(voiceChannel, song, options = {}) {
100
- if ((0, _1.isMessageInstance)(voiceChannel)) {
101
- process.emitWarning("Passing Message for DisTube#play is deprecated, use BaseGuildVoiceChannel instead.", "DeprecationWarning");
102
- const message = voiceChannel;
103
- if (!song)
104
- throw new _1.DisTubeError("INVALID_TYPE", ["string", "Song", "SearchResult", "Playlist"], song, "song");
105
- if (!(0, _1.isMessageInstance)(message))
106
- throw new _1.DisTubeError("INVALID_TYPE", "Discord.Message", message, "message");
107
- if (!(0, util_1.isObject)(options))
108
- throw new _1.DisTubeError("INVALID_TYPE", "object", options, "options");
109
- const textChannel = message.channel;
110
- const { skip, unshift, metadata } = { skip: false, unshift: false, ...options };
111
- const member = message.member;
112
- const vc = member.voice.channel;
113
- if (!vc)
114
- throw new _1.DisTubeError("NOT_IN_VOICE");
115
- // eslint-disable-next-line deprecation/deprecation
116
- return this.play(vc, song, {
117
- member,
118
- textChannel,
119
- skip,
120
- message,
121
- unshift,
122
- metadata,
123
- });
124
- }
125
131
  if (!(0, _1.isSupportedVoiceChannel)(voiceChannel)) {
126
132
  throw new _1.DisTubeError("INVALID_TYPE", "BaseGuildVoiceChannel", voiceChannel, "voiceChannel");
127
133
  }
128
134
  if (!(0, util_1.isObject)(options))
129
135
  throw new _1.DisTubeError("INVALID_TYPE", "object", options, "options");
130
- // eslint-disable-next-line deprecation/deprecation
131
- const { textChannel, member, skip, message, unshift, metadata } = {
136
+ const { textChannel, member, skip, message, metadata } = {
132
137
  member: voiceChannel.guild.me ?? undefined,
138
+ textChannel: options?.message?.channel,
133
139
  skip: false,
134
- unshift: false,
135
140
  ...options,
136
141
  };
137
142
  let position = Number(options.position);
@@ -141,13 +146,15 @@ class DisTube extends tiny_typed_emitter_1.TypedEmitter {
141
146
  else
142
147
  position = 0;
143
148
  }
144
- if (unshift) {
145
- process.emitWarning("'unshift' option in DisTube#play is deprecated, use 'position' instead.", "DeprecationWarning");
146
- position = 1;
147
- }
148
149
  if (message && !(0, _1.isMessageInstance)(message)) {
149
150
  throw new _1.DisTubeError("INVALID_TYPE", ["Discord.Message", "a falsy value"], message, "options.message");
150
151
  }
152
+ if (textChannel && !(0, _1.isTextChannelInstance)(textChannel)) {
153
+ throw new _1.DisTubeError("INVALID_TYPE", "Discord.GuildTextBasedChannel", textChannel, "options.textChannel");
154
+ }
155
+ if (member && !(0, _1.isMemberInstance)(member)) {
156
+ throw new _1.DisTubeError("INVALID_TYPE", "Discord.GuildMember", member, "options.member");
157
+ }
151
158
  try {
152
159
  if (typeof song === "string") {
153
160
  for (const plugin of this.customPlugins) {
@@ -219,33 +226,6 @@ class DisTube extends tiny_typed_emitter_1.TypedEmitter {
219
226
  this.emitError(e, textChannel);
220
227
  }
221
228
  }
222
- /**
223
- * Play / add a song or playlist from url. Search and play a song if it is not a valid url.
224
- *
225
- * @returns {Promise<void>}
226
- * @param {Discord.BaseGuildVoiceChannel} voiceChannel The voice channel will be joined
227
- * @param {string|Song|SearchResult|Playlist} song URL | Search string |
228
- * {@link Song} | {@link SearchResult} | {@link Playlist}
229
- * @param {Object} [options] Optional options
230
- * @param {boolean} [options.skip=false]
231
- * Skip the playing song (if exists) and play the added song/playlist if `position` is 1.
232
- * If `position` is defined and not equal to 1, it will skip to the next song instead of the added song
233
- * @param {number} [options.position=0] Position of the song/playlist to add to the queue,
234
- * <= 0 to add to the end of the queue.
235
- * @param {boolean} [options.unshift=false] (DEPRECATED) Add the song/playlist to the beginning of the queue
236
- * (after the playing song if exists)
237
- * @param {Discord.GuildMember} [options.member] Requested user (default is your bot)
238
- * @param {Discord.BaseGuildTextChannel} [options.textChannel] Default {@link Queue#textChannel}
239
- * @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)
240
- * @param {*} [options.metadata] Optional metadata that can be attached to the song/playlist will be played,
241
- * This is useful for identification purposes when the song/playlist is passed around in events.
242
- * See {@link Song#metadata} or {@link Playlist#metadata}
243
- * @deprecated Use {@link DisTube#play} instead
244
- */
245
- async playVoiceChannel(voiceChannel, song, options = {}) {
246
- process.emitWarning("DisTube#playVoiceChannel is deprecated, use DisTube#play instead.", "DeprecationWarning");
247
- return this.play(voiceChannel, song, options);
248
- }
249
229
  /**
250
230
  * Create a custom playlist
251
231
  * @returns {Promise<Playlist>}
@@ -292,73 +272,6 @@ class DisTube extends tiny_typed_emitter_1.TypedEmitter {
292
272
  }
293
273
  return new _1.Playlist(resolvedSongs, { member, properties, metadata });
294
274
  }
295
- /**
296
- * <info>Shorthand method of {@link DisTube#createCustomPlaylist} and {@link DisTube#play}
297
- *
298
- * If you doesn't have a user message (interaction,...),
299
- * see {@link DisTube#createCustomPlaylist} example</info>
300
- *
301
- * Play or add array of video urls.
302
- * {@link DisTube#event:playSong} or {@link DisTube#event:addList} will be emitted
303
- * with `playlist`'s properties include `properties` parameter's properties such as
304
- * `user`, `songs`, `duration`, `formattedDuration`, `thumbnail` like {@link Playlist}
305
- * @returns {Promise<void>}
306
- * @param {Discord.Message} message A message from guild channel
307
- * @param {Array<string|Song|SearchResult>} songs Array of url, Song or SearchResult
308
- * @param {Object} [properties={}] Additional properties for playlist such as `name`
309
- * @param {Object} [options] Optional options
310
- * @param {boolean} [options.skip=false] Skip the playing song (if exists) and play the added song/playlist instantly
311
- * @param {boolean} [options.unshift=false] Add the song/playlist to the beginning of the queue
312
- * (after the playing song if exists)
313
- * @param {boolean} [options.parallel=true] Whether or not fetch the songs in parallel
314
- * @deprecated Use {@link DisTube#createCustomPlaylist} and {@link DisTube#play} instead
315
- */
316
- async playCustomPlaylist(message, songs, properties = {}, options = {}) {
317
- process.emitWarning("DisTube#playCustomPlaylist is deprecated, use DisTube#createCustomPlaylist and DisTube#play instead.", "DeprecationWarning");
318
- try {
319
- if (!(0, util_1.isObject)(options))
320
- throw new _1.DisTubeError("INVALID_TYPE", "object", options, "options");
321
- // eslint-disable-next-line deprecation/deprecation
322
- const { skip, unshift, parallel, metadata } = {
323
- skip: false,
324
- unshift: false,
325
- parallel: true,
326
- ...options,
327
- };
328
- let position = Number(options.position);
329
- if (!position) {
330
- if (skip && position !== 0)
331
- position = 1;
332
- else
333
- position = 0;
334
- }
335
- if (unshift)
336
- position = 1;
337
- const queue = this.getQueue(message);
338
- const queuing = queue && !queue.taskQueue.hasResolveTask;
339
- if (queuing)
340
- await queue?.taskQueue.queuing(true);
341
- try {
342
- const playlist = await this.createCustomPlaylist(songs, {
343
- member: message.member ?? undefined,
344
- properties,
345
- parallel,
346
- metadata,
347
- });
348
- const voice = message.member?.voice?.channel;
349
- if (!voice)
350
- throw new _1.DisTubeError("NOT_IN_VOICE");
351
- await this.play(voice, playlist, { textChannel: message.channel, skip, position, metadata });
352
- }
353
- finally {
354
- if (queuing)
355
- queue?.taskQueue.resolve();
356
- }
357
- }
358
- catch (e) {
359
- this.emitError(e, message.channel);
360
- }
361
- }
362
275
  /**
363
276
  * Search for a song. You can customize how user answers instead of send a number.
364
277
  * Then use {@link DisTube#play} to play it.
@@ -1 +1 @@
1
- {"version":3,"file":"DisTube.js","sourceRoot":"","sources":["../src/DisTube.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAiC;AACjC,yDAAiC;AACj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AI,CAAC,OAAO,IAAI,CAAC,IAAA,wBAAqB,EAAC,OAAO,CAAC,EAAE;YAC/C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;SACzE;aAAM,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;YACzC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;SACpC;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YACzC,OAAO,CAAC,IAAI,CACV,6IAA6I,CAC9I,CAAC;SACH;IACH,CAAC;CAEF;AAryBD,0BAqyBC;AAED,kBAAe,OAAO,CAAC;AAEvB;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AAEH;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;;;;;GAMG","sourcesContent":["import ytpl from \"@distube/ytpl\";\nimport ytsr from \"@distube/ytsr\";\nimport { checkIntents, isObject, isURL } from \"./util\";\nimport { TypedEmitter } from \"tiny-typed-emitter\";\nimport {\n DisTubeError,\n DisTubeHandler,\n DisTubeVoiceManager,\n HTTPPlugin,\n HTTPSPlugin,\n Options,\n Playlist,\n Queue,\n QueueManager,\n SearchResult,\n Song,\n YouTubeDLPlugin,\n defaultFilters,\n isClientInstance,\n isMemberInstance,\n isMessageInstance,\n isSupportedVoiceChannel,\n isTextChannelInstance,\n} from \".\";\nimport type { Client, GuildMember, GuildTextBasedChannel, Message, TextChannel, VoiceBasedChannel } from \"discord.js\";\nimport type { CustomPlugin, DisTubeEvents, DisTubeOptions, ExtractorPlugin, Filters, GuildIdResolvable } from \".\";\n\n// TODO: remove deprecated stuff on the next major version\n\n// Cannot be `import` as it's not under TS root dir\n// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports\nexport const { version }: { version: string } = require(\"../package.json\");\n\n/**\n * DisTube class\n * @extends EventEmitter\n */\nexport class DisTube extends TypedEmitter<DisTubeEvents> {\n readonly handler: DisTubeHandler;\n readonly options: Options;\n readonly client: Client;\n readonly queues: QueueManager;\n readonly voices: DisTubeVoiceManager;\n readonly extractorPlugins: ExtractorPlugin[];\n readonly customPlugins: CustomPlugin[];\n readonly filters: Filters;\n /**\n * Create a new DisTube class.\n * @param {Discord.Client} client Discord.JS client\n * @param {DisTubeOptions} [otp] Custom DisTube options\n * @example\n * const Discord = require('discord.js'),\n * DisTube = require('distube'),\n * client = new Discord.Client();\n * // Create a new DisTube\n * const distube = new DisTube.default(client, { searchSongs: 10 });\n * // client.DisTube = distube // make it access easily\n * client.login(\"Your Discord Bot Token\")\n */\n constructor(client: Client, otp: DisTubeOptions = {}) {\n super();\n this.setMaxListeners(1);\n if (!isClientInstance(client)) throw new DisTubeError(\"INVALID_TYPE\", \"Discord.Client\", client, \"client\");\n /**\n * Discord.JS client\n * @type {Discord.Client}\n */\n this.client = client;\n checkIntents(client.options);\n /**\n * DisTube options\n * @type {DisTubeOptions}\n */\n this.options = new Options(otp);\n /**\n * Voice connections manager\n * @type {DisTubeVoiceManager}\n */\n this.voices = new DisTubeVoiceManager(this);\n /**\n * DisTube's Handler\n * @type {DisTubeHandler}\n * @private\n */\n this.handler = new DisTubeHandler(this);\n /**\n * Queues manager\n * @type {QueueManager}\n */\n this.queues = new QueueManager(this);\n /**\n * DisTube filters\n * @type {Filters}\n */\n this.filters = { ...defaultFilters, ...this.options.customFilters };\n // Default plugin\n this.options.plugins.push(new HTTPPlugin(), new HTTPSPlugin());\n if (this.options.youtubeDL) this.options.plugins.push(new YouTubeDLPlugin(this.options.updateYouTubeDL));\n this.options.plugins.map(p => p.init(this));\n /**\n * Extractor Plugins\n * @type {ExtractorPlugin[]}\n * @private\n */\n this.extractorPlugins = this.options.plugins.filter((p): p is ExtractorPlugin => p.type === \"extractor\");\n /**\n * Custom Plugins\n * @type {CustomPlugin[]}\n * @private\n */\n this.customPlugins = this.options.plugins.filter((p): p is CustomPlugin => p.type === \"custom\");\n }\n\n static get version() {\n return version;\n }\n\n /**\n * DisTube version\n * @type {string}\n */\n get version() {\n return version;\n }\n\n /**\n * Play / add a song or playlist from url. Search and play a song if it is not a valid url.\n *\n * @param {Discord.BaseGuildVoiceChannel} voiceChannel The voice channel will be joined\n * @param {string|Song|SearchResult|Playlist} song URL | Search string |\n * {@link Song} | {@link SearchResult} | {@link Playlist}\n * @param {Object} [options] Optional options\n * @param {boolean} [options.skip=false]\n * Skip the playing song (if exists) and play the added song/playlist if `position` is 1.\n * If `position` is defined and not equal to 1, it will skip to the next song instead of the added song\n * @param {number} [options.position=0] Position of the song/playlist to add to the queue,\n * <= 0 to add to the end of the queue.\n * @param {boolean} [options.unshift=false] (DEPRECATED) Add the song/playlist to the beginning of the queue\n * (after the playing song if exists)\n * @param {Discord.GuildMember} [options.member] Requested user (default is your bot)\n * @param {Discord.BaseGuildTextChannel} [options.textChannel] Default {@link Queue#textChannel}\n * @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)\n * @param {*} [options.metadata] Optional metadata that can be attached to the song/playlist will be played,\n * This is useful for identification purposes when the song/playlist is passed around in events.\n * See {@link Song#metadata} or {@link Playlist#metadata}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"play\")\n * distube.play(message.member.voice?.channel, args.join(\" \"), {\n * member: message.member,\n * textChannel: message.channel,\n * message\n * });\n * });\n * @returns {Promise<void>}\n */\n async play(\n voiceChannel: VoiceBasedChannel,\n song: string | Song | SearchResult | Playlist,\n options?: {\n skip?: boolean;\n position?: number;\n member?: GuildMember;\n textChannel?: GuildTextBasedChannel;\n message?: Message;\n metadata?: any;\n },\n ): Promise<void>;\n /** @deprecated Message parameter is deprecated, use VoiceChannel instead. */\n async play(\n message: Message<true>,\n song: string | Song | SearchResult | Playlist,\n options?: { skip?: boolean; unshift?: boolean; metadata?: any },\n ): Promise<void>;\n /** @deprecated `options.unshift` is deprecated, use `options.position` instead */\n async play(\n voiceChannel: VoiceBasedChannel,\n song: string | Song | SearchResult | Playlist,\n options?: {\n skip?: boolean;\n /** @deprecated Use `options.position` instead */\n unshift?: boolean;\n position?: number;\n member?: GuildMember;\n textChannel?: GuildTextBasedChannel;\n message?: Message;\n metadata?: any;\n },\n ): Promise<void>;\n async play(\n voiceChannel: Message<true> | VoiceBasedChannel,\n song: string | Song | SearchResult | Playlist,\n options: {\n skip?: boolean;\n unshift?: boolean;\n position?: number;\n member?: GuildMember;\n textChannel?: GuildTextBasedChannel;\n message?: Message;\n metadata?: any;\n } = {},\n ): Promise<void> {\n if (isMessageInstance(voiceChannel)) {\n process.emitWarning(\n \"Passing Message for DisTube#play is deprecated, use BaseGuildVoiceChannel instead.\",\n \"DeprecationWarning\",\n );\n const message = voiceChannel;\n if (!song) throw new DisTubeError(\"INVALID_TYPE\", [\"string\", \"Song\", \"SearchResult\", \"Playlist\"], song, \"song\");\n if (!isMessageInstance(message)) throw new DisTubeError(\"INVALID_TYPE\", \"Discord.Message\", message, \"message\");\n if (!isObject(options)) throw new DisTubeError(\"INVALID_TYPE\", \"object\", options, \"options\");\n\n const textChannel = message.channel;\n const { skip, unshift, metadata } = { skip: false, unshift: false, ...options };\n const member = message.member as GuildMember;\n const vc = member.voice.channel;\n if (!vc) throw new DisTubeError(\"NOT_IN_VOICE\");\n // eslint-disable-next-line deprecation/deprecation\n return this.play(vc, song, {\n member,\n textChannel,\n skip,\n message,\n unshift,\n metadata,\n });\n }\n\n if (!isSupportedVoiceChannel(voiceChannel)) {\n throw new DisTubeError(\"INVALID_TYPE\", \"BaseGuildVoiceChannel\", voiceChannel, \"voiceChannel\");\n }\n if (!isObject(options)) throw new DisTubeError(\"INVALID_TYPE\", \"object\", options, \"options\");\n\n // eslint-disable-next-line deprecation/deprecation\n const { textChannel, member, skip, message, unshift, metadata } = {\n member: voiceChannel.guild.me ?? undefined,\n skip: false,\n unshift: false,\n ...options,\n };\n\n let position = Number(options.position);\n if (!position) {\n if (skip && position !== 0) position = 1;\n else position = 0;\n }\n\n if (unshift) {\n process.emitWarning(\n \"'unshift' option in DisTube#play is deprecated, use 'position' instead.\",\n \"DeprecationWarning\",\n );\n position = 1;\n }\n\n if (message && !isMessageInstance(message)) {\n throw new DisTubeError(\"INVALID_TYPE\", [\"Discord.Message\", \"a falsy value\"], message, \"options.message\");\n }\n try {\n if (typeof song === \"string\") {\n for (const plugin of this.customPlugins) {\n if (await plugin.validate(song)) {\n return plugin.play(voiceChannel, song, options);\n }\n }\n }\n let queue = this.getQueue(voiceChannel);\n const queuing = !!queue && !queue.taskQueue.hasResolveTask;\n if (queuing) await queue?.taskQueue.queuing(true);\n try {\n if (song instanceof SearchResult && song.type === \"playlist\") song = song.url;\n if (typeof song === \"string\" && ytpl.validateID(song)) {\n song = await this.handler.resolvePlaylist(song, { member, metadata });\n }\n if (typeof song === \"string\" && !isURL(song)) {\n if (!message) {\n song = (await this.search(song, { limit: 1 }))[0];\n } else {\n const result = await this.handler.searchSong(message, song);\n if (!result) return;\n song = result;\n }\n }\n song = await this.handler.resolveSong(song, { member, metadata });\n if (song instanceof Playlist) {\n await this.handler.handlePlaylist(voiceChannel, song, { textChannel, skip, position });\n } else if (!this.options.nsfw && song.age_restricted && !(textChannel as TextChannel)?.nsfw) {\n throw new DisTubeError(\"NON_NSFW\");\n } else {\n queue = this.getQueue(voiceChannel);\n if (queue) {\n queue.addToQueue(song, position);\n if (skip) queue.skip();\n else this.emit(\"addSong\", queue, song);\n } else {\n const newQueue = await this.queues.create(voiceChannel, song, textChannel);\n if (newQueue instanceof Queue) {\n if (this.options.emitAddSongWhenCreatingQueue) this.emit(\"addSong\", newQueue, song);\n this.emit(\"playSong\", newQueue, song);\n }\n }\n }\n } finally {\n if (queuing) queue?.taskQueue.resolve();\n }\n } catch (e: any) {\n if (!(e instanceof DisTubeError)) {\n try {\n e.name = \"PlayError\";\n e.message = `${(song as Song)?.url || song}\\n${e.message}`;\n } catch {}\n }\n this.emitError(e, textChannel);\n }\n }\n\n /**\n * Play / add a song or playlist from url. Search and play a song if it is not a valid url.\n *\n * @returns {Promise<void>}\n * @param {Discord.BaseGuildVoiceChannel} voiceChannel The voice channel will be joined\n * @param {string|Song|SearchResult|Playlist} song URL | Search string |\n * {@link Song} | {@link SearchResult} | {@link Playlist}\n * @param {Object} [options] Optional options\n * @param {boolean} [options.skip=false]\n * Skip the playing song (if exists) and play the added song/playlist if `position` is 1.\n * If `position` is defined and not equal to 1, it will skip to the next song instead of the added song\n * @param {number} [options.position=0] Position of the song/playlist to add to the queue,\n * <= 0 to add to the end of the queue.\n * @param {boolean} [options.unshift=false] (DEPRECATED) Add the song/playlist to the beginning of the queue\n * (after the playing song if exists)\n * @param {Discord.GuildMember} [options.member] Requested user (default is your bot)\n * @param {Discord.BaseGuildTextChannel} [options.textChannel] Default {@link Queue#textChannel}\n * @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)\n * @param {*} [options.metadata] Optional metadata that can be attached to the song/playlist will be played,\n * This is useful for identification purposes when the song/playlist is passed around in events.\n * See {@link Song#metadata} or {@link Playlist#metadata}\n * @deprecated Use {@link DisTube#play} instead\n */\n async playVoiceChannel(\n voiceChannel: VoiceBasedChannel,\n song: string | Song | SearchResult | Playlist,\n options: {\n skip?: boolean;\n unshift?: boolean;\n position?: number;\n member?: GuildMember;\n textChannel?: GuildTextBasedChannel;\n message?: Message;\n metadata?: any;\n } = {},\n ): Promise<void> {\n process.emitWarning(\"DisTube#playVoiceChannel is deprecated, use DisTube#play instead.\", \"DeprecationWarning\");\n return this.play(voiceChannel, song, options);\n }\n\n /**\n * Create a custom playlist\n * @returns {Promise<Playlist>}\n * @param {Array<string|Song|SearchResult>} songs Array of url, Song or SearchResult\n * @param {Object} [options] Optional options\n * @param {Discord.GuildMember} [options.message] A message from guild channel | A guild member\n * @param {Object} [options.properties] Additional properties such as `name`\n * @param {boolean} [options.parallel=true] Whether or not fetch the songs in parallel\n * @param {*} [options.metadata] Metadata\n * @example\n * const songs = [\"https://www.youtube.com/watch?v=xxx\", \"https://www.youtube.com/watch?v=yyy\"];\n * const playlist = await distube.createCustomPlaylist(songs, {\n * member: message.member,\n * properties: { name: \"My playlist name\" },\n * parallel: true\n * });\n * distube.play(voiceChannel, playlist, { ... });\n */\n async createCustomPlaylist(\n songs: (string | Song | SearchResult)[],\n options: {\n member?: GuildMember;\n properties?: Record<string, any>;\n parallel?: boolean;\n metadata?: any;\n } = {},\n ): Promise<Playlist> {\n const { member, properties, parallel, metadata } = { parallel: true, ...options };\n if (!Array.isArray(songs)) throw new DisTubeError(\"INVALID_TYPE\", \"Array\", songs, \"songs\");\n if (!songs.length) throw new DisTubeError(\"EMPTY_ARRAY\", \"songs\");\n const filteredSongs = songs.filter(\n song => song instanceof Song || (song instanceof SearchResult && song.type === \"video\") || isURL(song),\n );\n if (!filteredSongs.length) throw new DisTubeError(\"NO_VALID_SONG\");\n if (member && !isMemberInstance(member)) {\n throw new DisTubeError(\"INVALID_TYPE\", \"Discord.Member\", member, \"options.member\");\n }\n if (!filteredSongs.length) throw new DisTubeError(\"NO_VALID_SONG\");\n let resolvedSongs: Song[];\n if (parallel) {\n const promises = filteredSongs.map((song: string | Song | SearchResult) =>\n this.handler.resolveSong(song, { member, metadata }).catch(() => undefined),\n );\n resolvedSongs = (await Promise.all(promises)).filter((s: any): s is Song => !!s);\n } else {\n const resolved = [];\n for (const song of filteredSongs) {\n resolved.push(await this.handler.resolveSong(song, { member, metadata }).catch(() => undefined));\n }\n resolvedSongs = resolved.filter((s: any): s is Song => !!s);\n }\n return new Playlist(resolvedSongs, { member, properties, metadata });\n }\n\n /**\n * <info>Shorthand method of {@link DisTube#createCustomPlaylist} and {@link DisTube#play}\n *\n * If you doesn't have a user message (interaction,...),\n * see {@link DisTube#createCustomPlaylist} example</info>\n *\n * Play or add array of video urls.\n * {@link DisTube#event:playSong} or {@link DisTube#event:addList} will be emitted\n * with `playlist`'s properties include `properties` parameter's properties such as\n * `user`, `songs`, `duration`, `formattedDuration`, `thumbnail` like {@link Playlist}\n * @returns {Promise<void>}\n * @param {Discord.Message} message A message from guild channel\n * @param {Array<string|Song|SearchResult>} songs Array of url, Song or SearchResult\n * @param {Object} [properties={}] Additional properties for playlist such as `name`\n * @param {Object} [options] Optional options\n * @param {boolean} [options.skip=false] Skip the playing song (if exists) and play the added song/playlist instantly\n * @param {boolean} [options.unshift=false] Add the song/playlist to the beginning of the queue\n * (after the playing song if exists)\n * @param {boolean} [options.parallel=true] Whether or not fetch the songs in parallel\n * @deprecated Use {@link DisTube#createCustomPlaylist} and {@link DisTube#play} instead\n */\n async playCustomPlaylist(\n message: Message<true>,\n songs: Array<string | Song | SearchResult>,\n properties: Record<string, any> = {},\n options: {\n skip?: boolean;\n /** @deprecated */\n unshift?: boolean;\n position?: number;\n parallel?: boolean;\n metadata?: any;\n } = {},\n ): Promise<void> {\n process.emitWarning(\n \"DisTube#playCustomPlaylist is deprecated, use DisTube#createCustomPlaylist and DisTube#play instead.\",\n \"DeprecationWarning\",\n );\n try {\n if (!isObject(options)) throw new DisTubeError(\"INVALID_TYPE\", \"object\", options, \"options\");\n\n // eslint-disable-next-line deprecation/deprecation\n const { skip, unshift, parallel, metadata } = {\n skip: false,\n unshift: false,\n parallel: true,\n ...options,\n };\n\n let position = Number(options.position);\n if (!position) {\n if (skip && position !== 0) position = 1;\n else position = 0;\n }\n\n if (unshift) position = 1;\n\n const queue = this.getQueue(message);\n const queuing = queue && !queue.taskQueue.hasResolveTask;\n if (queuing) await queue?.taskQueue.queuing(true);\n try {\n const playlist = await this.createCustomPlaylist(songs, {\n member: message.member ?? undefined,\n properties,\n parallel,\n metadata,\n });\n const voice = message.member?.voice?.channel;\n if (!voice) throw new DisTubeError(\"NOT_IN_VOICE\");\n await this.play(voice, playlist, { textChannel: message.channel, skip, position, metadata });\n } finally {\n if (queuing) queue?.taskQueue.resolve();\n }\n } catch (e: any) {\n this.emitError(e, message.channel);\n }\n }\n\n /**\n * Search for a song. You can customize how user answers instead of send a number.\n * Then use {@link DisTube#play} to play it.\n *\n * @param {string} string The string search for\n * @param {Object} options Search options\n * @param {number} [options.limit=10] Limit the results\n * @param {'video'|'playlist'} [options.type='video'] Type of results (`video` or `playlist`).\n * @param {boolean} [options.safeSearch=false] Whether or not use safe search (YouTube restricted mode)\n * @throws {Error}\n * @returns {Promise<Array<SearchResult>>} Array of results\n */\n async search(\n string: string,\n options: { type?: \"video\" | \"playlist\"; limit?: number; safeSearch?: boolean; retried?: boolean } = {},\n ): Promise<Array<SearchResult>> {\n const opts = { type: \"video\" as const, limit: 10, safeSearch: false, ...options };\n if (typeof opts.type !== \"string\" || ![\"video\", \"playlist\"].includes(opts.type)) {\n throw new DisTubeError(\"INVALID_TYPE\", [\"video\", \"playlist\"], opts.type, \"options.type\");\n }\n if (typeof opts.limit !== \"number\") throw new DisTubeError(\"INVALID_TYPE\", \"number\", opts.limit, \"options.limit\");\n if (opts.limit < 1) throw new DisTubeError(\"NUMBER_COMPARE\", \"option.limit\", \"bigger or equal to\", 1);\n if (typeof opts.safeSearch !== \"boolean\") {\n throw new DisTubeError(\"INVALID_TYPE\", \"boolean\", opts.safeSearch, \"options.safeSearch\");\n }\n\n try {\n const search = await ytsr(string, opts);\n const results = search.items.map(i => new SearchResult(i));\n if (results.length === 0) throw new DisTubeError(\"NO_RESULT\");\n return results;\n } catch (e) {\n if (options.retried) throw e;\n options.retried = true;\n return this.search(string, options);\n }\n }\n\n /**\n * Get the guild queue\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Queue?}\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"queue\") {\n * const queue = distube.getQueue(message);\n * message.channel.send('Current queue:\\n' + queue.songs.map((song, id) =>\n * `**${id+1}**. [${song.name}](${song.url}) - \\`${song.formattedDuration}\\``\n * ).join(\"\\n\"));\n * }\n * });\n */\n getQueue(queue: GuildIdResolvable): Queue | undefined {\n return this.queues.get(queue);\n }\n\n /**\n * Pause the guild stream\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Queue} The guild queue\n * @throws {Error}\n */\n pause(queue: GuildIdResolvable): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.pause();\n }\n\n /**\n * Resume the guild stream\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Queue} The guild queue\n * @throws {Error}\n */\n resume(queue: GuildIdResolvable): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.resume();\n }\n\n /**\n * Stop the guild stream\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<void>}\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"stop\") {\n * distube.stop(message);\n * message.channel.send(\"Stopped the queue!\");\n * }\n * });\n */\n stop(queue: GuildIdResolvable): Promise<void> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.stop();\n }\n\n /**\n * Set the guild stream's volume\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {number} percent The percentage of volume you want to set\n * @returns {Queue} The guild queue\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"volume\")\n * distube.setVolume(message, Number(args[0]));\n * });\n */\n setVolume(queue: GuildIdResolvable, percent: number): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.setVolume(percent);\n }\n\n /**\n * Skip the playing song if there is a next song in the queue.\n * <info>If {@link Queue#autoplay} is `true` and there is no up next song,\n * DisTube will add and play a related song.</info>\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Song>} The new Song will be played\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"skip\")\n * distube.skip(message);\n * });\n */\n skip(queue: GuildIdResolvable): Promise<Song> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.skip();\n }\n\n /**\n * Play the previous song\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Song>} The new Song will be played\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"previous\")\n * distube.previous(message);\n * });\n */\n previous(queue: GuildIdResolvable): Promise<Song> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.previous();\n }\n\n /**\n * Shuffle the guild queue songs\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Queue>} The guild queue\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"shuffle\")\n * distube.shuffle(message);\n * });\n */\n shuffle(queue: GuildIdResolvable): Promise<Queue> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.shuffle();\n }\n\n /**\n * Jump to the song number in the queue.\n * The next one is 1, 2,...\n * The previous one is -1, -2,...\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {number} num The song number to play\n * @returns {Promise<Queue>} The guild queue\n * @throws {Error} if `num` is invalid number (0 < num < {@link Queue#songs}.length)\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"jump\")\n * distube.jump(message, parseInt(args[0]))\n * .catch(err => message.channel.send(\"Invalid song number.\"));\n * });\n */\n jump(queue: GuildIdResolvable, num: number): Promise<Queue> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.jump(num);\n }\n\n /**\n * Set the repeat mode of the guild queue.\\\n * Toggle mode `(Disabled -> Song -> Queue -> Disabled ->...)` if `mode` is `undefined`\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {RepeatMode?} [mode] The repeat modes (toggle if `undefined`)\n * @returns {RepeatMode} The new repeat mode\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"repeat\") {\n * let mode = distube.setRepeatMode(message, parseInt(args[0]));\n * mode = mode ? mode == 2 ? \"Repeat queue\" : \"Repeat song\" : \"Off\";\n * message.channel.send(\"Set repeat mode to `\" + mode + \"`\");\n * }\n * });\n * @example\n * const { RepeatMode } = require(\"distube\");\n * let mode;\n * switch(distube.setRepeatMode(message, parseInt(args[0]))) {\n * case RepeatMode.DISABLED:\n * mode = \"Off\";\n * break;\n * case RepeatMode.SONG:\n * mode = \"Repeat a song\";\n * break;\n * case RepeatMode.QUEUE:\n * mode = \"Repeat all queue\";\n * break;\n * }\n * message.channel.send(\"Set repeat mode to `\" + mode + \"`\");\n */\n setRepeatMode(queue: GuildIdResolvable, mode?: number): number {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.setRepeatMode(mode);\n }\n\n /**\n * Toggle autoplay mode\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {boolean} Autoplay mode state\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"autoplay\") {\n * const mode = distube.toggleAutoplay(message);\n * message.channel.send(\"Set autoplay mode to `\" + (mode ? \"On\" : \"Off\") + \"`\");\n * }\n * });\n */\n toggleAutoplay(queue: GuildIdResolvable): boolean {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n q.autoplay = !q.autoplay;\n return q.autoplay;\n }\n\n /**\n * Add related song to the queue\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Song>} The guild queue\n */\n addRelatedSong(queue: GuildIdResolvable): Promise<Song> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.addRelatedSong();\n }\n\n /**\n * Enable or disable filter(s) of the queue.\n * Available filters: {@link Filters}\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {string|false} filter A filter name, `false` to clear all the filters\n * @param {boolean} [force=false] Force enable the input filter(s) even if it's enabled\n * @returns {Array<string>} Enabled filters.\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if ([`3d`, `bassboost`, `echo`, `karaoke`, `nightcore`, `vaporwave`].includes(command)) {\n * const filter = distube.setFilter(message, command);\n * message.channel.send(\"Current queue filter: \" + (filter.join(\", \") || \"Off\"));\n * }\n * });\n */\n setFilter(queue: GuildIdResolvable, filter: string | false, force = false): Array<string> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.setFilter(filter, force);\n }\n\n /**\n * Set the playing time to another position\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {number} time Time in seconds\n * @returns {Queue} Seeked queue\n * @example\n * client.on('message', message => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command = 'seek')\n * distube.seek(message, Number(args[0]));\n * });\n */\n seek(queue: GuildIdResolvable, time: number): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.seek(time);\n }\n\n /* eslint-disable no-console */\n /**\n * Emit error event\n * @param {Error} error error\n * @param {Discord.BaseGuildTextChannel} [channel] Text channel where the error is encountered.\n * @private\n */\n emitError(error: Error, channel?: GuildTextBasedChannel): void {\n if (!channel || !isTextChannelInstance(channel)) {\n console.error(error);\n console.warn(\"This is logged because <Queue>.textChannel is undefined\");\n } else if (this.listeners(\"error\").length) {\n this.emit(\"error\", channel, error);\n } else {\n console.error(error);\n console.warn(\"Unhandled 'error' event.\");\n console.warn(\n \"See: https://distube.js.org/#/docs/DisTube/stable/class/DisTube?scrollTo=e-error and https://nodejs.org/api/events.html#events_error_events\",\n );\n }\n }\n /* eslint-enable no-console */\n}\n\nexport default DisTube;\n\n/**\n * Emitted after DisTube add a new playlist to the playing {@link Queue}.\n *\n * @event DisTube#addList\n * @param {Queue} queue The guild queue\n * @param {Playlist} playlist Playlist info\n * @example\n * distube.on(\"addList\", (queue, playlist) => queue.textChannel.send(\n * `Added \\`${playlist.name}\\` playlist (${playlist.songs.length} songs) to the queue!`\n * ));\n */\n\n/**\n * Emitted after DisTube add a new song to the playing {@link Queue}.\n *\n * @event DisTube#addSong\n * @param {Queue} queue The guild queue\n * @param {Song} song Added song\n * @example\n * distube.on(\"addSong\", (queue, song) => queue.textChannel.send(\n * `Added ${song.name} - \\`${song.formattedDuration}\\` to the queue by ${song.user}.`\n * ));\n */\n\n/**\n * Emitted when there is no user in the voice channel,\n * {@link DisTubeOptions}.leaveOnEmpty is `true` and there is a playing queue.\n *\n * If there is no playing queue (stopped and {@link DisTubeOptions}.leaveOnStop is `false`),\n * it will leave the channel without emitting this event.\n * @event DisTube#empty\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"empty\", queue => queue.textChannel.send(\"Channel is empty. Leaving the channel\"))\n */\n\n/**\n * Emitted when DisTube encounters an error.\n *\n * @event DisTube#error\n * @param {Discord.BaseGuildTextChannel} channel Text channel where the error is encountered.\n * @param {Error} error The error encountered\n * @example\n * distube.on(\"error\", (channel, error) => channel.send(\n * \"An error encountered: \" + error\n * ));\n */\n\n/**\n * Emitted when there is no more song in the queue and {@link Queue#autoplay} is `false`.\n * DisTube will leave voice channel if {@link DisTubeOptions}.leaveOnFinish is `true`.\n *\n * @event DisTube#finish\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"finish\", queue => queue.textChannel.send(\"No more song in queue\"));\n */\n\n/**\n * Emitted when DisTube initialize a queue to change queue default properties.\n *\n * @event DisTube#initQueue\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"initQueue\", queue => {\n * queue.autoplay = false;\n * queue.volume = 100;\n * });\n */\n\n/**\n * Emitted when {@link Queue#autoplay} is `true`, {@link Queue#songs} is empty,\n * and DisTube cannot find related songs to play.\n *\n * @event DisTube#noRelated\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"noRelated\", queue => queue.textChannel.send(\"Can't find related video to play.\"));\n */\n\n/**\n * Emitted when DisTube play a song.\n *\n * If {@link DisTubeOptions}.emitNewSongOnly is `true`,\n * this event is not emitted when looping a song or next song is the previous one.\n *\n * @event DisTube#playSong\n * @param {Queue} queue The guild queue\n * @param {Song} song Playing song\n * @example\n * distube.on(\"playSong\", (queue, song) => queue.textChannel.send(\n * `Playing \\`${song.name}\\` - \\`${song.formattedDuration}\\`\\nRequested by: ${song.user}`\n * ));\n */\n\n/**\n * Emitted when DisTube cannot find any results for the query.\n *\n * @event DisTube#searchNoResult\n * @param {Discord.Message} message The user message called play method\n * @param {string} query The search query\n * @example\n * distube.on(\"searchNoResult\", (message, query) => message.channel.send(`No result found for ${query}!`));\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,\n * and song param of {@link DisTube#play} is invalid url.\n * DisTube will wait for user's next message to choose a song manually.\n * <info>{@link https://support.google.com/youtube/answer/7354993|Safe search} is enabled\n * if {@link DisTubeOptions}.nsfw is disabled and the message's channel is not a nsfw channel.</info>\n *\n * @event DisTube#searchResult\n * @param {Discord.Message} message The user message called play method\n * @param {Array<SearchResult>} results Searched results\n * @param {string} query The search query\n * @example\n * // DisTubeOptions.searchSongs > 0\n * distube.on(\"searchResult\", (message, results) => {\n * message.channel.send(`**Choose an option from below**\\n${\n * results.map((song, i) => `**${i + 1}**. ${song.name} - \\`${song.formattedDuration}\\``).join(\"\\n\")\n * }\\n*Enter anything else or wait 60 seconds to cancel*`);\n * });\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,\n * and the search canceled due to {@link DisTubeOptions|DisTubeOptions.searchTimeout}.\n *\n * @event DisTube#searchCancel\n * @param {Discord.Message} message The user message called play method\n * @param {string} query The search query\n * @example\n * // DisTubeOptions.searchSongs > 0\n * distube.on(\"searchCancel\", (message) => message.channel.send(`Searching canceled`));\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,\n * and the search canceled due to user's next message is not a number or out of results range.\n *\n * @event DisTube#searchInvalidAnswer\n * @param {Discord.Message} message The user message called play method\n * @param {Discord.Message} answer The answered message of user\n * @param {string} query The search query\n * @example\n * // DisTubeOptions.searchSongs > 0\n * distube.on(\"searchInvalidAnswer\", (message) => message.channel.send(`You answered an invalid number!`));\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,\n * and after the user chose a search result to play.\n *\n * @event DisTube#searchDone\n * @param {Discord.Message} message The user message called play method\n * @param {Discord.Message} answer The answered message of user\n * @param {string} query The search query\n */\n\n/**\n * Emitted when the bot is disconnected to a voice channel.\n *\n * @event DisTube#disconnect\n * @param {Queue} queue The guild queue\n */\n\n/**\n * Emitted when a {@link Queue} is deleted with any reasons.\n *\n * @event DisTube#deleteQueue\n * @param {Queue} queue The guild queue\n */\n\n/**\n * Emitted when DisTube finished a song.\n *\n * @event DisTube#finishSong\n * @param {Queue} queue The guild queue\n * @param {Song} song Finished song\n */\n"]}
1
+ {"version":3,"file":"DisTube.js","sourceRoot":"","sources":["../src/DisTube.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAiC;AACjC,yDAAiC;AACjC,iCAAuD;AACvD,2DAAkD;AAClD,wBAkBW;AAIX,mDAAmD;AACnD,qGAAqG;AACtF,eAAO,GAA0B,OAAO,CAAC,iBAAiB,CAAC,SAAC;AAE3E;;;GAGG;AACH,MAAa,OAAQ,SAAQ,iCAA2B;IAStD;;;;;;;;;;;;OAYG;IACH,YAAY,MAAc,EAAE,MAAsB,EAAE;QAClD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,CAAC,IAAA,mBAAgB,EAAC,MAAM,CAAC;YAAE,MAAM,IAAI,eAAY,CAAC,cAAc,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC1G;;;WAGG;QACH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAA,mBAAY,EA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CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,+BAA+B;IAC/B;;;;;OAKG;IACH,SAAS,CAAC,KAAY,EAAE,OAA+B;QACrD,IAAI,CAAC,OAAO,IAAI,CAAC,IAAA,wBAAqB,EAAC,OAAO,CAAC,EAAE;YAC/C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;SACzE;aAAM,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;YACzC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;SACpC;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YACzC,OAAO,CAAC,IAAI,CACV,6IAA6I,CAC9I,CAAC;SACH;IACH,CAAC;CAEF;AAhnBD,0BAgnBC;AAED,kBAAe,OAAO,CAAC;AAEvB;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AAEH;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;;;;;GAMG","sourcesContent":["import ytpl from \"@distube/ytpl\";\nimport ytsr from \"@distube/ytsr\";\nimport { checkIntents, isObject, isURL } from \"./util\";\nimport { TypedEmitter } from \"tiny-typed-emitter\";\nimport {\n DisTubeError,\n DisTubeHandler,\n DisTubeVoiceManager,\n HTTPPlugin,\n HTTPSPlugin,\n Options,\n Playlist,\n Queue,\n QueueManager,\n SearchResult,\n Song,\n defaultFilters,\n isClientInstance,\n isMemberInstance,\n isMessageInstance,\n isSupportedVoiceChannel,\n isTextChannelInstance,\n} from \".\";\nimport type { Client, GuildMember, GuildTextBasedChannel, Message, TextChannel, VoiceBasedChannel } from \"discord.js\";\nimport type { CustomPlugin, DisTubeEvents, DisTubeOptions, ExtractorPlugin, Filters, GuildIdResolvable } from \".\";\n\n// Cannot be `import` as it's not under TS root dir\n// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports\nexport const { version }: { version: string } = require(\"../package.json\");\n\n/**\n * DisTube class\n * @extends EventEmitter\n */\nexport class DisTube extends TypedEmitter<DisTubeEvents> {\n readonly handler: DisTubeHandler;\n readonly options: Options;\n readonly client: Client;\n readonly queues: QueueManager;\n readonly voices: DisTubeVoiceManager;\n readonly extractorPlugins: ExtractorPlugin[];\n readonly customPlugins: CustomPlugin[];\n readonly filters: Filters;\n /**\n * Create a new DisTube class.\n * @param {Discord.Client} client Discord.JS client\n * @param {DisTubeOptions} [otp] Custom DisTube options\n * @example\n * const Discord = require('discord.js'),\n * DisTube = require('distube'),\n * client = new Discord.Client();\n * // Create a new DisTube\n * const distube = new DisTube.default(client, { searchSongs: 10 });\n * // client.DisTube = distube // make it access easily\n * client.login(\"Your Discord Bot Token\")\n */\n constructor(client: Client, otp: DisTubeOptions = {}) {\n super();\n this.setMaxListeners(1);\n if (!isClientInstance(client)) throw new DisTubeError(\"INVALID_TYPE\", \"Discord.Client\", client, \"client\");\n /**\n * Discord.JS client\n * @type {Discord.Client}\n */\n this.client = client;\n checkIntents(client.options);\n /**\n * DisTube options\n * @type {DisTubeOptions}\n */\n this.options = new Options(otp);\n /**\n * Voice connections manager\n * @type {DisTubeVoiceManager}\n */\n this.voices = new DisTubeVoiceManager(this);\n /**\n * DisTube's Handler\n * @type {DisTubeHandler}\n * @private\n */\n this.handler = new DisTubeHandler(this);\n /**\n * Queues manager\n * @type {QueueManager}\n */\n this.queues = new QueueManager(this);\n /**\n * DisTube filters\n * @type {Filters}\n */\n this.filters = { ...defaultFilters, ...this.options.customFilters };\n // Default plugin\n this.options.plugins.push(new HTTPPlugin(), new HTTPSPlugin());\n this.options.plugins.map(p => p.init(this));\n /**\n * Extractor Plugins\n * @type {ExtractorPlugin[]}\n * @private\n */\n this.extractorPlugins = this.options.plugins.filter((p): p is ExtractorPlugin => p.type === \"extractor\");\n /**\n * Custom Plugins\n * @type {CustomPlugin[]}\n * @private\n */\n this.customPlugins = this.options.plugins.filter((p): p is CustomPlugin => p.type === \"custom\");\n }\n\n static get version() {\n return version;\n }\n\n /**\n * DisTube version\n * @type {string}\n */\n get version() {\n return version;\n }\n\n /**\n * Play / add a song or playlist from url. Search and play a song if it is not a valid url.\n *\n * @param {Discord.BaseGuildVoiceChannel} voiceChannel The voice channel will be joined\n * @param {string|Song|SearchResult|Playlist} song URL | Search string |\n * {@link Song} | {@link SearchResult} | {@link Playlist}\n * @param {Object} [options] Optional options\n * @param {boolean} [options.skip=false]\n * Skip the playing song (if exists) and play the added song/playlist if `position` is 1.\n * If `position` is defined and not equal to 1, it will skip to the next song instead of the added song\n * @param {number} [options.position=0] Position of the song/playlist to add to the queue,\n * <= 0 to add to the end of the queue.\n * @param {boolean} [options.unshift=false] (DEPRECATED) Add the song/playlist to the beginning of the queue\n * (after the playing song if exists)\n * @param {Discord.GuildMember} [options.member] Requested user (default is your bot)\n * @param {Discord.BaseGuildTextChannel} [options.textChannel] Default {@link Queue#textChannel}\n * @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)\n * @param {*} [options.metadata] Optional metadata that can be attached to the song/playlist will be played,\n * This is useful for identification purposes when the song/playlist is passed around in events.\n * See {@link Song#metadata} or {@link Playlist#metadata}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"play\")\n * distube.play(message.member.voice?.channel, args.join(\" \"), {\n * member: message.member,\n * textChannel: message.channel,\n * message\n * });\n * });\n * @returns {Promise<void>}\n */\n async play(\n voiceChannel: VoiceBasedChannel,\n song: string | Song | SearchResult | Playlist,\n options: {\n skip?: boolean;\n unshift?: boolean;\n position?: number;\n member?: GuildMember;\n textChannel?: GuildTextBasedChannel;\n message?: Message;\n metadata?: any;\n } = {},\n ): Promise<void> {\n if (!isSupportedVoiceChannel(voiceChannel)) {\n throw new DisTubeError(\"INVALID_TYPE\", \"BaseGuildVoiceChannel\", voiceChannel, \"voiceChannel\");\n }\n if (!isObject(options)) throw new DisTubeError(\"INVALID_TYPE\", \"object\", options, \"options\");\n\n const { textChannel, member, skip, message, metadata } = {\n member: voiceChannel.guild.me ?? undefined,\n textChannel: options?.message?.channel,\n skip: false,\n ...options,\n };\n\n let position = Number(options.position);\n if (!position) {\n if (skip && position !== 0) position = 1;\n else position = 0;\n }\n\n if (message && !isMessageInstance(message)) {\n throw new DisTubeError(\"INVALID_TYPE\", [\"Discord.Message\", \"a falsy value\"], message, \"options.message\");\n }\n if (textChannel && !isTextChannelInstance(textChannel)) {\n throw new DisTubeError(\"INVALID_TYPE\", \"Discord.GuildTextBasedChannel\", textChannel, \"options.textChannel\");\n }\n if (member && !isMemberInstance(member)) {\n throw new DisTubeError(\"INVALID_TYPE\", \"Discord.GuildMember\", member, \"options.member\");\n }\n try {\n if (typeof song === \"string\") {\n for (const plugin of this.customPlugins) {\n if (await plugin.validate(song)) {\n return plugin.play(voiceChannel, song, options);\n }\n }\n }\n let queue = this.getQueue(voiceChannel);\n const queuing = !!queue && !queue.taskQueue.hasResolveTask;\n if (queuing) await queue?.taskQueue.queuing(true);\n try {\n if (song instanceof SearchResult && song.type === \"playlist\") song = song.url;\n if (typeof song === \"string\" && ytpl.validateID(song)) {\n song = await this.handler.resolvePlaylist(song, { member, metadata });\n }\n if (typeof song === \"string\" && !isURL(song)) {\n if (!message) {\n song = (await this.search(song, { limit: 1 }))[0];\n } else {\n const result = await this.handler.searchSong(message, song);\n if (!result) return;\n song = result;\n }\n }\n song = await this.handler.resolveSong(song, { member, metadata });\n if (song instanceof Playlist) {\n await this.handler.handlePlaylist(voiceChannel, song, { textChannel, skip, position });\n } else if (!this.options.nsfw && song.age_restricted && !(textChannel as TextChannel)?.nsfw) {\n throw new DisTubeError(\"NON_NSFW\");\n } else {\n queue = this.getQueue(voiceChannel);\n if (queue) {\n queue.addToQueue(song, position);\n if (skip) queue.skip();\n else this.emit(\"addSong\", queue, song);\n } else {\n const newQueue = await this.queues.create(voiceChannel, song, textChannel);\n if (newQueue instanceof Queue) {\n if (this.options.emitAddSongWhenCreatingQueue) this.emit(\"addSong\", newQueue, song);\n this.emit(\"playSong\", newQueue, song);\n }\n }\n }\n } finally {\n if (queuing) queue?.taskQueue.resolve();\n }\n } catch (e: any) {\n if (!(e instanceof DisTubeError)) {\n try {\n e.name = \"PlayError\";\n e.message = `${(song as Song)?.url || song}\\n${e.message}`;\n } catch {}\n }\n this.emitError(e, textChannel);\n }\n }\n\n /**\n * Create a custom playlist\n * @returns {Promise<Playlist>}\n * @param {Array<string|Song|SearchResult>} songs Array of url, Song or SearchResult\n * @param {Object} [options] Optional options\n * @param {Discord.GuildMember} [options.message] A message from guild channel | A guild member\n * @param {Object} [options.properties] Additional properties such as `name`\n * @param {boolean} [options.parallel=true] Whether or not fetch the songs in parallel\n * @param {*} [options.metadata] Metadata\n * @example\n * const songs = [\"https://www.youtube.com/watch?v=xxx\", \"https://www.youtube.com/watch?v=yyy\"];\n * const playlist = await distube.createCustomPlaylist(songs, {\n * member: message.member,\n * properties: { name: \"My playlist name\" },\n * parallel: true\n * });\n * distube.play(voiceChannel, playlist, { ... });\n */\n async createCustomPlaylist(\n songs: (string | Song | SearchResult)[],\n options: {\n member?: GuildMember;\n properties?: Record<string, any>;\n parallel?: boolean;\n metadata?: any;\n } = {},\n ): Promise<Playlist> {\n const { member, properties, parallel, metadata } = { parallel: true, ...options };\n if (!Array.isArray(songs)) throw new DisTubeError(\"INVALID_TYPE\", \"Array\", songs, \"songs\");\n if (!songs.length) throw new DisTubeError(\"EMPTY_ARRAY\", \"songs\");\n const filteredSongs = songs.filter(\n song => song instanceof Song || (song instanceof SearchResult && song.type === \"video\") || isURL(song),\n );\n if (!filteredSongs.length) throw new DisTubeError(\"NO_VALID_SONG\");\n if (member && !isMemberInstance(member)) {\n throw new DisTubeError(\"INVALID_TYPE\", \"Discord.Member\", member, \"options.member\");\n }\n if (!filteredSongs.length) throw new DisTubeError(\"NO_VALID_SONG\");\n let resolvedSongs: Song[];\n if (parallel) {\n const promises = filteredSongs.map((song: string | Song | SearchResult) =>\n this.handler.resolveSong(song, { member, metadata }).catch(() => undefined),\n );\n resolvedSongs = (await Promise.all(promises)).filter((s: any): s is Song => !!s);\n } else {\n const resolved = [];\n for (const song of filteredSongs) {\n resolved.push(await this.handler.resolveSong(song, { member, metadata }).catch(() => undefined));\n }\n resolvedSongs = resolved.filter((s: any): s is Song => !!s);\n }\n return new Playlist(resolvedSongs, { member, properties, metadata });\n }\n\n /**\n * Search for a song. You can customize how user answers instead of send a number.\n * Then use {@link DisTube#play} to play it.\n *\n * @param {string} string The string search for\n * @param {Object} options Search options\n * @param {number} [options.limit=10] Limit the results\n * @param {'video'|'playlist'} [options.type='video'] Type of results (`video` or `playlist`).\n * @param {boolean} [options.safeSearch=false] Whether or not use safe search (YouTube restricted mode)\n * @throws {Error}\n * @returns {Promise<Array<SearchResult>>} Array of results\n */\n async search(\n string: string,\n options: { type?: \"video\" | \"playlist\"; limit?: number; safeSearch?: boolean; retried?: boolean } = {},\n ): Promise<Array<SearchResult>> {\n const opts = { type: \"video\" as const, limit: 10, safeSearch: false, ...options };\n if (typeof opts.type !== \"string\" || ![\"video\", \"playlist\"].includes(opts.type)) {\n throw new DisTubeError(\"INVALID_TYPE\", [\"video\", \"playlist\"], opts.type, \"options.type\");\n }\n if (typeof opts.limit !== \"number\") throw new DisTubeError(\"INVALID_TYPE\", \"number\", opts.limit, \"options.limit\");\n if (opts.limit < 1) throw new DisTubeError(\"NUMBER_COMPARE\", \"option.limit\", \"bigger or equal to\", 1);\n if (typeof opts.safeSearch !== \"boolean\") {\n throw new DisTubeError(\"INVALID_TYPE\", \"boolean\", opts.safeSearch, \"options.safeSearch\");\n }\n\n try {\n const search = await ytsr(string, opts);\n const results = search.items.map(i => new SearchResult(i));\n if (results.length === 0) throw new DisTubeError(\"NO_RESULT\");\n return results;\n } catch (e) {\n if (options.retried) throw e;\n options.retried = true;\n return this.search(string, options);\n }\n }\n\n /**\n * Get the guild queue\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Queue?}\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"queue\") {\n * const queue = distube.getQueue(message);\n * message.channel.send('Current queue:\\n' + queue.songs.map((song, id) =>\n * `**${id+1}**. [${song.name}](${song.url}) - \\`${song.formattedDuration}\\``\n * ).join(\"\\n\"));\n * }\n * });\n */\n getQueue(queue: GuildIdResolvable): Queue | undefined {\n return this.queues.get(queue);\n }\n\n /**\n * Pause the guild stream\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Queue} The guild queue\n * @throws {Error}\n */\n pause(queue: GuildIdResolvable): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.pause();\n }\n\n /**\n * Resume the guild stream\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Queue} The guild queue\n * @throws {Error}\n */\n resume(queue: GuildIdResolvable): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.resume();\n }\n\n /**\n * Stop the guild stream\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<void>}\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"stop\") {\n * distube.stop(message);\n * message.channel.send(\"Stopped the queue!\");\n * }\n * });\n */\n stop(queue: GuildIdResolvable): Promise<void> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.stop();\n }\n\n /**\n * Set the guild stream's volume\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {number} percent The percentage of volume you want to set\n * @returns {Queue} The guild queue\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"volume\")\n * distube.setVolume(message, Number(args[0]));\n * });\n */\n setVolume(queue: GuildIdResolvable, percent: number): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.setVolume(percent);\n }\n\n /**\n * Skip the playing song if there is a next song in the queue.\n * <info>If {@link Queue#autoplay} is `true` and there is no up next song,\n * DisTube will add and play a related song.</info>\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Song>} The new Song will be played\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"skip\")\n * distube.skip(message);\n * });\n */\n skip(queue: GuildIdResolvable): Promise<Song> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.skip();\n }\n\n /**\n * Play the previous song\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Song>} The new Song will be played\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"previous\")\n * distube.previous(message);\n * });\n */\n previous(queue: GuildIdResolvable): Promise<Song> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.previous();\n }\n\n /**\n * Shuffle the guild queue songs\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Queue>} The guild queue\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"shuffle\")\n * distube.shuffle(message);\n * });\n */\n shuffle(queue: GuildIdResolvable): Promise<Queue> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.shuffle();\n }\n\n /**\n * Jump to the song number in the queue.\n * The next one is 1, 2,...\n * The previous one is -1, -2,...\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {number} num The song number to play\n * @returns {Promise<Queue>} The guild queue\n * @throws {Error} if `num` is invalid number (0 < num < {@link Queue#songs}.length)\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"jump\")\n * distube.jump(message, parseInt(args[0]))\n * .catch(err => message.channel.send(\"Invalid song number.\"));\n * });\n */\n jump(queue: GuildIdResolvable, num: number): Promise<Queue> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.jump(num);\n }\n\n /**\n * Set the repeat mode of the guild queue.\\\n * Toggle mode `(Disabled -> Song -> Queue -> Disabled ->...)` if `mode` is `undefined`\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {RepeatMode?} [mode] The repeat modes (toggle if `undefined`)\n * @returns {RepeatMode} The new repeat mode\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"repeat\") {\n * let mode = distube.setRepeatMode(message, parseInt(args[0]));\n * mode = mode ? mode == 2 ? \"Repeat queue\" : \"Repeat song\" : \"Off\";\n * message.channel.send(\"Set repeat mode to `\" + mode + \"`\");\n * }\n * });\n * @example\n * const { RepeatMode } = require(\"distube\");\n * let mode;\n * switch(distube.setRepeatMode(message, parseInt(args[0]))) {\n * case RepeatMode.DISABLED:\n * mode = \"Off\";\n * break;\n * case RepeatMode.SONG:\n * mode = \"Repeat a song\";\n * break;\n * case RepeatMode.QUEUE:\n * mode = \"Repeat all queue\";\n * break;\n * }\n * message.channel.send(\"Set repeat mode to `\" + mode + \"`\");\n */\n setRepeatMode(queue: GuildIdResolvable, mode?: number): number {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.setRepeatMode(mode);\n }\n\n /**\n * Toggle autoplay mode\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {boolean} Autoplay mode state\n * @throws {Error}\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command == \"autoplay\") {\n * const mode = distube.toggleAutoplay(message);\n * message.channel.send(\"Set autoplay mode to `\" + (mode ? \"On\" : \"Off\") + \"`\");\n * }\n * });\n */\n toggleAutoplay(queue: GuildIdResolvable): boolean {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n q.autoplay = !q.autoplay;\n return q.autoplay;\n }\n\n /**\n * Add related song to the queue\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @returns {Promise<Song>} The guild queue\n */\n addRelatedSong(queue: GuildIdResolvable): Promise<Song> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.addRelatedSong();\n }\n\n /**\n * Enable or disable filter(s) of the queue.\n * Available filters: {@link Filters}\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {string|false} filter A filter name, `false` to clear all the filters\n * @param {boolean} [force=false] Force enable the input filter(s) even if it's enabled\n * @returns {Array<string>} Enabled filters.\n * @example\n * client.on('message', (message) => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if ([`3d`, `bassboost`, `echo`, `karaoke`, `nightcore`, `vaporwave`].includes(command)) {\n * const filter = distube.setFilter(message, command);\n * message.channel.send(\"Current queue filter: \" + (filter.join(\", \") || \"Off\"));\n * }\n * });\n */\n setFilter(queue: GuildIdResolvable, filter: string | false, force = false): Array<string> {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.setFilter(filter, force);\n }\n\n /**\n * Set the playing time to another position\n * @param {GuildIdResolvable} queue The type can be resolved to give a {@link Queue}\n * @param {number} time Time in seconds\n * @returns {Queue} Seeked queue\n * @example\n * client.on('message', message => {\n * if (!message.content.startsWith(config.prefix)) return;\n * const args = message.content.slice(config.prefix.length).trim().split(/ +/g);\n * const command = args.shift();\n * if (command = 'seek')\n * distube.seek(message, Number(args[0]));\n * });\n */\n seek(queue: GuildIdResolvable, time: number): Queue {\n const q = this.getQueue(queue);\n if (!q) throw new DisTubeError(\"NO_QUEUE\");\n return q.seek(time);\n }\n\n /* eslint-disable no-console */\n /**\n * Emit error event\n * @param {Error} error error\n * @param {Discord.BaseGuildTextChannel} [channel] Text channel where the error is encountered.\n * @private\n */\n emitError(error: Error, channel?: GuildTextBasedChannel): void {\n if (!channel || !isTextChannelInstance(channel)) {\n console.error(error);\n console.warn(\"This is logged because <Queue>.textChannel is undefined\");\n } else if (this.listeners(\"error\").length) {\n this.emit(\"error\", channel, error);\n } else {\n console.error(error);\n console.warn(\"Unhandled 'error' event.\");\n console.warn(\n \"See: https://distube.js.org/#/docs/DisTube/stable/class/DisTube?scrollTo=e-error and https://nodejs.org/api/events.html#events_error_events\",\n );\n }\n }\n /* eslint-enable no-console */\n}\n\nexport default DisTube;\n\n/**\n * Emitted after DisTube add a new playlist to the playing {@link Queue}.\n *\n * @event DisTube#addList\n * @param {Queue} queue The guild queue\n * @param {Playlist} playlist Playlist info\n * @example\n * distube.on(\"addList\", (queue, playlist) => queue.textChannel.send(\n * `Added \\`${playlist.name}\\` playlist (${playlist.songs.length} songs) to the queue!`\n * ));\n */\n\n/**\n * Emitted after DisTube add a new song to the playing {@link Queue}.\n *\n * @event DisTube#addSong\n * @param {Queue} queue The guild queue\n * @param {Song} song Added song\n * @example\n * distube.on(\"addSong\", (queue, song) => queue.textChannel.send(\n * `Added ${song.name} - \\`${song.formattedDuration}\\` to the queue by ${song.user}.`\n * ));\n */\n\n/**\n * Emitted when there is no user in the voice channel,\n * {@link DisTubeOptions}.leaveOnEmpty is `true` and there is a playing queue.\n *\n * If there is no playing queue (stopped and {@link DisTubeOptions}.leaveOnStop is `false`),\n * it will leave the channel without emitting this event.\n * @event DisTube#empty\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"empty\", queue => queue.textChannel.send(\"Channel is empty. Leaving the channel\"))\n */\n\n/**\n * Emitted when DisTube encounters an error.\n *\n * @event DisTube#error\n * @param {Discord.BaseGuildTextChannel} channel Text channel where the error is encountered.\n * @param {Error} error The error encountered\n * @example\n * distube.on(\"error\", (channel, error) => channel.send(\n * \"An error encountered: \" + error\n * ));\n */\n\n/**\n * Emitted when there is no more song in the queue and {@link Queue#autoplay} is `false`.\n * DisTube will leave voice channel if {@link DisTubeOptions}.leaveOnFinish is `true`.\n *\n * @event DisTube#finish\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"finish\", queue => queue.textChannel.send(\"No more song in queue\"));\n */\n\n/**\n * Emitted when DisTube initialize a queue to change queue default properties.\n *\n * @event DisTube#initQueue\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"initQueue\", queue => {\n * queue.autoplay = false;\n * queue.volume = 100;\n * });\n */\n\n/**\n * Emitted when {@link Queue#autoplay} is `true`, {@link Queue#songs} is empty,\n * and DisTube cannot find related songs to play.\n *\n * @event DisTube#noRelated\n * @param {Queue} queue The guild queue\n * @example\n * distube.on(\"noRelated\", queue => queue.textChannel.send(\"Can't find related video to play.\"));\n */\n\n/**\n * Emitted when DisTube play a song.\n *\n * If {@link DisTubeOptions}.emitNewSongOnly is `true`,\n * this event is not emitted when looping a song or next song is the previous one.\n *\n * @event DisTube#playSong\n * @param {Queue} queue The guild queue\n * @param {Song} song Playing song\n * @example\n * distube.on(\"playSong\", (queue, song) => queue.textChannel.send(\n * `Playing \\`${song.name}\\` - \\`${song.formattedDuration}\\`\\nRequested by: ${song.user}`\n * ));\n */\n\n/**\n * Emitted when DisTube cannot find any results for the query.\n *\n * @event DisTube#searchNoResult\n * @param {Discord.Message} message The user message called play method\n * @param {string} query The search query\n * @example\n * distube.on(\"searchNoResult\", (message, query) => message.channel.send(`No result found for ${query}!`));\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,\n * and song param of {@link DisTube#play} is invalid url.\n * DisTube will wait for user's next message to choose a song manually.\n * <info>{@link https://support.google.com/youtube/answer/7354993|Safe search} is enabled\n * if {@link DisTubeOptions}.nsfw is disabled and the message's channel is not a nsfw channel.</info>\n *\n * @event DisTube#searchResult\n * @param {Discord.Message} message The user message called play method\n * @param {Array<SearchResult>} results Searched results\n * @param {string} query The search query\n * @example\n * // DisTubeOptions.searchSongs > 0\n * distube.on(\"searchResult\", (message, results) => {\n * message.channel.send(`**Choose an option from below**\\n${\n * results.map((song, i) => `**${i + 1}**. ${song.name} - \\`${song.formattedDuration}\\``).join(\"\\n\")\n * }\\n*Enter anything else or wait 60 seconds to cancel*`);\n * });\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,\n * and the search canceled due to {@link DisTubeOptions|DisTubeOptions.searchTimeout}.\n *\n * @event DisTube#searchCancel\n * @param {Discord.Message} message The user message called play method\n * @param {string} query The search query\n * @example\n * // DisTubeOptions.searchSongs > 0\n * distube.on(\"searchCancel\", (message) => message.channel.send(`Searching canceled`));\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,\n * and the search canceled due to user's next message is not a number or out of results range.\n *\n * @event DisTube#searchInvalidAnswer\n * @param {Discord.Message} message The user message called play method\n * @param {Discord.Message} answer The answered message of user\n * @param {string} query The search query\n * @example\n * // DisTubeOptions.searchSongs > 0\n * distube.on(\"searchInvalidAnswer\", (message) => message.channel.send(`You answered an invalid number!`));\n */\n\n/**\n * Emitted when {@link DisTubeOptions|DisTubeOptions.searchSongs} bigger than 0,\n * and after the user chose a search result to play.\n *\n * @event DisTube#searchDone\n * @param {Discord.Message} message The user message called play method\n * @param {Discord.Message} answer The answered message of user\n * @param {string} query The search query\n */\n\n/**\n * Emitted when the bot is disconnected to a voice channel.\n *\n * @event DisTube#disconnect\n * @param {Queue} queue The guild queue\n */\n\n/**\n * Emitted when a {@link Queue} is deleted with any reasons.\n *\n * @event DisTube#deleteQueue\n * @param {Queue} queue The guild queue\n */\n\n/**\n * Emitted when DisTube finished a song.\n *\n * @event DisTube#finishSong\n * @param {Queue} queue The guild queue\n * @param {Song} song Finished song\n */\n"]}