distube 5.0.4 → 5.0.5
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 +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +35 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +19 -20
package/dist/index.mjs
CHANGED
|
@@ -501,6 +501,7 @@ var DisTubeVoice = class extends TypedEmitter {
|
|
|
501
501
|
emittedError;
|
|
502
502
|
isDisconnected = false;
|
|
503
503
|
stream;
|
|
504
|
+
pausingStream;
|
|
504
505
|
#channel;
|
|
505
506
|
#volume = 100;
|
|
506
507
|
constructor(voiceManager, channel) {
|
|
@@ -634,11 +635,15 @@ var DisTubeVoice = class extends TypedEmitter {
|
|
|
634
635
|
this.emittedError = true;
|
|
635
636
|
this.emit("error", error);
|
|
636
637
|
});
|
|
637
|
-
if (this.audioPlayer.state.status !== AudioPlayerStatus.Paused)
|
|
638
|
-
|
|
638
|
+
if (this.audioPlayer.state.status !== AudioPlayerStatus.Paused) {
|
|
639
|
+
this.audioPlayer.play(dtStream.audioResource);
|
|
640
|
+
this.stream?.kill();
|
|
641
|
+
dtStream.spawn();
|
|
642
|
+
} else if (!this.pausingStream) {
|
|
643
|
+
this.pausingStream = this.stream;
|
|
644
|
+
}
|
|
639
645
|
this.stream = dtStream;
|
|
640
646
|
this.volume = this.#volume;
|
|
641
|
-
dtStream.spawn();
|
|
642
647
|
}
|
|
643
648
|
set volume(volume) {
|
|
644
649
|
if (typeof volume !== "number" || isNaN(volume)) {
|
|
@@ -670,6 +675,9 @@ var DisTubeVoice = class extends TypedEmitter {
|
|
|
670
675
|
if (state.status !== AudioPlayerStatus.Paused) return;
|
|
671
676
|
if (this.stream?.audioResource && state.resource !== this.stream.audioResource) {
|
|
672
677
|
this.audioPlayer.play(this.stream.audioResource);
|
|
678
|
+
this.stream.spawn();
|
|
679
|
+
this.pausingStream?.kill();
|
|
680
|
+
delete this.pausingStream;
|
|
673
681
|
} else {
|
|
674
682
|
this.audioPlayer.unpause();
|
|
675
683
|
}
|
|
@@ -1629,21 +1637,31 @@ var Queue = class extends DisTubeBase {
|
|
|
1629
1637
|
* Pause the guild stream
|
|
1630
1638
|
* @returns The guild queue
|
|
1631
1639
|
*/
|
|
1632
|
-
pause() {
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1640
|
+
async pause() {
|
|
1641
|
+
await this._taskQueue.queuing();
|
|
1642
|
+
try {
|
|
1643
|
+
if (this.paused) throw new DisTubeError("PAUSED");
|
|
1644
|
+
this.paused = true;
|
|
1645
|
+
this.voice.pause();
|
|
1646
|
+
return this;
|
|
1647
|
+
} finally {
|
|
1648
|
+
this._taskQueue.resolve();
|
|
1649
|
+
}
|
|
1637
1650
|
}
|
|
1638
1651
|
/**
|
|
1639
1652
|
* Resume the guild stream
|
|
1640
1653
|
* @returns The guild queue
|
|
1641
1654
|
*/
|
|
1642
|
-
resume() {
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1655
|
+
async resume() {
|
|
1656
|
+
await this._taskQueue.queuing();
|
|
1657
|
+
try {
|
|
1658
|
+
if (!this.paused) throw new DisTubeError("RESUMED");
|
|
1659
|
+
this.paused = false;
|
|
1660
|
+
this.voice.unpause();
|
|
1661
|
+
return this;
|
|
1662
|
+
} finally {
|
|
1663
|
+
this._taskQueue.resolve();
|
|
1664
|
+
}
|
|
1647
1665
|
}
|
|
1648
1666
|
/**
|
|
1649
1667
|
* Set the guild stream's volume
|
|
@@ -2405,7 +2423,7 @@ ${e.message}`;
|
|
|
2405
2423
|
};
|
|
2406
2424
|
|
|
2407
2425
|
// src/index.ts
|
|
2408
|
-
var version = "5.0.
|
|
2426
|
+
var version = "5.0.5";
|
|
2409
2427
|
export {
|
|
2410
2428
|
BaseManager,
|
|
2411
2429
|
DisTube,
|