distube 5.1.2 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2,7 +2,15 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
4
  // src/constant.ts
5
- var version = "5.1.2";
5
+ var version = "5.2.1";
6
+ var AUDIO_SAMPLE_RATE = 48e3;
7
+ var AUDIO_CHANNELS = 2;
8
+ var DEFAULT_VOLUME = 50;
9
+ var JOIN_TIMEOUT_MS = 3e4;
10
+ var RECONNECT_TIMEOUT_MS = 5e3;
11
+ var RECONNECT_MAX_ATTEMPTS = 5;
12
+ var HTTP_REDIRECT_CODES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
13
+ var MAX_REDIRECT_DEPTH = 5;
6
14
  var defaultFilters = {
7
15
  "3d": "apulsator=hz=0.125",
8
16
  bassboost: "bass=g=10",
@@ -222,17 +230,17 @@ var DisTubeVoice = class extends TypedEmitter {
222
230
  if (newState.reason === VoiceConnectionDisconnectReason.Manual) {
223
231
  this.leave();
224
232
  } else if (newState.reason === VoiceConnectionDisconnectReason.WebSocketClose && newState.closeCode === 4014) {
225
- entersState(this.connection, VoiceConnectionStatus.Connecting, 5e3).catch(() => {
233
+ entersState(this.connection, VoiceConnectionStatus.Connecting, RECONNECT_TIMEOUT_MS).catch(() => {
226
234
  if (![VoiceConnectionStatus.Ready, VoiceConnectionStatus.Connecting].includes(this.connection.state.status)) {
227
235
  this.leave();
228
236
  }
229
237
  });
230
- } else if (this.connection.rejoinAttempts < 5) {
238
+ } else if (this.connection.rejoinAttempts < RECONNECT_MAX_ATTEMPTS) {
231
239
  setTimeout(
232
240
  () => {
233
241
  this.connection.rejoin();
234
242
  },
235
- (this.connection.rejoinAttempts + 1) * 5e3
243
+ (this.connection.rejoinAttempts + 1) * RECONNECT_TIMEOUT_MS
236
244
  ).unref();
237
245
  } else if (this.connection.state.status !== VoiceConnectionStatus.Destroyed) {
238
246
  this.leave(new DisTubeError("VOICE_RECONNECT_FAILED"));
@@ -288,15 +296,14 @@ var DisTubeVoice = class extends TypedEmitter {
288
296
  * @param channel - A voice channel
289
297
  */
290
298
  async join(channel) {
291
- const TIMEOUT = 3e4;
292
299
  if (channel) this.channel = channel;
293
300
  try {
294
- await entersState(this.connection, VoiceConnectionStatus.Ready, TIMEOUT);
301
+ await entersState(this.connection, VoiceConnectionStatus.Ready, JOIN_TIMEOUT_MS);
295
302
  } catch {
296
303
  if (this.connection.state.status === VoiceConnectionStatus.Ready) return this;
297
304
  if (this.connection.state.status !== VoiceConnectionStatus.Destroyed) this.connection.destroy();
298
305
  this.voices.remove(this.id);
299
- throw new DisTubeError("VOICE_CONNECT_FAILED", TIMEOUT / 1e3);
306
+ throw new DisTubeError("VOICE_CONNECT_FAILED", JOIN_TIMEOUT_MS / 1e3);
300
307
  }
301
308
  return this;
302
309
  }
@@ -321,6 +328,7 @@ var DisTubeVoice = class extends TypedEmitter {
321
328
  stop(force = false) {
322
329
  this.audioPlayer.stop(force);
323
330
  }
331
+ #streamErrorHandler;
324
332
  /**
325
333
  * Play a {@link DisTubeStream}
326
334
  * @param dtStream - DisTubeStream
@@ -331,11 +339,15 @@ var DisTubeVoice = class extends TypedEmitter {
331
339
  throw new DisTubeError("ENCRYPTION_LIBRARIES_MISSING");
332
340
  }
333
341
  this.emittedError = false;
334
- dtStream.on("error", (error) => {
342
+ if (this.stream && this.#streamErrorHandler) {
343
+ this.stream.off("error", this.#streamErrorHandler);
344
+ }
345
+ this.#streamErrorHandler = (error) => {
335
346
  if (this.emittedError || error.code === "ERR_STREAM_PREMATURE_CLOSE") return;
336
347
  this.emittedError = true;
337
348
  this.emit("error", error);
338
- });
349
+ };
350
+ dtStream.on("error", this.#streamErrorHandler);
339
351
  if (this.audioPlayer.state.status !== AudioPlayerStatus.Paused) {
340
352
  this.audioPlayer.play(dtStream.audioResource);
341
353
  this.stream?.kill();
@@ -363,11 +375,17 @@ var DisTubeVoice = class extends TypedEmitter {
363
375
  return this.#volume;
364
376
  }
365
377
  /**
366
- * Playback duration of the audio resource in seconds
378
+ * Playback duration of the audio resource in seconds (time since playback started)
367
379
  */
368
380
  get playbackDuration() {
369
381
  return (this.stream?.audioResource?.playbackDuration ?? 0) / 1e3;
370
382
  }
383
+ /**
384
+ * Current playback time in seconds, accounting for seek offset
385
+ */
386
+ get playbackTime() {
387
+ return this.playbackDuration + (this.stream?.seekTime ?? 0);
388
+ }
371
389
  pause() {
372
390
  this.audioPlayer.pause();
373
391
  }
@@ -663,7 +681,10 @@ var Queue = class extends DisTubeBase {
663
681
  */
664
682
  stopped;
665
683
  /**
666
- * Whether or not the stream is currently playing.
684
+ * Whether or not the queue is active.
685
+ *
686
+ * Note: This remains `true` when paused. It only becomes `false` when stopped.
687
+ * @deprecated Use `!queue.paused` to check if audio is playing. Will be removed in v6.0.
667
688
  */
668
689
  playing;
669
690
  /**
@@ -690,19 +711,23 @@ var Queue = class extends DisTubeBase {
690
711
  textChannel;
691
712
  /**
692
713
  * What time in the song to begin (in seconds).
714
+ * @internal
693
715
  */
694
716
  _beginTime;
695
717
  #filters;
696
718
  /**
697
719
  * Whether or not the queue is being updated manually (skip, jump, previous)
720
+ * @internal
698
721
  */
699
722
  _manualUpdate;
700
723
  /**
701
724
  * Task queuing system
725
+ * @internal
702
726
  */
703
727
  _taskQueue;
704
728
  /**
705
729
  * {@link DisTubeVoice} listener
730
+ * @internal
706
731
  */
707
732
  _listeners;
708
733
  /**
@@ -715,7 +740,7 @@ var Queue = class extends DisTubeBase {
715
740
  super(distube);
716
741
  this.voice = voice;
717
742
  this.id = voice.id;
718
- this.volume = 50;
743
+ this.volume = DEFAULT_VOLUME;
719
744
  this.songs = [];
720
745
  this.previousSongs = [];
721
746
  this.stopped = false;
@@ -780,7 +805,7 @@ var Queue = class extends DisTubeBase {
780
805
  * What time in the song is playing (in seconds).
781
806
  */
782
807
  get currentTime() {
783
- return this.voice.playbackDuration + this._beginTime;
808
+ return this.voice.playbackTime;
784
809
  }
785
810
  /**
786
811
  * Formatted {@link Queue#currentTime} string.
@@ -828,13 +853,15 @@ var Queue = class extends DisTubeBase {
828
853
  return this;
829
854
  }
830
855
  /**
831
- * @returns `true` if the queue is playing
856
+ * @returns `true` if the queue is active (not stopped)
857
+ * @deprecated Use `!queue.paused` to check if audio is playing. Will be removed in v6.0.
832
858
  */
833
859
  isPlaying() {
834
860
  return this.playing;
835
861
  }
836
862
  /**
837
863
  * @returns `true` if the queue is paused
864
+ * @deprecated Use `queue.paused` property instead. Will be removed in v6.0.
838
865
  */
839
866
  isPaused() {
840
867
  return this.paused;
@@ -944,7 +971,7 @@ var Queue = class extends DisTubeBase {
944
971
  if (position > 0) {
945
972
  if (position >= this.songs.length) {
946
973
  if (this.autoplay) {
947
- await this.addRelatedSong();
974
+ await this._addRelatedSong();
948
975
  } else {
949
976
  throw new DisTubeError("NO_UP_NEXT");
950
977
  }
@@ -987,12 +1014,17 @@ var Queue = class extends DisTubeBase {
987
1014
  * @param time - Time in seconds
988
1015
  * @returns The guild queue
989
1016
  */
990
- seek(time) {
991
- if (typeof time !== "number") throw new DisTubeError("INVALID_TYPE", "number", time, "time");
992
- if (Number.isNaN(time) || time < 0) throw new DisTubeError("NUMBER_COMPARE", "time", "bigger or equal to", 0);
993
- this._beginTime = time;
994
- this.play(false);
995
- return this;
1017
+ async seek(time) {
1018
+ await this._taskQueue.queuing();
1019
+ try {
1020
+ if (typeof time !== "number") throw new DisTubeError("INVALID_TYPE", "number", time, "time");
1021
+ if (Number.isNaN(time) || time < 0) throw new DisTubeError("NUMBER_COMPARE", "time", "bigger or equal to", 0);
1022
+ this._beginTime = time;
1023
+ await this.play(false);
1024
+ return this;
1025
+ } finally {
1026
+ this._taskQueue.resolve();
1027
+ }
996
1028
  }
997
1029
  async #getRelatedSong(current) {
998
1030
  const plugin = await this.handler._getPluginFromSong(current);
@@ -1000,11 +1032,11 @@ var Queue = class extends DisTubeBase {
1000
1032
  return [];
1001
1033
  }
1002
1034
  /**
1003
- * Add a related song of the playing song to the queue
1004
- * @param song - The song to get related songs from. Defaults to the current playing song.
1005
- * @returns The added song
1035
+ * Internal implementation of addRelatedSong without task queue protection.
1036
+ * Used by methods that already hold the task queue lock.
1037
+ * @internal
1006
1038
  */
1007
- async addRelatedSong(song) {
1039
+ async _addRelatedSong(song) {
1008
1040
  const current = song ?? this.songs?.[0];
1009
1041
  if (!current) throw new DisTubeError("NO_PLAYING_SONG");
1010
1042
  const prevIds = this.previousSongs.map((p) => p.id);
@@ -1022,6 +1054,19 @@ var Queue = class extends DisTubeBase {
1022
1054
  this.addToQueue(nextSong);
1023
1055
  return nextSong;
1024
1056
  }
1057
+ /**
1058
+ * Add a related song of the playing song to the queue
1059
+ * @param song - The song to get related songs from. Defaults to the current playing song.
1060
+ * @returns The added song
1061
+ */
1062
+ async addRelatedSong(song) {
1063
+ await this._taskQueue.queuing();
1064
+ try {
1065
+ return await this._addRelatedSong(song);
1066
+ } finally {
1067
+ this._taskQueue.resolve();
1068
+ }
1069
+ }
1025
1070
  /**
1026
1071
  * Stop the guild stream and delete the queue
1027
1072
  */
@@ -1039,7 +1084,7 @@ var Queue = class extends DisTubeBase {
1039
1084
  */
1040
1085
  remove() {
1041
1086
  this.playing = false;
1042
- this.paused = false;
1087
+ this.paused = true;
1043
1088
  this.stopped = true;
1044
1089
  this.songs = [];
1045
1090
  this.previousSongs = [];
@@ -1431,7 +1476,6 @@ var Song = class {
1431
1476
  };
1432
1477
 
1433
1478
  // src/core/DisTubeHandler.ts
1434
- var REDIRECT_CODES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
1435
1479
  var DisTubeHandler = class extends DisTubeBase {
1436
1480
  static {
1437
1481
  __name(this, "DisTubeHandler");
@@ -1518,7 +1562,7 @@ var DisTubeHandler = class extends DisTubeBase {
1518
1562
  song.stream.song = altSong;
1519
1563
  }
1520
1564
  }
1521
- async followRedirectLink(url, maxRedirect = 5) {
1565
+ async followRedirectLink(url, maxRedirect = MAX_REDIRECT_DEPTH) {
1522
1566
  if (maxRedirect === 0) return url;
1523
1567
  const res = await request(url, {
1524
1568
  method: "HEAD",
@@ -1526,7 +1570,7 @@ var DisTubeHandler = class extends DisTubeBase {
1526
1570
  "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.3"
1527
1571
  }
1528
1572
  });
1529
- if (REDIRECT_CODES.has(res.statusCode ?? 200)) {
1573
+ if (HTTP_REDIRECT_CODES.has(res.statusCode ?? 200)) {
1530
1574
  let location = res.headers.location;
1531
1575
  if (typeof location !== "string") location = location?.[0] ?? url;
1532
1576
  return this.followRedirectLink(location, --maxRedirect);
@@ -1655,7 +1699,8 @@ var checkFFmpeg = /* @__PURE__ */ __name((distube) => {
1655
1699
  if (!version2) throw new Error("Invalid FFmpeg version");
1656
1700
  debug(`[test] ffmpeg version: ${version2}`);
1657
1701
  } catch (e) {
1658
- debug(`[test] failed to spawn ffmpeg at '${path}': ${e?.stack ?? e}`);
1702
+ const errorMessage = e instanceof Error ? e.stack ?? e.message : String(e);
1703
+ debug(`[test] failed to spawn ffmpeg at '${path}': ${errorMessage}`);
1659
1704
  throw new DisTubeError("FFMPEG_NOT_INSTALLED", path);
1660
1705
  }
1661
1706
  checked = true;
@@ -1669,6 +1714,10 @@ var DisTubeStream = class extends TypedEmitter2 {
1669
1714
  process;
1670
1715
  stream;
1671
1716
  audioResource;
1717
+ /**
1718
+ * The seek time in seconds that this stream started from
1719
+ */
1720
+ seekTime;
1672
1721
  /**
1673
1722
  * Create a DisTubeStream to play with {@link DisTubeVoice}
1674
1723
  * @param url - Stream URL
@@ -1677,6 +1726,7 @@ var DisTubeStream = class extends TypedEmitter2 {
1677
1726
  constructor(url, options) {
1678
1727
  super();
1679
1728
  const { ffmpeg, seek } = options;
1729
+ this.seekTime = typeof seek === "number" && seek > 0 ? seek : 0;
1680
1730
  const opts = {
1681
1731
  reconnect: 1,
1682
1732
  reconnect_streamed: 1,
@@ -1686,8 +1736,8 @@ var DisTubeStream = class extends TypedEmitter2 {
1686
1736
  ...ffmpeg.args.global,
1687
1737
  ...ffmpeg.args.input,
1688
1738
  i: url,
1689
- ar: 48e3,
1690
- ac: 2,
1739
+ ar: AUDIO_SAMPLE_RATE,
1740
+ ac: AUDIO_CHANNELS,
1691
1741
  ...ffmpeg.args.output,
1692
1742
  f: "s16le"
1693
1743
  };
@@ -1895,8 +1945,8 @@ var QueueManager = class extends GuildIdManager {
1895
1945
  this.emit("disconnect" /* DISCONNECT */, queue);
1896
1946
  if (error) this.emitError(error, queue, queue.songs?.[0]);
1897
1947
  }, "disconnect"),
1898
- error: /* @__PURE__ */ __name((error) => this.#handlePlayingError(queue, error), "error"),
1899
- finish: /* @__PURE__ */ __name(() => this.handleSongFinish(queue), "finish")
1948
+ error: /* @__PURE__ */ __name((error) => void this.#handlePlayingError(queue, error), "error"),
1949
+ finish: /* @__PURE__ */ __name(() => void this.handleSongFinish(queue), "finish")
1900
1950
  };
1901
1951
  for (const event of objectKeys(queue._listeners)) {
1902
1952
  queue.voice.on(event, queue._listeners[event]);
@@ -1927,10 +1977,15 @@ var QueueManager = class extends GuildIdManager {
1927
1977
  if (queue.songs.length === 0 && queue.autoplay) {
1928
1978
  try {
1929
1979
  this.debug(`[QueueManager] Adding related song: ${queue.id}`);
1930
- await queue.addRelatedSong(song);
1980
+ await queue._addRelatedSong(song);
1931
1981
  } catch (e) {
1932
- this.debug(`[${queue.id}] Add related song error: ${e.message}`);
1933
- this.emit("noRelated" /* NO_RELATED */, queue, e);
1982
+ const errorMessage = e instanceof Error ? e.message : String(e);
1983
+ this.debug(`[${queue.id}] Add related song error: ${errorMessage}`);
1984
+ if (e instanceof DisTubeError) {
1985
+ this.emit("noRelated" /* NO_RELATED */, queue, e);
1986
+ } else {
1987
+ this.emit("noRelated" /* NO_RELATED */, queue, new DisTubeError("NO_RELATED"));
1988
+ }
1934
1989
  }
1935
1990
  }
1936
1991
  if (queue.songs.length === 0) {
@@ -1953,7 +2008,7 @@ var QueueManager = class extends GuildIdManager {
1953
2008
  * @param queue - queue
1954
2009
  * @param error - error
1955
2010
  */
1956
- #handlePlayingError(queue, error) {
2011
+ async #handlePlayingError(queue, error) {
1957
2012
  const song = queue.songs.shift();
1958
2013
  try {
1959
2014
  error.name = "PlayingError";
@@ -1963,10 +2018,10 @@ var QueueManager = class extends GuildIdManager {
1963
2018
  this.emitError(error, queue, song);
1964
2019
  if (queue.songs.length > 0) {
1965
2020
  this.debug(`[${queue.id}] Playing next song: ${queue.songs[0]}`);
1966
- this.playSong(queue);
2021
+ await this.playSong(queue);
1967
2022
  } else {
1968
2023
  this.debug(`[${queue.id}] Queue is empty, stopping...`);
1969
- queue.stop();
2024
+ await queue.stop();
1970
2025
  }
1971
2026
  }
1972
2027
  /**
@@ -1977,7 +2032,7 @@ var QueueManager = class extends GuildIdManager {
1977
2032
  async playSong(queue, emitPlaySong = true) {
1978
2033
  if (!queue) return;
1979
2034
  if (queue.stopped || !queue.songs.length) {
1980
- queue.stop();
2035
+ await queue.stop();
1981
2036
  return;
1982
2037
  }
1983
2038
  try {
@@ -2006,7 +2061,8 @@ var QueueManager = class extends GuildIdManager {
2006
2061
  await queue.voice.play(dtStream);
2007
2062
  if (emitPlaySong) this.emit("playSong" /* PLAY_SONG */, queue, song);
2008
2063
  } catch (e) {
2009
- this.#handlePlayingError(queue, e);
2064
+ const error = e instanceof Error ? e : new Error(String(e));
2065
+ this.#handlePlayingError(queue, error);
2010
2066
  }
2011
2067
  }
2012
2068
  };
@@ -2201,25 +2257,28 @@ var DisTube = class extends TypedEmitter3 {
2201
2257
  if (!resolved.songs.length) throw new DisTubeError("EMPTY_PLAYLIST");
2202
2258
  this.debug(`[${queue.id}] Adding playlist to queue: ${resolved.songs.length} songs`);
2203
2259
  queue.addToQueue(resolved.songs, position);
2204
- if (queue.playing || this.options.emitAddListWhenCreatingQueue) this.emit("addList" /* ADD_LIST */, queue, resolved);
2260
+ if (!queue.stopped || this.options.emitAddListWhenCreatingQueue) this.emit("addList" /* ADD_LIST */, queue, resolved);
2205
2261
  } else {
2206
2262
  if (!this.options.nsfw && resolved.ageRestricted && !isNsfwChannel(queue?.textChannel || textChannel)) {
2207
2263
  throw new DisTubeError("NON_NSFW");
2208
2264
  }
2209
2265
  this.debug(`[${queue.id}] Adding song to queue: ${resolved.name || resolved.url || resolved.id || resolved}`);
2210
2266
  queue.addToQueue(resolved, position);
2211
- if (queue.playing || this.options.emitAddSongWhenCreatingQueue) this.emit("addSong" /* ADD_SONG */, queue, resolved);
2267
+ if (!queue.stopped || this.options.emitAddSongWhenCreatingQueue) this.emit("addSong" /* ADD_SONG */, queue, resolved);
2212
2268
  }
2213
- if (!queue.playing) await queue.play();
2269
+ if (queue.stopped) await queue.play();
2214
2270
  else if (skip) await queue.skip();
2215
2271
  } catch (e) {
2216
2272
  if (!(e instanceof DisTubeError)) {
2217
- this.debug(`[${queue.id}] Unexpected error while playing song: ${e.stack || e.message}`);
2218
- try {
2219
- e.name = "PlayError";
2220
- e.message = `${typeof song === "string" ? song : song.url}
2273
+ const errorMessage = e instanceof Error ? e.stack ?? e.message : String(e);
2274
+ this.debug(`[${queue.id}] Unexpected error while playing song: ${errorMessage}`);
2275
+ if (e instanceof Error) {
2276
+ try {
2277
+ e.name = "PlayError";
2278
+ e.message = `${typeof song === "string" ? song : song.url}
2221
2279
  ${e.message}`;
2222
- } catch {
2280
+ } catch {
2281
+ }
2223
2282
  }
2224
2283
  }
2225
2284
  throw e;
@@ -2281,6 +2340,7 @@ ${e.message}`;
2281
2340
  * Pause the guild stream
2282
2341
  * @param guild - The type can be resolved to give a {@link Queue}
2283
2342
  * @returns The guild queue
2343
+ * @deprecated Use `distube.getQueue(guild).pause()` instead. Will be removed in v6.0.
2284
2344
  */
2285
2345
  pause(guild) {
2286
2346
  return this.#getQueue(guild).pause();
@@ -2289,6 +2349,7 @@ ${e.message}`;
2289
2349
  * Resume the guild stream
2290
2350
  * @param guild - The type can be resolved to give a {@link Queue}
2291
2351
  * @returns The guild queue
2352
+ * @deprecated Use `distube.getQueue(guild).resume()` instead. Will be removed in v6.0.
2292
2353
  */
2293
2354
  resume(guild) {
2294
2355
  return this.#getQueue(guild).resume();
@@ -2296,6 +2357,7 @@ ${e.message}`;
2296
2357
  /**
2297
2358
  * Stop the guild stream
2298
2359
  * @param guild - The type can be resolved to give a {@link Queue}
2360
+ * @deprecated Use `distube.getQueue(guild).stop()` instead. Will be removed in v6.0.
2299
2361
  */
2300
2362
  stop(guild) {
2301
2363
  return this.#getQueue(guild).stop();
@@ -2305,6 +2367,7 @@ ${e.message}`;
2305
2367
  * @param guild - The type can be resolved to give a {@link Queue}
2306
2368
  * @param percent - The percentage of volume you want to set
2307
2369
  * @returns The guild queue
2370
+ * @deprecated Use `distube.getQueue(guild).setVolume(percent)` instead. Will be removed in v6.0.
2308
2371
  */
2309
2372
  setVolume(guild, percent) {
2310
2373
  return this.#getQueue(guild).setVolume(percent);
@@ -2315,6 +2378,7 @@ ${e.message}`;
2315
2378
  * play a related song.</info>
2316
2379
  * @param guild - The type can be resolved to give a {@link Queue}
2317
2380
  * @returns The new Song will be played
2381
+ * @deprecated Use `distube.getQueue(guild).skip(options)` instead. Will be removed in v6.0.
2318
2382
  */
2319
2383
  skip(guild, options) {
2320
2384
  return this.#getQueue(guild).skip(options);
@@ -2323,6 +2387,7 @@ ${e.message}`;
2323
2387
  * Play the previous song
2324
2388
  * @param guild - The type can be resolved to give a {@link Queue}
2325
2389
  * @returns The new Song will be played
2390
+ * @deprecated Use `distube.getQueue(guild).previous()` instead. Will be removed in v6.0.
2326
2391
  */
2327
2392
  previous(guild) {
2328
2393
  return this.#getQueue(guild).previous();
@@ -2331,6 +2396,7 @@ ${e.message}`;
2331
2396
  * Shuffle the guild queue songs
2332
2397
  * @param guild - The type can be resolved to give a {@link Queue}
2333
2398
  * @returns The guild queue
2399
+ * @deprecated Use `distube.getQueue(guild).shuffle()` instead. Will be removed in v6.0.
2334
2400
  */
2335
2401
  shuffle(guild) {
2336
2402
  return this.#getQueue(guild).shuffle();
@@ -2341,6 +2407,7 @@ ${e.message}`;
2341
2407
  * @param guild - The type can be resolved to give a {@link Queue}
2342
2408
  * @param num - The song number to play
2343
2409
  * @returns The new Song will be played
2410
+ * @deprecated Use `distube.getQueue(guild).jump(num, options)` instead. Will be removed in v6.0.
2344
2411
  */
2345
2412
  jump(guild, num, options) {
2346
2413
  return this.#getQueue(guild).jump(num, options);
@@ -2351,6 +2418,7 @@ ${e.message}`;
2351
2418
  * @param guild - The type can be resolved to give a {@link Queue}
2352
2419
  * @param mode - The repeat modes (toggle if `undefined`)
2353
2420
  * @returns The new repeat mode
2421
+ * @deprecated Use `distube.getQueue(guild).setRepeatMode(mode)` instead. Will be removed in v6.0.
2354
2422
  */
2355
2423
  setRepeatMode(guild, mode) {
2356
2424
  return this.#getQueue(guild).setRepeatMode(mode);
@@ -2359,6 +2427,7 @@ ${e.message}`;
2359
2427
  * Toggle autoplay mode
2360
2428
  * @param guild - The type can be resolved to give a {@link Queue}
2361
2429
  * @returns Autoplay mode state
2430
+ * @deprecated Use `distube.getQueue(guild).toggleAutoplay()` instead. Will be removed in v6.0.
2362
2431
  */
2363
2432
  toggleAutoplay(guild) {
2364
2433
  const queue = this.#getQueue(guild);
@@ -2369,6 +2438,7 @@ ${e.message}`;
2369
2438
  * Add related song to the queue
2370
2439
  * @param guild - The type can be resolved to give a {@link Queue}
2371
2440
  * @returns The guild queue
2441
+ * @deprecated Use `distube.getQueue(guild).addRelatedSong()` instead. Will be removed in v6.0.
2372
2442
  */
2373
2443
  addRelatedSong(guild) {
2374
2444
  return this.#getQueue(guild).addRelatedSong();
@@ -2378,6 +2448,7 @@ ${e.message}`;
2378
2448
  * @param guild - The type can be resolved to give a {@link Queue}
2379
2449
  * @param time - Time in seconds
2380
2450
  * @returns Seeked queue
2451
+ * @deprecated Use `distube.getQueue(guild).seek(time)` instead. Will be removed in v6.0.
2381
2452
  */
2382
2453
  seek(guild, time) {
2383
2454
  return this.#getQueue(guild).seek(time);
@@ -2422,7 +2493,7 @@ var ExtractorPlugin = class extends Plugin {
2422
2493
  type = "extractor" /* EXTRACTOR */;
2423
2494
  };
2424
2495
 
2425
- // src/struct/InfoExtratorPlugin.ts
2496
+ // src/struct/InfoExtractorPlugin.ts
2426
2497
  var InfoExtractorPlugin = class extends Plugin {
2427
2498
  static {
2428
2499
  __name(this, "InfoExtractorPlugin");
@@ -2430,7 +2501,7 @@ var InfoExtractorPlugin = class extends Plugin {
2430
2501
  type = "info-extractor" /* INFO_EXTRACTOR */;
2431
2502
  };
2432
2503
 
2433
- // src/struct/PlayableExtratorPlugin.ts
2504
+ // src/struct/PlayableExtractorPlugin.ts
2434
2505
  var PlayableExtractorPlugin = class extends Plugin {
2435
2506
  static {
2436
2507
  __name(this, "PlayableExtractorPlugin");
@@ -2438,7 +2509,10 @@ var PlayableExtractorPlugin = class extends Plugin {
2438
2509
  type = "playable-extractor" /* PLAYABLE_EXTRACTOR */;
2439
2510
  };
2440
2511
  export {
2512
+ AUDIO_CHANNELS,
2513
+ AUDIO_SAMPLE_RATE,
2441
2514
  BaseManager,
2515
+ DEFAULT_VOLUME,
2442
2516
  DisTube,
2443
2517
  DisTubeBase,
2444
2518
  DisTubeError,
@@ -2450,14 +2524,21 @@ export {
2450
2524
  ExtractorPlugin,
2451
2525
  FilterManager,
2452
2526
  GuildIdManager,
2527
+ HTTP_REDIRECT_CODES,
2453
2528
  InfoExtractorPlugin,
2529
+ InfoExtractorPlugin as InfoExtratorPlugin,
2530
+ JOIN_TIMEOUT_MS,
2531
+ MAX_REDIRECT_DEPTH,
2454
2532
  Options,
2455
2533
  PlayableExtractorPlugin,
2534
+ PlayableExtractorPlugin as PlayableExtratorPlugin,
2456
2535
  Playlist,
2457
2536
  Plugin,
2458
2537
  PluginType,
2459
2538
  Queue,
2460
2539
  QueueManager,
2540
+ RECONNECT_MAX_ATTEMPTS,
2541
+ RECONNECT_TIMEOUT_MS,
2461
2542
  RepeatMode,
2462
2543
  Song,
2463
2544
  TaskQueue,