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.js CHANGED
@@ -31,7 +31,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/index.ts
32
32
  var index_exports = {};
33
33
  __export(index_exports, {
34
+ AUDIO_CHANNELS: () => AUDIO_CHANNELS,
35
+ AUDIO_SAMPLE_RATE: () => AUDIO_SAMPLE_RATE,
34
36
  BaseManager: () => BaseManager,
37
+ DEFAULT_VOLUME: () => DEFAULT_VOLUME,
35
38
  DisTube: () => DisTube,
36
39
  DisTubeBase: () => DisTubeBase,
37
40
  DisTubeError: () => DisTubeError,
@@ -43,14 +46,21 @@ __export(index_exports, {
43
46
  ExtractorPlugin: () => ExtractorPlugin,
44
47
  FilterManager: () => FilterManager,
45
48
  GuildIdManager: () => GuildIdManager,
49
+ HTTP_REDIRECT_CODES: () => HTTP_REDIRECT_CODES,
46
50
  InfoExtractorPlugin: () => InfoExtractorPlugin,
51
+ InfoExtratorPlugin: () => InfoExtractorPlugin,
52
+ JOIN_TIMEOUT_MS: () => JOIN_TIMEOUT_MS,
53
+ MAX_REDIRECT_DEPTH: () => MAX_REDIRECT_DEPTH,
47
54
  Options: () => Options,
48
55
  PlayableExtractorPlugin: () => PlayableExtractorPlugin,
56
+ PlayableExtratorPlugin: () => PlayableExtractorPlugin,
49
57
  Playlist: () => Playlist,
50
58
  Plugin: () => Plugin,
51
59
  PluginType: () => PluginType,
52
60
  Queue: () => Queue,
53
61
  QueueManager: () => QueueManager,
62
+ RECONNECT_MAX_ATTEMPTS: () => RECONNECT_MAX_ATTEMPTS,
63
+ RECONNECT_TIMEOUT_MS: () => RECONNECT_TIMEOUT_MS,
54
64
  RepeatMode: () => RepeatMode,
55
65
  Song: () => Song,
56
66
  TaskQueue: () => TaskQueue,
@@ -81,7 +91,15 @@ __export(index_exports, {
81
91
  module.exports = __toCommonJS(index_exports);
82
92
 
83
93
  // src/constant.ts
84
- var version = "5.1.2";
94
+ var version = "5.2.1";
95
+ var AUDIO_SAMPLE_RATE = 48e3;
96
+ var AUDIO_CHANNELS = 2;
97
+ var DEFAULT_VOLUME = 50;
98
+ var JOIN_TIMEOUT_MS = 3e4;
99
+ var RECONNECT_TIMEOUT_MS = 5e3;
100
+ var RECONNECT_MAX_ATTEMPTS = 5;
101
+ var HTTP_REDIRECT_CODES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
102
+ var MAX_REDIRECT_DEPTH = 5;
85
103
  var defaultFilters = {
86
104
  "3d": "apulsator=hz=0.125",
87
105
  bassboost: "bass=g=10",
@@ -294,17 +312,17 @@ var DisTubeVoice = class extends import_tiny_typed_emitter.TypedEmitter {
294
312
  if (newState.reason === import_voice.VoiceConnectionDisconnectReason.Manual) {
295
313
  this.leave();
296
314
  } else if (newState.reason === import_voice.VoiceConnectionDisconnectReason.WebSocketClose && newState.closeCode === 4014) {
297
- (0, import_voice.entersState)(this.connection, import_voice.VoiceConnectionStatus.Connecting, 5e3).catch(() => {
315
+ (0, import_voice.entersState)(this.connection, import_voice.VoiceConnectionStatus.Connecting, RECONNECT_TIMEOUT_MS).catch(() => {
298
316
  if (![import_voice.VoiceConnectionStatus.Ready, import_voice.VoiceConnectionStatus.Connecting].includes(this.connection.state.status)) {
299
317
  this.leave();
300
318
  }
301
319
  });
302
- } else if (this.connection.rejoinAttempts < 5) {
320
+ } else if (this.connection.rejoinAttempts < RECONNECT_MAX_ATTEMPTS) {
303
321
  setTimeout(
304
322
  () => {
305
323
  this.connection.rejoin();
306
324
  },
307
- (this.connection.rejoinAttempts + 1) * 5e3
325
+ (this.connection.rejoinAttempts + 1) * RECONNECT_TIMEOUT_MS
308
326
  ).unref();
309
327
  } else if (this.connection.state.status !== import_voice.VoiceConnectionStatus.Destroyed) {
310
328
  this.leave(new DisTubeError("VOICE_RECONNECT_FAILED"));
@@ -360,15 +378,14 @@ var DisTubeVoice = class extends import_tiny_typed_emitter.TypedEmitter {
360
378
  * @param channel - A voice channel
361
379
  */
362
380
  async join(channel) {
363
- const TIMEOUT = 3e4;
364
381
  if (channel) this.channel = channel;
365
382
  try {
366
- await (0, import_voice.entersState)(this.connection, import_voice.VoiceConnectionStatus.Ready, TIMEOUT);
383
+ await (0, import_voice.entersState)(this.connection, import_voice.VoiceConnectionStatus.Ready, JOIN_TIMEOUT_MS);
367
384
  } catch {
368
385
  if (this.connection.state.status === import_voice.VoiceConnectionStatus.Ready) return this;
369
386
  if (this.connection.state.status !== import_voice.VoiceConnectionStatus.Destroyed) this.connection.destroy();
370
387
  this.voices.remove(this.id);
371
- throw new DisTubeError("VOICE_CONNECT_FAILED", TIMEOUT / 1e3);
388
+ throw new DisTubeError("VOICE_CONNECT_FAILED", JOIN_TIMEOUT_MS / 1e3);
372
389
  }
373
390
  return this;
374
391
  }
@@ -393,6 +410,7 @@ var DisTubeVoice = class extends import_tiny_typed_emitter.TypedEmitter {
393
410
  stop(force = false) {
394
411
  this.audioPlayer.stop(force);
395
412
  }
413
+ #streamErrorHandler;
396
414
  /**
397
415
  * Play a {@link DisTubeStream}
398
416
  * @param dtStream - DisTubeStream
@@ -403,11 +421,15 @@ var DisTubeVoice = class extends import_tiny_typed_emitter.TypedEmitter {
403
421
  throw new DisTubeError("ENCRYPTION_LIBRARIES_MISSING");
404
422
  }
405
423
  this.emittedError = false;
406
- dtStream.on("error", (error) => {
424
+ if (this.stream && this.#streamErrorHandler) {
425
+ this.stream.off("error", this.#streamErrorHandler);
426
+ }
427
+ this.#streamErrorHandler = (error) => {
407
428
  if (this.emittedError || error.code === "ERR_STREAM_PREMATURE_CLOSE") return;
408
429
  this.emittedError = true;
409
430
  this.emit("error", error);
410
- });
431
+ };
432
+ dtStream.on("error", this.#streamErrorHandler);
411
433
  if (this.audioPlayer.state.status !== import_voice.AudioPlayerStatus.Paused) {
412
434
  this.audioPlayer.play(dtStream.audioResource);
413
435
  this.stream?.kill();
@@ -435,11 +457,17 @@ var DisTubeVoice = class extends import_tiny_typed_emitter.TypedEmitter {
435
457
  return this.#volume;
436
458
  }
437
459
  /**
438
- * Playback duration of the audio resource in seconds
460
+ * Playback duration of the audio resource in seconds (time since playback started)
439
461
  */
440
462
  get playbackDuration() {
441
463
  return (this.stream?.audioResource?.playbackDuration ?? 0) / 1e3;
442
464
  }
465
+ /**
466
+ * Current playback time in seconds, accounting for seek offset
467
+ */
468
+ get playbackTime() {
469
+ return this.playbackDuration + (this.stream?.seekTime ?? 0);
470
+ }
443
471
  pause() {
444
472
  this.audioPlayer.pause();
445
473
  }
@@ -735,7 +763,10 @@ var Queue = class extends DisTubeBase {
735
763
  */
736
764
  stopped;
737
765
  /**
738
- * Whether or not the stream is currently playing.
766
+ * Whether or not the queue is active.
767
+ *
768
+ * Note: This remains `true` when paused. It only becomes `false` when stopped.
769
+ * @deprecated Use `!queue.paused` to check if audio is playing. Will be removed in v6.0.
739
770
  */
740
771
  playing;
741
772
  /**
@@ -762,19 +793,23 @@ var Queue = class extends DisTubeBase {
762
793
  textChannel;
763
794
  /**
764
795
  * What time in the song to begin (in seconds).
796
+ * @internal
765
797
  */
766
798
  _beginTime;
767
799
  #filters;
768
800
  /**
769
801
  * Whether or not the queue is being updated manually (skip, jump, previous)
802
+ * @internal
770
803
  */
771
804
  _manualUpdate;
772
805
  /**
773
806
  * Task queuing system
807
+ * @internal
774
808
  */
775
809
  _taskQueue;
776
810
  /**
777
811
  * {@link DisTubeVoice} listener
812
+ * @internal
778
813
  */
779
814
  _listeners;
780
815
  /**
@@ -787,7 +822,7 @@ var Queue = class extends DisTubeBase {
787
822
  super(distube);
788
823
  this.voice = voice;
789
824
  this.id = voice.id;
790
- this.volume = 50;
825
+ this.volume = DEFAULT_VOLUME;
791
826
  this.songs = [];
792
827
  this.previousSongs = [];
793
828
  this.stopped = false;
@@ -852,7 +887,7 @@ var Queue = class extends DisTubeBase {
852
887
  * What time in the song is playing (in seconds).
853
888
  */
854
889
  get currentTime() {
855
- return this.voice.playbackDuration + this._beginTime;
890
+ return this.voice.playbackTime;
856
891
  }
857
892
  /**
858
893
  * Formatted {@link Queue#currentTime} string.
@@ -900,13 +935,15 @@ var Queue = class extends DisTubeBase {
900
935
  return this;
901
936
  }
902
937
  /**
903
- * @returns `true` if the queue is playing
938
+ * @returns `true` if the queue is active (not stopped)
939
+ * @deprecated Use `!queue.paused` to check if audio is playing. Will be removed in v6.0.
904
940
  */
905
941
  isPlaying() {
906
942
  return this.playing;
907
943
  }
908
944
  /**
909
945
  * @returns `true` if the queue is paused
946
+ * @deprecated Use `queue.paused` property instead. Will be removed in v6.0.
910
947
  */
911
948
  isPaused() {
912
949
  return this.paused;
@@ -1016,7 +1053,7 @@ var Queue = class extends DisTubeBase {
1016
1053
  if (position > 0) {
1017
1054
  if (position >= this.songs.length) {
1018
1055
  if (this.autoplay) {
1019
- await this.addRelatedSong();
1056
+ await this._addRelatedSong();
1020
1057
  } else {
1021
1058
  throw new DisTubeError("NO_UP_NEXT");
1022
1059
  }
@@ -1059,12 +1096,17 @@ var Queue = class extends DisTubeBase {
1059
1096
  * @param time - Time in seconds
1060
1097
  * @returns The guild queue
1061
1098
  */
1062
- seek(time) {
1063
- if (typeof time !== "number") throw new DisTubeError("INVALID_TYPE", "number", time, "time");
1064
- if (Number.isNaN(time) || time < 0) throw new DisTubeError("NUMBER_COMPARE", "time", "bigger or equal to", 0);
1065
- this._beginTime = time;
1066
- this.play(false);
1067
- return this;
1099
+ async seek(time) {
1100
+ await this._taskQueue.queuing();
1101
+ try {
1102
+ if (typeof time !== "number") throw new DisTubeError("INVALID_TYPE", "number", time, "time");
1103
+ if (Number.isNaN(time) || time < 0) throw new DisTubeError("NUMBER_COMPARE", "time", "bigger or equal to", 0);
1104
+ this._beginTime = time;
1105
+ await this.play(false);
1106
+ return this;
1107
+ } finally {
1108
+ this._taskQueue.resolve();
1109
+ }
1068
1110
  }
1069
1111
  async #getRelatedSong(current) {
1070
1112
  const plugin = await this.handler._getPluginFromSong(current);
@@ -1072,11 +1114,11 @@ var Queue = class extends DisTubeBase {
1072
1114
  return [];
1073
1115
  }
1074
1116
  /**
1075
- * Add a related song of the playing song to the queue
1076
- * @param song - The song to get related songs from. Defaults to the current playing song.
1077
- * @returns The added song
1117
+ * Internal implementation of addRelatedSong without task queue protection.
1118
+ * Used by methods that already hold the task queue lock.
1119
+ * @internal
1078
1120
  */
1079
- async addRelatedSong(song) {
1121
+ async _addRelatedSong(song) {
1080
1122
  const current = song ?? this.songs?.[0];
1081
1123
  if (!current) throw new DisTubeError("NO_PLAYING_SONG");
1082
1124
  const prevIds = this.previousSongs.map((p) => p.id);
@@ -1094,6 +1136,19 @@ var Queue = class extends DisTubeBase {
1094
1136
  this.addToQueue(nextSong);
1095
1137
  return nextSong;
1096
1138
  }
1139
+ /**
1140
+ * Add a related song of the playing song to the queue
1141
+ * @param song - The song to get related songs from. Defaults to the current playing song.
1142
+ * @returns The added song
1143
+ */
1144
+ async addRelatedSong(song) {
1145
+ await this._taskQueue.queuing();
1146
+ try {
1147
+ return await this._addRelatedSong(song);
1148
+ } finally {
1149
+ this._taskQueue.resolve();
1150
+ }
1151
+ }
1097
1152
  /**
1098
1153
  * Stop the guild stream and delete the queue
1099
1154
  */
@@ -1111,7 +1166,7 @@ var Queue = class extends DisTubeBase {
1111
1166
  */
1112
1167
  remove() {
1113
1168
  this.playing = false;
1114
- this.paused = false;
1169
+ this.paused = true;
1115
1170
  this.stopped = true;
1116
1171
  this.songs = [];
1117
1172
  this.previousSongs = [];
@@ -1503,7 +1558,6 @@ var Song = class {
1503
1558
  };
1504
1559
 
1505
1560
  // src/core/DisTubeHandler.ts
1506
- var REDIRECT_CODES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
1507
1561
  var DisTubeHandler = class extends DisTubeBase {
1508
1562
  static {
1509
1563
  __name(this, "DisTubeHandler");
@@ -1590,7 +1644,7 @@ var DisTubeHandler = class extends DisTubeBase {
1590
1644
  song.stream.song = altSong;
1591
1645
  }
1592
1646
  }
1593
- async followRedirectLink(url, maxRedirect = 5) {
1647
+ async followRedirectLink(url, maxRedirect = MAX_REDIRECT_DEPTH) {
1594
1648
  if (maxRedirect === 0) return url;
1595
1649
  const res = await (0, import_undici.request)(url, {
1596
1650
  method: "HEAD",
@@ -1598,7 +1652,7 @@ var DisTubeHandler = class extends DisTubeBase {
1598
1652
  "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"
1599
1653
  }
1600
1654
  });
1601
- if (REDIRECT_CODES.has(res.statusCode ?? 200)) {
1655
+ if (HTTP_REDIRECT_CODES.has(res.statusCode ?? 200)) {
1602
1656
  let location = res.headers.location;
1603
1657
  if (typeof location !== "string") location = location?.[0] ?? url;
1604
1658
  return this.followRedirectLink(location, --maxRedirect);
@@ -1727,7 +1781,8 @@ var checkFFmpeg = /* @__PURE__ */ __name((distube) => {
1727
1781
  if (!version2) throw new Error("Invalid FFmpeg version");
1728
1782
  debug(`[test] ffmpeg version: ${version2}`);
1729
1783
  } catch (e) {
1730
- debug(`[test] failed to spawn ffmpeg at '${path}': ${e?.stack ?? e}`);
1784
+ const errorMessage = e instanceof Error ? e.stack ?? e.message : String(e);
1785
+ debug(`[test] failed to spawn ffmpeg at '${path}': ${errorMessage}`);
1731
1786
  throw new DisTubeError("FFMPEG_NOT_INSTALLED", path);
1732
1787
  }
1733
1788
  checked = true;
@@ -1741,6 +1796,10 @@ var DisTubeStream = class extends import_tiny_typed_emitter2.TypedEmitter {
1741
1796
  process;
1742
1797
  stream;
1743
1798
  audioResource;
1799
+ /**
1800
+ * The seek time in seconds that this stream started from
1801
+ */
1802
+ seekTime;
1744
1803
  /**
1745
1804
  * Create a DisTubeStream to play with {@link DisTubeVoice}
1746
1805
  * @param url - Stream URL
@@ -1749,6 +1808,7 @@ var DisTubeStream = class extends import_tiny_typed_emitter2.TypedEmitter {
1749
1808
  constructor(url, options) {
1750
1809
  super();
1751
1810
  const { ffmpeg, seek } = options;
1811
+ this.seekTime = typeof seek === "number" && seek > 0 ? seek : 0;
1752
1812
  const opts = {
1753
1813
  reconnect: 1,
1754
1814
  reconnect_streamed: 1,
@@ -1758,8 +1818,8 @@ var DisTubeStream = class extends import_tiny_typed_emitter2.TypedEmitter {
1758
1818
  ...ffmpeg.args.global,
1759
1819
  ...ffmpeg.args.input,
1760
1820
  i: url,
1761
- ar: 48e3,
1762
- ac: 2,
1821
+ ar: AUDIO_SAMPLE_RATE,
1822
+ ac: AUDIO_CHANNELS,
1763
1823
  ...ffmpeg.args.output,
1764
1824
  f: "s16le"
1765
1825
  };
@@ -1967,8 +2027,8 @@ var QueueManager = class extends GuildIdManager {
1967
2027
  this.emit("disconnect" /* DISCONNECT */, queue);
1968
2028
  if (error) this.emitError(error, queue, queue.songs?.[0]);
1969
2029
  }, "disconnect"),
1970
- error: /* @__PURE__ */ __name((error) => this.#handlePlayingError(queue, error), "error"),
1971
- finish: /* @__PURE__ */ __name(() => this.handleSongFinish(queue), "finish")
2030
+ error: /* @__PURE__ */ __name((error) => void this.#handlePlayingError(queue, error), "error"),
2031
+ finish: /* @__PURE__ */ __name(() => void this.handleSongFinish(queue), "finish")
1972
2032
  };
1973
2033
  for (const event of objectKeys(queue._listeners)) {
1974
2034
  queue.voice.on(event, queue._listeners[event]);
@@ -1999,10 +2059,15 @@ var QueueManager = class extends GuildIdManager {
1999
2059
  if (queue.songs.length === 0 && queue.autoplay) {
2000
2060
  try {
2001
2061
  this.debug(`[QueueManager] Adding related song: ${queue.id}`);
2002
- await queue.addRelatedSong(song);
2062
+ await queue._addRelatedSong(song);
2003
2063
  } catch (e) {
2004
- this.debug(`[${queue.id}] Add related song error: ${e.message}`);
2005
- this.emit("noRelated" /* NO_RELATED */, queue, e);
2064
+ const errorMessage = e instanceof Error ? e.message : String(e);
2065
+ this.debug(`[${queue.id}] Add related song error: ${errorMessage}`);
2066
+ if (e instanceof DisTubeError) {
2067
+ this.emit("noRelated" /* NO_RELATED */, queue, e);
2068
+ } else {
2069
+ this.emit("noRelated" /* NO_RELATED */, queue, new DisTubeError("NO_RELATED"));
2070
+ }
2006
2071
  }
2007
2072
  }
2008
2073
  if (queue.songs.length === 0) {
@@ -2025,7 +2090,7 @@ var QueueManager = class extends GuildIdManager {
2025
2090
  * @param queue - queue
2026
2091
  * @param error - error
2027
2092
  */
2028
- #handlePlayingError(queue, error) {
2093
+ async #handlePlayingError(queue, error) {
2029
2094
  const song = queue.songs.shift();
2030
2095
  try {
2031
2096
  error.name = "PlayingError";
@@ -2035,10 +2100,10 @@ var QueueManager = class extends GuildIdManager {
2035
2100
  this.emitError(error, queue, song);
2036
2101
  if (queue.songs.length > 0) {
2037
2102
  this.debug(`[${queue.id}] Playing next song: ${queue.songs[0]}`);
2038
- this.playSong(queue);
2103
+ await this.playSong(queue);
2039
2104
  } else {
2040
2105
  this.debug(`[${queue.id}] Queue is empty, stopping...`);
2041
- queue.stop();
2106
+ await queue.stop();
2042
2107
  }
2043
2108
  }
2044
2109
  /**
@@ -2049,7 +2114,7 @@ var QueueManager = class extends GuildIdManager {
2049
2114
  async playSong(queue, emitPlaySong = true) {
2050
2115
  if (!queue) return;
2051
2116
  if (queue.stopped || !queue.songs.length) {
2052
- queue.stop();
2117
+ await queue.stop();
2053
2118
  return;
2054
2119
  }
2055
2120
  try {
@@ -2078,7 +2143,8 @@ var QueueManager = class extends GuildIdManager {
2078
2143
  await queue.voice.play(dtStream);
2079
2144
  if (emitPlaySong) this.emit("playSong" /* PLAY_SONG */, queue, song);
2080
2145
  } catch (e) {
2081
- this.#handlePlayingError(queue, e);
2146
+ const error = e instanceof Error ? e : new Error(String(e));
2147
+ this.#handlePlayingError(queue, error);
2082
2148
  }
2083
2149
  }
2084
2150
  };
@@ -2273,25 +2339,28 @@ var DisTube = class extends import_tiny_typed_emitter3.TypedEmitter {
2273
2339
  if (!resolved.songs.length) throw new DisTubeError("EMPTY_PLAYLIST");
2274
2340
  this.debug(`[${queue.id}] Adding playlist to queue: ${resolved.songs.length} songs`);
2275
2341
  queue.addToQueue(resolved.songs, position);
2276
- if (queue.playing || this.options.emitAddListWhenCreatingQueue) this.emit("addList" /* ADD_LIST */, queue, resolved);
2342
+ if (!queue.stopped || this.options.emitAddListWhenCreatingQueue) this.emit("addList" /* ADD_LIST */, queue, resolved);
2277
2343
  } else {
2278
2344
  if (!this.options.nsfw && resolved.ageRestricted && !isNsfwChannel(queue?.textChannel || textChannel)) {
2279
2345
  throw new DisTubeError("NON_NSFW");
2280
2346
  }
2281
2347
  this.debug(`[${queue.id}] Adding song to queue: ${resolved.name || resolved.url || resolved.id || resolved}`);
2282
2348
  queue.addToQueue(resolved, position);
2283
- if (queue.playing || this.options.emitAddSongWhenCreatingQueue) this.emit("addSong" /* ADD_SONG */, queue, resolved);
2349
+ if (!queue.stopped || this.options.emitAddSongWhenCreatingQueue) this.emit("addSong" /* ADD_SONG */, queue, resolved);
2284
2350
  }
2285
- if (!queue.playing) await queue.play();
2351
+ if (queue.stopped) await queue.play();
2286
2352
  else if (skip) await queue.skip();
2287
2353
  } catch (e) {
2288
2354
  if (!(e instanceof DisTubeError)) {
2289
- this.debug(`[${queue.id}] Unexpected error while playing song: ${e.stack || e.message}`);
2290
- try {
2291
- e.name = "PlayError";
2292
- e.message = `${typeof song === "string" ? song : song.url}
2355
+ const errorMessage = e instanceof Error ? e.stack ?? e.message : String(e);
2356
+ this.debug(`[${queue.id}] Unexpected error while playing song: ${errorMessage}`);
2357
+ if (e instanceof Error) {
2358
+ try {
2359
+ e.name = "PlayError";
2360
+ e.message = `${typeof song === "string" ? song : song.url}
2293
2361
  ${e.message}`;
2294
- } catch {
2362
+ } catch {
2363
+ }
2295
2364
  }
2296
2365
  }
2297
2366
  throw e;
@@ -2353,6 +2422,7 @@ ${e.message}`;
2353
2422
  * Pause the guild stream
2354
2423
  * @param guild - The type can be resolved to give a {@link Queue}
2355
2424
  * @returns The guild queue
2425
+ * @deprecated Use `distube.getQueue(guild).pause()` instead. Will be removed in v6.0.
2356
2426
  */
2357
2427
  pause(guild) {
2358
2428
  return this.#getQueue(guild).pause();
@@ -2361,6 +2431,7 @@ ${e.message}`;
2361
2431
  * Resume the guild stream
2362
2432
  * @param guild - The type can be resolved to give a {@link Queue}
2363
2433
  * @returns The guild queue
2434
+ * @deprecated Use `distube.getQueue(guild).resume()` instead. Will be removed in v6.0.
2364
2435
  */
2365
2436
  resume(guild) {
2366
2437
  return this.#getQueue(guild).resume();
@@ -2368,6 +2439,7 @@ ${e.message}`;
2368
2439
  /**
2369
2440
  * Stop the guild stream
2370
2441
  * @param guild - The type can be resolved to give a {@link Queue}
2442
+ * @deprecated Use `distube.getQueue(guild).stop()` instead. Will be removed in v6.0.
2371
2443
  */
2372
2444
  stop(guild) {
2373
2445
  return this.#getQueue(guild).stop();
@@ -2377,6 +2449,7 @@ ${e.message}`;
2377
2449
  * @param guild - The type can be resolved to give a {@link Queue}
2378
2450
  * @param percent - The percentage of volume you want to set
2379
2451
  * @returns The guild queue
2452
+ * @deprecated Use `distube.getQueue(guild).setVolume(percent)` instead. Will be removed in v6.0.
2380
2453
  */
2381
2454
  setVolume(guild, percent) {
2382
2455
  return this.#getQueue(guild).setVolume(percent);
@@ -2387,6 +2460,7 @@ ${e.message}`;
2387
2460
  * play a related song.</info>
2388
2461
  * @param guild - The type can be resolved to give a {@link Queue}
2389
2462
  * @returns The new Song will be played
2463
+ * @deprecated Use `distube.getQueue(guild).skip(options)` instead. Will be removed in v6.0.
2390
2464
  */
2391
2465
  skip(guild, options) {
2392
2466
  return this.#getQueue(guild).skip(options);
@@ -2395,6 +2469,7 @@ ${e.message}`;
2395
2469
  * Play the previous song
2396
2470
  * @param guild - The type can be resolved to give a {@link Queue}
2397
2471
  * @returns The new Song will be played
2472
+ * @deprecated Use `distube.getQueue(guild).previous()` instead. Will be removed in v6.0.
2398
2473
  */
2399
2474
  previous(guild) {
2400
2475
  return this.#getQueue(guild).previous();
@@ -2403,6 +2478,7 @@ ${e.message}`;
2403
2478
  * Shuffle the guild queue songs
2404
2479
  * @param guild - The type can be resolved to give a {@link Queue}
2405
2480
  * @returns The guild queue
2481
+ * @deprecated Use `distube.getQueue(guild).shuffle()` instead. Will be removed in v6.0.
2406
2482
  */
2407
2483
  shuffle(guild) {
2408
2484
  return this.#getQueue(guild).shuffle();
@@ -2413,6 +2489,7 @@ ${e.message}`;
2413
2489
  * @param guild - The type can be resolved to give a {@link Queue}
2414
2490
  * @param num - The song number to play
2415
2491
  * @returns The new Song will be played
2492
+ * @deprecated Use `distube.getQueue(guild).jump(num, options)` instead. Will be removed in v6.0.
2416
2493
  */
2417
2494
  jump(guild, num, options) {
2418
2495
  return this.#getQueue(guild).jump(num, options);
@@ -2423,6 +2500,7 @@ ${e.message}`;
2423
2500
  * @param guild - The type can be resolved to give a {@link Queue}
2424
2501
  * @param mode - The repeat modes (toggle if `undefined`)
2425
2502
  * @returns The new repeat mode
2503
+ * @deprecated Use `distube.getQueue(guild).setRepeatMode(mode)` instead. Will be removed in v6.0.
2426
2504
  */
2427
2505
  setRepeatMode(guild, mode) {
2428
2506
  return this.#getQueue(guild).setRepeatMode(mode);
@@ -2431,6 +2509,7 @@ ${e.message}`;
2431
2509
  * Toggle autoplay mode
2432
2510
  * @param guild - The type can be resolved to give a {@link Queue}
2433
2511
  * @returns Autoplay mode state
2512
+ * @deprecated Use `distube.getQueue(guild).toggleAutoplay()` instead. Will be removed in v6.0.
2434
2513
  */
2435
2514
  toggleAutoplay(guild) {
2436
2515
  const queue = this.#getQueue(guild);
@@ -2441,6 +2520,7 @@ ${e.message}`;
2441
2520
  * Add related song to the queue
2442
2521
  * @param guild - The type can be resolved to give a {@link Queue}
2443
2522
  * @returns The guild queue
2523
+ * @deprecated Use `distube.getQueue(guild).addRelatedSong()` instead. Will be removed in v6.0.
2444
2524
  */
2445
2525
  addRelatedSong(guild) {
2446
2526
  return this.#getQueue(guild).addRelatedSong();
@@ -2450,6 +2530,7 @@ ${e.message}`;
2450
2530
  * @param guild - The type can be resolved to give a {@link Queue}
2451
2531
  * @param time - Time in seconds
2452
2532
  * @returns Seeked queue
2533
+ * @deprecated Use `distube.getQueue(guild).seek(time)` instead. Will be removed in v6.0.
2453
2534
  */
2454
2535
  seek(guild, time) {
2455
2536
  return this.#getQueue(guild).seek(time);
@@ -2494,7 +2575,7 @@ var ExtractorPlugin = class extends Plugin {
2494
2575
  type = "extractor" /* EXTRACTOR */;
2495
2576
  };
2496
2577
 
2497
- // src/struct/InfoExtratorPlugin.ts
2578
+ // src/struct/InfoExtractorPlugin.ts
2498
2579
  var InfoExtractorPlugin = class extends Plugin {
2499
2580
  static {
2500
2581
  __name(this, "InfoExtractorPlugin");
@@ -2502,7 +2583,7 @@ var InfoExtractorPlugin = class extends Plugin {
2502
2583
  type = "info-extractor" /* INFO_EXTRACTOR */;
2503
2584
  };
2504
2585
 
2505
- // src/struct/PlayableExtratorPlugin.ts
2586
+ // src/struct/PlayableExtractorPlugin.ts
2506
2587
  var PlayableExtractorPlugin = class extends Plugin {
2507
2588
  static {
2508
2589
  __name(this, "PlayableExtractorPlugin");
@@ -2511,7 +2592,10 @@ var PlayableExtractorPlugin = class extends Plugin {
2511
2592
  };
2512
2593
  // Annotate the CommonJS export names for ESM import in node:
2513
2594
  0 && (module.exports = {
2595
+ AUDIO_CHANNELS,
2596
+ AUDIO_SAMPLE_RATE,
2514
2597
  BaseManager,
2598
+ DEFAULT_VOLUME,
2515
2599
  DisTube,
2516
2600
  DisTubeBase,
2517
2601
  DisTubeError,
@@ -2523,14 +2607,21 @@ var PlayableExtractorPlugin = class extends Plugin {
2523
2607
  ExtractorPlugin,
2524
2608
  FilterManager,
2525
2609
  GuildIdManager,
2610
+ HTTP_REDIRECT_CODES,
2526
2611
  InfoExtractorPlugin,
2612
+ InfoExtratorPlugin,
2613
+ JOIN_TIMEOUT_MS,
2614
+ MAX_REDIRECT_DEPTH,
2527
2615
  Options,
2528
2616
  PlayableExtractorPlugin,
2617
+ PlayableExtratorPlugin,
2529
2618
  Playlist,
2530
2619
  Plugin,
2531
2620
  PluginType,
2532
2621
  Queue,
2533
2622
  QueueManager,
2623
+ RECONNECT_MAX_ATTEMPTS,
2624
+ RECONNECT_TIMEOUT_MS,
2534
2625
  RepeatMode,
2535
2626
  Song,
2536
2627
  TaskQueue,