watch destroyed if queue is not destroyed
This commit is contained in:
parent
f61953d42a
commit
f395fcff9e
1 changed files with 4 additions and 1 deletions
|
@ -534,6 +534,7 @@ class Queue<T = unknown> {
|
||||||
const currentTimecode = Util.buildTimeCode(Util.parseMS(currentStreamTime));
|
const currentTimecode = Util.buildTimeCode(Util.parseMS(currentStreamTime));
|
||||||
const endTimecode = Util.buildTimeCode(Util.parseMS(totalTime));
|
const endTimecode = Util.buildTimeCode(Util.parseMS(totalTime));
|
||||||
|
|
||||||
|
// why
|
||||||
return {
|
return {
|
||||||
current: currentTimecode,
|
current: currentTimecode,
|
||||||
end: endTimecode,
|
end: endTimecode,
|
||||||
|
@ -593,12 +594,14 @@ class Queue<T = unknown> {
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async play(src?: Track, options: PlayOptions = {}): Promise<void> {
|
async play(src?: Track, options: PlayOptions = {}): Promise<void> {
|
||||||
this.#watchDestroyed();
|
if (!this.destroyed) this.#watchDestroyed();
|
||||||
if (!this.connection || !this.connection.voiceConnection) throw new Error("Voice connection is not available, use <Queue>.connect()!");
|
if (!this.connection || !this.connection.voiceConnection) throw new Error("Voice connection is not available, use <Queue>.connect()!");
|
||||||
if (src && (this.playing || this.tracks.length) && !options.immediate) return this.addTrack(src);
|
if (src && (this.playing || this.tracks.length) && !options.immediate) return this.addTrack(src);
|
||||||
const track = options.filtersUpdate && !options.immediate ? src || this.current : src ?? this.tracks.shift();
|
const track = options.filtersUpdate && !options.immediate ? src || this.current : src ?? this.tracks.shift();
|
||||||
if (!track) return;
|
if (!track) return;
|
||||||
|
|
||||||
|
this.player.emit("debug", this, "Received play request");
|
||||||
|
|
||||||
if (!options.filtersUpdate) {
|
if (!options.filtersUpdate) {
|
||||||
this.previousTracks = this.previousTracks.filter((x) => x.id !== track.id);
|
this.previousTracks = this.previousTracks.filter((x) => x.id !== track.id);
|
||||||
this.previousTracks.push(track);
|
this.previousTracks.push(track);
|
||||||
|
|
Loading…
Reference in a new issue