distube 5.1.1 → 5.2.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.
- package/dist/index.d.mts +53 -5
- package/dist/index.d.ts +53 -5
- package/dist/index.js +111 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +101 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -13
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.
|
|
94
|
+
var version = "5.2.0";
|
|
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,
|
|
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 <
|
|
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) *
|
|
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,
|
|
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",
|
|
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
|
-
|
|
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
|
|
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 =
|
|
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.
|
|
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
|
|
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;
|
|
@@ -1111,7 +1148,7 @@ var Queue = class extends DisTubeBase {
|
|
|
1111
1148
|
*/
|
|
1112
1149
|
remove() {
|
|
1113
1150
|
this.playing = false;
|
|
1114
|
-
this.paused =
|
|
1151
|
+
this.paused = true;
|
|
1115
1152
|
this.stopped = true;
|
|
1116
1153
|
this.songs = [];
|
|
1117
1154
|
this.previousSongs = [];
|
|
@@ -1503,7 +1540,6 @@ var Song = class {
|
|
|
1503
1540
|
};
|
|
1504
1541
|
|
|
1505
1542
|
// src/core/DisTubeHandler.ts
|
|
1506
|
-
var REDIRECT_CODES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
1507
1543
|
var DisTubeHandler = class extends DisTubeBase {
|
|
1508
1544
|
static {
|
|
1509
1545
|
__name(this, "DisTubeHandler");
|
|
@@ -1590,7 +1626,7 @@ var DisTubeHandler = class extends DisTubeBase {
|
|
|
1590
1626
|
song.stream.song = altSong;
|
|
1591
1627
|
}
|
|
1592
1628
|
}
|
|
1593
|
-
async followRedirectLink(url, maxRedirect =
|
|
1629
|
+
async followRedirectLink(url, maxRedirect = MAX_REDIRECT_DEPTH) {
|
|
1594
1630
|
if (maxRedirect === 0) return url;
|
|
1595
1631
|
const res = await (0, import_undici.request)(url, {
|
|
1596
1632
|
method: "HEAD",
|
|
@@ -1598,7 +1634,7 @@ var DisTubeHandler = class extends DisTubeBase {
|
|
|
1598
1634
|
"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
1635
|
}
|
|
1600
1636
|
});
|
|
1601
|
-
if (
|
|
1637
|
+
if (HTTP_REDIRECT_CODES.has(res.statusCode ?? 200)) {
|
|
1602
1638
|
let location = res.headers.location;
|
|
1603
1639
|
if (typeof location !== "string") location = location?.[0] ?? url;
|
|
1604
1640
|
return this.followRedirectLink(location, --maxRedirect);
|
|
@@ -1727,7 +1763,8 @@ var checkFFmpeg = /* @__PURE__ */ __name((distube) => {
|
|
|
1727
1763
|
if (!version2) throw new Error("Invalid FFmpeg version");
|
|
1728
1764
|
debug(`[test] ffmpeg version: ${version2}`);
|
|
1729
1765
|
} catch (e) {
|
|
1730
|
-
|
|
1766
|
+
const errorMessage = e instanceof Error ? e.stack ?? e.message : String(e);
|
|
1767
|
+
debug(`[test] failed to spawn ffmpeg at '${path}': ${errorMessage}`);
|
|
1731
1768
|
throw new DisTubeError("FFMPEG_NOT_INSTALLED", path);
|
|
1732
1769
|
}
|
|
1733
1770
|
checked = true;
|
|
@@ -1741,6 +1778,10 @@ var DisTubeStream = class extends import_tiny_typed_emitter2.TypedEmitter {
|
|
|
1741
1778
|
process;
|
|
1742
1779
|
stream;
|
|
1743
1780
|
audioResource;
|
|
1781
|
+
/**
|
|
1782
|
+
* The seek time in seconds that this stream started from
|
|
1783
|
+
*/
|
|
1784
|
+
seekTime;
|
|
1744
1785
|
/**
|
|
1745
1786
|
* Create a DisTubeStream to play with {@link DisTubeVoice}
|
|
1746
1787
|
* @param url - Stream URL
|
|
@@ -1749,6 +1790,7 @@ var DisTubeStream = class extends import_tiny_typed_emitter2.TypedEmitter {
|
|
|
1749
1790
|
constructor(url, options) {
|
|
1750
1791
|
super();
|
|
1751
1792
|
const { ffmpeg, seek } = options;
|
|
1793
|
+
this.seekTime = typeof seek === "number" && seek > 0 ? seek : 0;
|
|
1752
1794
|
const opts = {
|
|
1753
1795
|
reconnect: 1,
|
|
1754
1796
|
reconnect_streamed: 1,
|
|
@@ -1758,8 +1800,8 @@ var DisTubeStream = class extends import_tiny_typed_emitter2.TypedEmitter {
|
|
|
1758
1800
|
...ffmpeg.args.global,
|
|
1759
1801
|
...ffmpeg.args.input,
|
|
1760
1802
|
i: url,
|
|
1761
|
-
ar:
|
|
1762
|
-
ac:
|
|
1803
|
+
ar: AUDIO_SAMPLE_RATE,
|
|
1804
|
+
ac: AUDIO_CHANNELS,
|
|
1763
1805
|
...ffmpeg.args.output,
|
|
1764
1806
|
f: "s16le"
|
|
1765
1807
|
};
|
|
@@ -1967,8 +2009,8 @@ var QueueManager = class extends GuildIdManager {
|
|
|
1967
2009
|
this.emit("disconnect" /* DISCONNECT */, queue);
|
|
1968
2010
|
if (error) this.emitError(error, queue, queue.songs?.[0]);
|
|
1969
2011
|
}, "disconnect"),
|
|
1970
|
-
error: /* @__PURE__ */ __name((error) => this.#handlePlayingError(queue, error), "error"),
|
|
1971
|
-
finish: /* @__PURE__ */ __name(() => this.handleSongFinish(queue), "finish")
|
|
2012
|
+
error: /* @__PURE__ */ __name((error) => void this.#handlePlayingError(queue, error), "error"),
|
|
2013
|
+
finish: /* @__PURE__ */ __name(() => void this.handleSongFinish(queue), "finish")
|
|
1972
2014
|
};
|
|
1973
2015
|
for (const event of objectKeys(queue._listeners)) {
|
|
1974
2016
|
queue.voice.on(event, queue._listeners[event]);
|
|
@@ -2001,8 +2043,13 @@ var QueueManager = class extends GuildIdManager {
|
|
|
2001
2043
|
this.debug(`[QueueManager] Adding related song: ${queue.id}`);
|
|
2002
2044
|
await queue.addRelatedSong(song);
|
|
2003
2045
|
} catch (e) {
|
|
2004
|
-
|
|
2005
|
-
this.
|
|
2046
|
+
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
2047
|
+
this.debug(`[${queue.id}] Add related song error: ${errorMessage}`);
|
|
2048
|
+
if (e instanceof DisTubeError) {
|
|
2049
|
+
this.emit("noRelated" /* NO_RELATED */, queue, e);
|
|
2050
|
+
} else {
|
|
2051
|
+
this.emit("noRelated" /* NO_RELATED */, queue, new DisTubeError("NO_RELATED"));
|
|
2052
|
+
}
|
|
2006
2053
|
}
|
|
2007
2054
|
}
|
|
2008
2055
|
if (queue.songs.length === 0) {
|
|
@@ -2025,7 +2072,7 @@ var QueueManager = class extends GuildIdManager {
|
|
|
2025
2072
|
* @param queue - queue
|
|
2026
2073
|
* @param error - error
|
|
2027
2074
|
*/
|
|
2028
|
-
#handlePlayingError(queue, error) {
|
|
2075
|
+
async #handlePlayingError(queue, error) {
|
|
2029
2076
|
const song = queue.songs.shift();
|
|
2030
2077
|
try {
|
|
2031
2078
|
error.name = "PlayingError";
|
|
@@ -2035,10 +2082,10 @@ var QueueManager = class extends GuildIdManager {
|
|
|
2035
2082
|
this.emitError(error, queue, song);
|
|
2036
2083
|
if (queue.songs.length > 0) {
|
|
2037
2084
|
this.debug(`[${queue.id}] Playing next song: ${queue.songs[0]}`);
|
|
2038
|
-
this.playSong(queue);
|
|
2085
|
+
await this.playSong(queue);
|
|
2039
2086
|
} else {
|
|
2040
2087
|
this.debug(`[${queue.id}] Queue is empty, stopping...`);
|
|
2041
|
-
queue.stop();
|
|
2088
|
+
await queue.stop();
|
|
2042
2089
|
}
|
|
2043
2090
|
}
|
|
2044
2091
|
/**
|
|
@@ -2049,7 +2096,7 @@ var QueueManager = class extends GuildIdManager {
|
|
|
2049
2096
|
async playSong(queue, emitPlaySong = true) {
|
|
2050
2097
|
if (!queue) return;
|
|
2051
2098
|
if (queue.stopped || !queue.songs.length) {
|
|
2052
|
-
queue.stop();
|
|
2099
|
+
await queue.stop();
|
|
2053
2100
|
return;
|
|
2054
2101
|
}
|
|
2055
2102
|
try {
|
|
@@ -2071,13 +2118,15 @@ var QueueManager = class extends GuildIdManager {
|
|
|
2071
2118
|
},
|
|
2072
2119
|
seek: willPlaySong.duration ? queue._beginTime : void 0
|
|
2073
2120
|
};
|
|
2121
|
+
queue._beginTime = 0;
|
|
2074
2122
|
const dtStream = new DisTubeStream(stream.url, streamOptions);
|
|
2075
2123
|
dtStream.on("debug", (data) => this.emit("ffmpegDebug" /* FFMPEG_DEBUG */, `[${queue.id}] ${data}`));
|
|
2076
2124
|
this.debug(`[${queue.id}] Started playing: ${willPlaySong}`);
|
|
2077
2125
|
await queue.voice.play(dtStream);
|
|
2078
2126
|
if (emitPlaySong) this.emit("playSong" /* PLAY_SONG */, queue, song);
|
|
2079
2127
|
} catch (e) {
|
|
2080
|
-
|
|
2128
|
+
const error = e instanceof Error ? e : new Error(String(e));
|
|
2129
|
+
this.#handlePlayingError(queue, error);
|
|
2081
2130
|
}
|
|
2082
2131
|
}
|
|
2083
2132
|
};
|
|
@@ -2285,12 +2334,15 @@ var DisTube = class extends import_tiny_typed_emitter3.TypedEmitter {
|
|
|
2285
2334
|
else if (skip) await queue.skip();
|
|
2286
2335
|
} catch (e) {
|
|
2287
2336
|
if (!(e instanceof DisTubeError)) {
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2337
|
+
const errorMessage = e instanceof Error ? e.stack ?? e.message : String(e);
|
|
2338
|
+
this.debug(`[${queue.id}] Unexpected error while playing song: ${errorMessage}`);
|
|
2339
|
+
if (e instanceof Error) {
|
|
2340
|
+
try {
|
|
2341
|
+
e.name = "PlayError";
|
|
2342
|
+
e.message = `${typeof song === "string" ? song : song.url}
|
|
2292
2343
|
${e.message}`;
|
|
2293
|
-
|
|
2344
|
+
} catch {
|
|
2345
|
+
}
|
|
2294
2346
|
}
|
|
2295
2347
|
}
|
|
2296
2348
|
throw e;
|
|
@@ -2352,6 +2404,7 @@ ${e.message}`;
|
|
|
2352
2404
|
* Pause the guild stream
|
|
2353
2405
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2354
2406
|
* @returns The guild queue
|
|
2407
|
+
* @deprecated Use `distube.getQueue(guild).pause()` instead. Will be removed in v6.0.
|
|
2355
2408
|
*/
|
|
2356
2409
|
pause(guild) {
|
|
2357
2410
|
return this.#getQueue(guild).pause();
|
|
@@ -2360,6 +2413,7 @@ ${e.message}`;
|
|
|
2360
2413
|
* Resume the guild stream
|
|
2361
2414
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2362
2415
|
* @returns The guild queue
|
|
2416
|
+
* @deprecated Use `distube.getQueue(guild).resume()` instead. Will be removed in v6.0.
|
|
2363
2417
|
*/
|
|
2364
2418
|
resume(guild) {
|
|
2365
2419
|
return this.#getQueue(guild).resume();
|
|
@@ -2367,6 +2421,7 @@ ${e.message}`;
|
|
|
2367
2421
|
/**
|
|
2368
2422
|
* Stop the guild stream
|
|
2369
2423
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2424
|
+
* @deprecated Use `distube.getQueue(guild).stop()` instead. Will be removed in v6.0.
|
|
2370
2425
|
*/
|
|
2371
2426
|
stop(guild) {
|
|
2372
2427
|
return this.#getQueue(guild).stop();
|
|
@@ -2376,6 +2431,7 @@ ${e.message}`;
|
|
|
2376
2431
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2377
2432
|
* @param percent - The percentage of volume you want to set
|
|
2378
2433
|
* @returns The guild queue
|
|
2434
|
+
* @deprecated Use `distube.getQueue(guild).setVolume(percent)` instead. Will be removed in v6.0.
|
|
2379
2435
|
*/
|
|
2380
2436
|
setVolume(guild, percent) {
|
|
2381
2437
|
return this.#getQueue(guild).setVolume(percent);
|
|
@@ -2386,6 +2442,7 @@ ${e.message}`;
|
|
|
2386
2442
|
* play a related song.</info>
|
|
2387
2443
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2388
2444
|
* @returns The new Song will be played
|
|
2445
|
+
* @deprecated Use `distube.getQueue(guild).skip(options)` instead. Will be removed in v6.0.
|
|
2389
2446
|
*/
|
|
2390
2447
|
skip(guild, options) {
|
|
2391
2448
|
return this.#getQueue(guild).skip(options);
|
|
@@ -2394,6 +2451,7 @@ ${e.message}`;
|
|
|
2394
2451
|
* Play the previous song
|
|
2395
2452
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2396
2453
|
* @returns The new Song will be played
|
|
2454
|
+
* @deprecated Use `distube.getQueue(guild).previous()` instead. Will be removed in v6.0.
|
|
2397
2455
|
*/
|
|
2398
2456
|
previous(guild) {
|
|
2399
2457
|
return this.#getQueue(guild).previous();
|
|
@@ -2402,6 +2460,7 @@ ${e.message}`;
|
|
|
2402
2460
|
* Shuffle the guild queue songs
|
|
2403
2461
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2404
2462
|
* @returns The guild queue
|
|
2463
|
+
* @deprecated Use `distube.getQueue(guild).shuffle()` instead. Will be removed in v6.0.
|
|
2405
2464
|
*/
|
|
2406
2465
|
shuffle(guild) {
|
|
2407
2466
|
return this.#getQueue(guild).shuffle();
|
|
@@ -2412,6 +2471,7 @@ ${e.message}`;
|
|
|
2412
2471
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2413
2472
|
* @param num - The song number to play
|
|
2414
2473
|
* @returns The new Song will be played
|
|
2474
|
+
* @deprecated Use `distube.getQueue(guild).jump(num, options)` instead. Will be removed in v6.0.
|
|
2415
2475
|
*/
|
|
2416
2476
|
jump(guild, num, options) {
|
|
2417
2477
|
return this.#getQueue(guild).jump(num, options);
|
|
@@ -2422,6 +2482,7 @@ ${e.message}`;
|
|
|
2422
2482
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2423
2483
|
* @param mode - The repeat modes (toggle if `undefined`)
|
|
2424
2484
|
* @returns The new repeat mode
|
|
2485
|
+
* @deprecated Use `distube.getQueue(guild).setRepeatMode(mode)` instead. Will be removed in v6.0.
|
|
2425
2486
|
*/
|
|
2426
2487
|
setRepeatMode(guild, mode) {
|
|
2427
2488
|
return this.#getQueue(guild).setRepeatMode(mode);
|
|
@@ -2430,6 +2491,7 @@ ${e.message}`;
|
|
|
2430
2491
|
* Toggle autoplay mode
|
|
2431
2492
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2432
2493
|
* @returns Autoplay mode state
|
|
2494
|
+
* @deprecated Use `distube.getQueue(guild).toggleAutoplay()` instead. Will be removed in v6.0.
|
|
2433
2495
|
*/
|
|
2434
2496
|
toggleAutoplay(guild) {
|
|
2435
2497
|
const queue = this.#getQueue(guild);
|
|
@@ -2440,6 +2502,7 @@ ${e.message}`;
|
|
|
2440
2502
|
* Add related song to the queue
|
|
2441
2503
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2442
2504
|
* @returns The guild queue
|
|
2505
|
+
* @deprecated Use `distube.getQueue(guild).addRelatedSong()` instead. Will be removed in v6.0.
|
|
2443
2506
|
*/
|
|
2444
2507
|
addRelatedSong(guild) {
|
|
2445
2508
|
return this.#getQueue(guild).addRelatedSong();
|
|
@@ -2449,6 +2512,7 @@ ${e.message}`;
|
|
|
2449
2512
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2450
2513
|
* @param time - Time in seconds
|
|
2451
2514
|
* @returns Seeked queue
|
|
2515
|
+
* @deprecated Use `distube.getQueue(guild).seek(time)` instead. Will be removed in v6.0.
|
|
2452
2516
|
*/
|
|
2453
2517
|
seek(guild, time) {
|
|
2454
2518
|
return this.#getQueue(guild).seek(time);
|
|
@@ -2493,7 +2557,7 @@ var ExtractorPlugin = class extends Plugin {
|
|
|
2493
2557
|
type = "extractor" /* EXTRACTOR */;
|
|
2494
2558
|
};
|
|
2495
2559
|
|
|
2496
|
-
// src/struct/
|
|
2560
|
+
// src/struct/InfoExtractorPlugin.ts
|
|
2497
2561
|
var InfoExtractorPlugin = class extends Plugin {
|
|
2498
2562
|
static {
|
|
2499
2563
|
__name(this, "InfoExtractorPlugin");
|
|
@@ -2501,7 +2565,7 @@ var InfoExtractorPlugin = class extends Plugin {
|
|
|
2501
2565
|
type = "info-extractor" /* INFO_EXTRACTOR */;
|
|
2502
2566
|
};
|
|
2503
2567
|
|
|
2504
|
-
// src/struct/
|
|
2568
|
+
// src/struct/PlayableExtractorPlugin.ts
|
|
2505
2569
|
var PlayableExtractorPlugin = class extends Plugin {
|
|
2506
2570
|
static {
|
|
2507
2571
|
__name(this, "PlayableExtractorPlugin");
|
|
@@ -2510,7 +2574,10 @@ var PlayableExtractorPlugin = class extends Plugin {
|
|
|
2510
2574
|
};
|
|
2511
2575
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2512
2576
|
0 && (module.exports = {
|
|
2577
|
+
AUDIO_CHANNELS,
|
|
2578
|
+
AUDIO_SAMPLE_RATE,
|
|
2513
2579
|
BaseManager,
|
|
2580
|
+
DEFAULT_VOLUME,
|
|
2514
2581
|
DisTube,
|
|
2515
2582
|
DisTubeBase,
|
|
2516
2583
|
DisTubeError,
|
|
@@ -2522,14 +2589,21 @@ var PlayableExtractorPlugin = class extends Plugin {
|
|
|
2522
2589
|
ExtractorPlugin,
|
|
2523
2590
|
FilterManager,
|
|
2524
2591
|
GuildIdManager,
|
|
2592
|
+
HTTP_REDIRECT_CODES,
|
|
2525
2593
|
InfoExtractorPlugin,
|
|
2594
|
+
InfoExtratorPlugin,
|
|
2595
|
+
JOIN_TIMEOUT_MS,
|
|
2596
|
+
MAX_REDIRECT_DEPTH,
|
|
2526
2597
|
Options,
|
|
2527
2598
|
PlayableExtractorPlugin,
|
|
2599
|
+
PlayableExtratorPlugin,
|
|
2528
2600
|
Playlist,
|
|
2529
2601
|
Plugin,
|
|
2530
2602
|
PluginType,
|
|
2531
2603
|
Queue,
|
|
2532
2604
|
QueueManager,
|
|
2605
|
+
RECONNECT_MAX_ATTEMPTS,
|
|
2606
|
+
RECONNECT_TIMEOUT_MS,
|
|
2533
2607
|
RepeatMode,
|
|
2534
2608
|
Song,
|
|
2535
2609
|
TaskQueue,
|