distube 5.1.2 → 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 +110 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +100 -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 {
|
|
@@ -2078,7 +2125,8 @@ var QueueManager = class extends GuildIdManager {
|
|
|
2078
2125
|
await queue.voice.play(dtStream);
|
|
2079
2126
|
if (emitPlaySong) this.emit("playSong" /* PLAY_SONG */, queue, song);
|
|
2080
2127
|
} catch (e) {
|
|
2081
|
-
|
|
2128
|
+
const error = e instanceof Error ? e : new Error(String(e));
|
|
2129
|
+
this.#handlePlayingError(queue, error);
|
|
2082
2130
|
}
|
|
2083
2131
|
}
|
|
2084
2132
|
};
|
|
@@ -2286,12 +2334,15 @@ var DisTube = class extends import_tiny_typed_emitter3.TypedEmitter {
|
|
|
2286
2334
|
else if (skip) await queue.skip();
|
|
2287
2335
|
} catch (e) {
|
|
2288
2336
|
if (!(e instanceof DisTubeError)) {
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
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}
|
|
2293
2343
|
${e.message}`;
|
|
2294
|
-
|
|
2344
|
+
} catch {
|
|
2345
|
+
}
|
|
2295
2346
|
}
|
|
2296
2347
|
}
|
|
2297
2348
|
throw e;
|
|
@@ -2353,6 +2404,7 @@ ${e.message}`;
|
|
|
2353
2404
|
* Pause the guild stream
|
|
2354
2405
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2355
2406
|
* @returns The guild queue
|
|
2407
|
+
* @deprecated Use `distube.getQueue(guild).pause()` instead. Will be removed in v6.0.
|
|
2356
2408
|
*/
|
|
2357
2409
|
pause(guild) {
|
|
2358
2410
|
return this.#getQueue(guild).pause();
|
|
@@ -2361,6 +2413,7 @@ ${e.message}`;
|
|
|
2361
2413
|
* Resume the guild stream
|
|
2362
2414
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2363
2415
|
* @returns The guild queue
|
|
2416
|
+
* @deprecated Use `distube.getQueue(guild).resume()` instead. Will be removed in v6.0.
|
|
2364
2417
|
*/
|
|
2365
2418
|
resume(guild) {
|
|
2366
2419
|
return this.#getQueue(guild).resume();
|
|
@@ -2368,6 +2421,7 @@ ${e.message}`;
|
|
|
2368
2421
|
/**
|
|
2369
2422
|
* Stop the guild stream
|
|
2370
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.
|
|
2371
2425
|
*/
|
|
2372
2426
|
stop(guild) {
|
|
2373
2427
|
return this.#getQueue(guild).stop();
|
|
@@ -2377,6 +2431,7 @@ ${e.message}`;
|
|
|
2377
2431
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2378
2432
|
* @param percent - The percentage of volume you want to set
|
|
2379
2433
|
* @returns The guild queue
|
|
2434
|
+
* @deprecated Use `distube.getQueue(guild).setVolume(percent)` instead. Will be removed in v6.0.
|
|
2380
2435
|
*/
|
|
2381
2436
|
setVolume(guild, percent) {
|
|
2382
2437
|
return this.#getQueue(guild).setVolume(percent);
|
|
@@ -2387,6 +2442,7 @@ ${e.message}`;
|
|
|
2387
2442
|
* play a related song.</info>
|
|
2388
2443
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2389
2444
|
* @returns The new Song will be played
|
|
2445
|
+
* @deprecated Use `distube.getQueue(guild).skip(options)` instead. Will be removed in v6.0.
|
|
2390
2446
|
*/
|
|
2391
2447
|
skip(guild, options) {
|
|
2392
2448
|
return this.#getQueue(guild).skip(options);
|
|
@@ -2395,6 +2451,7 @@ ${e.message}`;
|
|
|
2395
2451
|
* Play the previous song
|
|
2396
2452
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2397
2453
|
* @returns The new Song will be played
|
|
2454
|
+
* @deprecated Use `distube.getQueue(guild).previous()` instead. Will be removed in v6.0.
|
|
2398
2455
|
*/
|
|
2399
2456
|
previous(guild) {
|
|
2400
2457
|
return this.#getQueue(guild).previous();
|
|
@@ -2403,6 +2460,7 @@ ${e.message}`;
|
|
|
2403
2460
|
* Shuffle the guild queue songs
|
|
2404
2461
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2405
2462
|
* @returns The guild queue
|
|
2463
|
+
* @deprecated Use `distube.getQueue(guild).shuffle()` instead. Will be removed in v6.0.
|
|
2406
2464
|
*/
|
|
2407
2465
|
shuffle(guild) {
|
|
2408
2466
|
return this.#getQueue(guild).shuffle();
|
|
@@ -2413,6 +2471,7 @@ ${e.message}`;
|
|
|
2413
2471
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2414
2472
|
* @param num - The song number to play
|
|
2415
2473
|
* @returns The new Song will be played
|
|
2474
|
+
* @deprecated Use `distube.getQueue(guild).jump(num, options)` instead. Will be removed in v6.0.
|
|
2416
2475
|
*/
|
|
2417
2476
|
jump(guild, num, options) {
|
|
2418
2477
|
return this.#getQueue(guild).jump(num, options);
|
|
@@ -2423,6 +2482,7 @@ ${e.message}`;
|
|
|
2423
2482
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2424
2483
|
* @param mode - The repeat modes (toggle if `undefined`)
|
|
2425
2484
|
* @returns The new repeat mode
|
|
2485
|
+
* @deprecated Use `distube.getQueue(guild).setRepeatMode(mode)` instead. Will be removed in v6.0.
|
|
2426
2486
|
*/
|
|
2427
2487
|
setRepeatMode(guild, mode) {
|
|
2428
2488
|
return this.#getQueue(guild).setRepeatMode(mode);
|
|
@@ -2431,6 +2491,7 @@ ${e.message}`;
|
|
|
2431
2491
|
* Toggle autoplay mode
|
|
2432
2492
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2433
2493
|
* @returns Autoplay mode state
|
|
2494
|
+
* @deprecated Use `distube.getQueue(guild).toggleAutoplay()` instead. Will be removed in v6.0.
|
|
2434
2495
|
*/
|
|
2435
2496
|
toggleAutoplay(guild) {
|
|
2436
2497
|
const queue = this.#getQueue(guild);
|
|
@@ -2441,6 +2502,7 @@ ${e.message}`;
|
|
|
2441
2502
|
* Add related song to the queue
|
|
2442
2503
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2443
2504
|
* @returns The guild queue
|
|
2505
|
+
* @deprecated Use `distube.getQueue(guild).addRelatedSong()` instead. Will be removed in v6.0.
|
|
2444
2506
|
*/
|
|
2445
2507
|
addRelatedSong(guild) {
|
|
2446
2508
|
return this.#getQueue(guild).addRelatedSong();
|
|
@@ -2450,6 +2512,7 @@ ${e.message}`;
|
|
|
2450
2512
|
* @param guild - The type can be resolved to give a {@link Queue}
|
|
2451
2513
|
* @param time - Time in seconds
|
|
2452
2514
|
* @returns Seeked queue
|
|
2515
|
+
* @deprecated Use `distube.getQueue(guild).seek(time)` instead. Will be removed in v6.0.
|
|
2453
2516
|
*/
|
|
2454
2517
|
seek(guild, time) {
|
|
2455
2518
|
return this.#getQueue(guild).seek(time);
|
|
@@ -2494,7 +2557,7 @@ var ExtractorPlugin = class extends Plugin {
|
|
|
2494
2557
|
type = "extractor" /* EXTRACTOR */;
|
|
2495
2558
|
};
|
|
2496
2559
|
|
|
2497
|
-
// src/struct/
|
|
2560
|
+
// src/struct/InfoExtractorPlugin.ts
|
|
2498
2561
|
var InfoExtractorPlugin = class extends Plugin {
|
|
2499
2562
|
static {
|
|
2500
2563
|
__name(this, "InfoExtractorPlugin");
|
|
@@ -2502,7 +2565,7 @@ var InfoExtractorPlugin = class extends Plugin {
|
|
|
2502
2565
|
type = "info-extractor" /* INFO_EXTRACTOR */;
|
|
2503
2566
|
};
|
|
2504
2567
|
|
|
2505
|
-
// src/struct/
|
|
2568
|
+
// src/struct/PlayableExtractorPlugin.ts
|
|
2506
2569
|
var PlayableExtractorPlugin = class extends Plugin {
|
|
2507
2570
|
static {
|
|
2508
2571
|
__name(this, "PlayableExtractorPlugin");
|
|
@@ -2511,7 +2574,10 @@ var PlayableExtractorPlugin = class extends Plugin {
|
|
|
2511
2574
|
};
|
|
2512
2575
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2513
2576
|
0 && (module.exports = {
|
|
2577
|
+
AUDIO_CHANNELS,
|
|
2578
|
+
AUDIO_SAMPLE_RATE,
|
|
2514
2579
|
BaseManager,
|
|
2580
|
+
DEFAULT_VOLUME,
|
|
2515
2581
|
DisTube,
|
|
2516
2582
|
DisTubeBase,
|
|
2517
2583
|
DisTubeError,
|
|
@@ -2523,14 +2589,21 @@ var PlayableExtractorPlugin = class extends Plugin {
|
|
|
2523
2589
|
ExtractorPlugin,
|
|
2524
2590
|
FilterManager,
|
|
2525
2591
|
GuildIdManager,
|
|
2592
|
+
HTTP_REDIRECT_CODES,
|
|
2526
2593
|
InfoExtractorPlugin,
|
|
2594
|
+
InfoExtratorPlugin,
|
|
2595
|
+
JOIN_TIMEOUT_MS,
|
|
2596
|
+
MAX_REDIRECT_DEPTH,
|
|
2527
2597
|
Options,
|
|
2528
2598
|
PlayableExtractorPlugin,
|
|
2599
|
+
PlayableExtratorPlugin,
|
|
2529
2600
|
Playlist,
|
|
2530
2601
|
Plugin,
|
|
2531
2602
|
PluginType,
|
|
2532
2603
|
Queue,
|
|
2533
2604
|
QueueManager,
|
|
2605
|
+
RECONNECT_MAX_ATTEMPTS,
|
|
2606
|
+
RECONNECT_TIMEOUT_MS,
|
|
2534
2607
|
RepeatMode,
|
|
2535
2608
|
Song,
|
|
2536
2609
|
TaskQueue,
|