magmastream 2.9.3-dev.11 → 2.9.3-dev.13

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.ts CHANGED
@@ -337,6 +337,10 @@ declare class JsonQueue implements IQueue {
337
337
  * The base path for the queue files.
338
338
  */
339
339
  private basePath;
340
+ /**
341
+ * Whether the queue has been destroyed.
342
+ */
343
+ private destroyed;
340
344
  /**
341
345
  * @param guildId The guild ID.
342
346
  * @param manager The manager.
@@ -363,6 +367,11 @@ declare class JsonQueue implements IQueue {
363
367
  * Removes the first track from the queue.
364
368
  */
365
369
  dequeue(): Promise<Track | undefined>;
370
+ /**
371
+ * Destroys the queue and releases all resources.
372
+ * After calling this method, the queue must not be used again.
373
+ */
374
+ destroy(): Promise<void>;
366
375
  /**
367
376
  * @returns The total duration of the queue.
368
377
  */
@@ -502,6 +511,10 @@ declare class MemoryQueue extends Array<Track> implements IQueue {
502
511
  manager: Manager;
503
512
  /** The guild ID property. */
504
513
  guildId: string;
514
+ /**
515
+ * Whether the queue has been destroyed.
516
+ */
517
+ private destroyed;
505
518
  /**
506
519
  * Constructs a new Queue.
507
520
  * @param guildId The guild ID.
@@ -513,67 +526,72 @@ declare class MemoryQueue extends Array<Track> implements IQueue {
513
526
  * @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
514
527
  * @param [offset=null] The position to add the track(s) at. If not provided, the track(s) will be added at the end of the queue.
515
528
  */
516
- add(track: Track | Track[], offset?: number): Promise<void>;
529
+ add(track: Track | Track[], offset?: number): void;
517
530
  /**
518
531
  * Adds a track to the previous tracks.
519
532
  * @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
520
533
  */
521
- addPrevious(track: Track | Track[]): Promise<void>;
534
+ addPrevious(track: Track | Track[]): void;
522
535
  /**
523
536
  * Clears the queue.
524
537
  * This will remove all tracks from the queue and emit a state update event.
525
538
  */
526
- clear(): Promise<void>;
539
+ clear(): void;
527
540
  /**
528
541
  * Clears the previous tracks.
529
542
  */
530
- clearPrevious(): Promise<void>;
543
+ clearPrevious(): void;
531
544
  /**
532
545
  * Removes the first element from the queue.
533
546
  */
534
- dequeue(): Promise<Track | undefined>;
547
+ dequeue(): Track | undefined;
548
+ /**
549
+ * Destroys the queue and releases all resources.
550
+ * After calling this method, the queue must not be used again.
551
+ */
552
+ destroy(): void;
535
553
  /**
536
554
  * The total duration of the queue in milliseconds.
537
555
  * This includes the duration of the currently playing track.
538
556
  */
539
- duration(): Promise<number>;
557
+ duration(): number;
540
558
  /**
541
559
  * Adds the specified track or tracks to the front of the queue.
542
560
  * @param track The track or tracks to add.
543
561
  */
544
- enqueueFront(track: Track | Track[]): Promise<void>;
562
+ enqueueFront(track: Track | Track[]): void;
545
563
  /**
546
564
  * @returns Whether all elements in the queue satisfy the provided testing function.
547
565
  */
548
- everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
566
+ everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): boolean;
549
567
  /**
550
568
  * @returns A new array with all elements that pass the test implemented by the provided function.
551
569
  */
552
- filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
570
+ filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Track[];
553
571
  /**
554
572
  * @returns The first element in the queue that satisfies the provided testing function.
555
573
  */
556
- findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
574
+ findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Track | undefined;
557
575
  /**
558
576
  * @returns The current track.
559
577
  */
560
- getCurrent(): Promise<Track | null>;
578
+ getCurrent(): Track | null;
561
579
  /**
562
580
  * @returns The previous tracks.
563
581
  */
564
- getPrevious(): Promise<Track[]>;
582
+ getPrevious(): Track[];
565
583
  /**
566
584
  * @returns The tracks in the queue from start to end.
567
585
  */
568
- getSlice(start?: number, end?: number): Promise<Track[]>;
586
+ getSlice(start?: number, end?: number): Track[];
569
587
  /**
570
588
  * @returns The tracks in the queue.
571
589
  */
572
- getTracks(): Promise<Track[]>;
590
+ getTracks(): Track[];
573
591
  /**
574
592
  * @returns A new array with the results of calling a provided function on every element in the queue.
575
593
  */
576
- mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
594
+ mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): T[];
577
595
  /**
578
596
  * Modifies the queue at the specified index.
579
597
  * @param start The index at which to start modifying the queue.
@@ -581,11 +599,11 @@ declare class MemoryQueue extends Array<Track> implements IQueue {
581
599
  * @param items The elements to add to the queue.
582
600
  * @returns The modified queue.
583
601
  */
584
- modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
602
+ modifyAt(start: number, deleteCount?: number, ...items: Track[]): Track[];
585
603
  /**
586
604
  * @returns The newest track.
587
605
  */
588
- popPrevious(): Promise<Track | null>;
606
+ popPrevious(): Track | null;
589
607
  /**
590
608
  * Removes track(s) from the queue.
591
609
  * @param startOrPosition If a single number is provided, it will be treated as the position of the track to remove.
@@ -593,45 +611,45 @@ declare class MemoryQueue extends Array<Track> implements IQueue {
593
611
  * @param end Optional, end of the range of tracks to remove.
594
612
  * @returns The removed track(s).
595
613
  */
596
- remove(position?: number): Promise<Track[]>;
597
- remove(start: number, end: number): Promise<Track[]>;
614
+ remove(position?: number): Track[];
615
+ remove(start: number, end: number): Track[];
598
616
  /**
599
617
  * Shuffles the queue to play tracks requested by each user one by one.
600
618
  */
601
- roundRobinShuffle(): Promise<void>;
619
+ roundRobinShuffle(): void;
602
620
  /**
603
621
  * @param track The track to set.
604
622
  */
605
- setCurrent(track: Track | null): Promise<void>;
623
+ setCurrent(track: Track | null): void;
606
624
  /**
607
625
  * @param tracks The tracks to set.
608
626
  */
609
- setPrevious(tracks: Track[]): Promise<void>;
627
+ setPrevious(tracks: Track[]): void;
610
628
  /**
611
629
  * Shuffles the queue.
612
630
  * This will randomize the order of the tracks in the queue and emit a state update event.
613
631
  */
614
- shuffle(): Promise<void>;
632
+ shuffle(): void;
615
633
  /**
616
634
  * The size of tracks in the queue.
617
635
  * This does not include the currently playing track.
618
636
  * @returns The size of tracks in the queue.
619
637
  */
620
- size(): Promise<number>;
638
+ size(): number;
621
639
  /**
622
640
  * @returns Whether at least one element in the queue satisfies the provided testing function.
623
641
  */
624
- someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
642
+ someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): boolean;
625
643
  /**
626
644
  * The total size of tracks in the queue including the current track.
627
645
  * This includes the current track if it is not null.
628
646
  * @returns The total size of tracks in the queue including the current track.
629
647
  */
630
- totalSize(): Promise<number>;
648
+ totalSize(): number;
631
649
  /**
632
650
  * Shuffles the queue to play tracks requested by each user one block at a time.
633
651
  */
634
- userBlockShuffle(): Promise<void>;
652
+ userBlockShuffle(): void;
635
653
  }
636
654
 
637
655
  /**
@@ -648,6 +666,10 @@ declare class RedisQueue implements IQueue {
648
666
  * The Redis instance.
649
667
  */
650
668
  private redis;
669
+ /**
670
+ * Whether the queue has been destroyed.
671
+ */
672
+ private destroyed;
651
673
  /**
652
674
  * Constructs a new RedisQueue.
653
675
  * @param guildId The guild ID.
@@ -677,6 +699,11 @@ declare class RedisQueue implements IQueue {
677
699
  * Removes the first track from the queue.
678
700
  */
679
701
  dequeue(): Promise<Track | undefined>;
702
+ /**
703
+ * Destroys the queue and releases all resources.
704
+ * After calling this method, the queue must not be used again.
705
+ */
706
+ destroy(): Promise<void>;
680
707
  /**
681
708
  * @returns The total duration of the queue in milliseconds.
682
709
  * This includes the duration of the currently playing track.
@@ -1951,33 +1978,34 @@ interface ReverbOptions {
1951
1978
  * Queue interface
1952
1979
  */
1953
1980
  interface IQueue {
1954
- getCurrent(): Promise<Track | null>;
1955
- setCurrent(track: Track | null): Promise<void>;
1956
- getPrevious(): Promise<Track[]>;
1957
- addPrevious(track: Track | Track[]): Promise<void>;
1958
- setPrevious(track: Track | Track[]): Promise<void>;
1981
+ getCurrent(): Track | Promise<Track | null>;
1982
+ setCurrent(track: Track | null): void | Promise<void>;
1983
+ getPrevious(): Track[] | Promise<Track[]>;
1984
+ addPrevious(track: Track | Track[]): void | Promise<void>;
1985
+ setPrevious(track: Track | Track[]): void | Promise<void>;
1959
1986
  /** Get newest track (index 0) */
1960
- popPrevious(): Promise<Track | null>;
1961
- clearPrevious(): Promise<void>;
1962
- size(): Promise<number>;
1963
- totalSize(): Promise<number>;
1964
- duration(): Promise<number>;
1965
- add(track: Track | Track[], offset?: number): Promise<void>;
1966
- remove(start?: number, end?: number): Promise<Track[]>;
1967
- clear(): Promise<void>;
1968
- dequeue(): Promise<Track | undefined>;
1969
- enqueueFront(track: Track | Track[]): Promise<void>;
1970
- getTracks(): Promise<Track[]>;
1971
- getSlice(start?: number, end?: number): Promise<Track[]>;
1972
- modifyAt(start: number, deleteCount?: number, ...items: Track[]): Promise<Track[]>;
1973
- shuffle(): Promise<void>;
1974
- userBlockShuffle(): Promise<void>;
1975
- roundRobinShuffle(): Promise<void>;
1976
- mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): Promise<T[]>;
1977
- filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track[]>;
1978
- findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<Track | undefined>;
1979
- someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
1980
- everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Promise<boolean>;
1987
+ popPrevious(): Track | Promise<Track | null>;
1988
+ clearPrevious(): void | Promise<void>;
1989
+ size(): number | Promise<number>;
1990
+ totalSize(): number | Promise<number>;
1991
+ duration(): number | Promise<number>;
1992
+ add(track: Track | Track[], offset?: number): void | Promise<void>;
1993
+ remove(start?: number, end?: number): Track[] | Promise<Track[]>;
1994
+ clear(): void | Promise<void>;
1995
+ dequeue(): Track | Promise<Track | undefined>;
1996
+ enqueueFront(track: Track | Track[]): void | Promise<void>;
1997
+ getTracks(): Track[] | Promise<Track[]>;
1998
+ getSlice(start?: number, end?: number): Track[] | Promise<Track[]>;
1999
+ modifyAt(start: number, deleteCount?: number, ...items: Track[]): Track[] | Promise<Track[]>;
2000
+ shuffle(): void | Promise<void>;
2001
+ userBlockShuffle(): void | Promise<void>;
2002
+ roundRobinShuffle(): void | Promise<void>;
2003
+ mapAsync<T>(callback: (track: Track, index: number, array: Track[]) => T): T[] | Promise<T[]>;
2004
+ filterAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Track[] | Promise<Track[]>;
2005
+ findAsync(callback: (track: Track, index: number, array: Track[]) => boolean): Track | Promise<Track | undefined>;
2006
+ someAsync(callback: (track: Track, index: number, array: Track[]) => boolean): boolean | Promise<boolean>;
2007
+ everyAsync(callback: (track: Track, index: number, array: Track[]) => boolean): boolean | Promise<boolean>;
2008
+ destroy(): void | Promise<void>;
1981
2009
  }
1982
2010
  /**
1983
2011
  * Sizes Enum type
@@ -17,6 +17,10 @@ class JsonQueue {
17
17
  * The base path for the queue files.
18
18
  */
19
19
  basePath;
20
+ /**
21
+ * Whether the queue has been destroyed.
22
+ */
23
+ destroyed = false;
20
24
  /**
21
25
  * @param guildId The guild ID.
22
26
  * @param manager The manager.
@@ -172,6 +176,27 @@ class JsonQueue {
172
176
  console.error(error);
173
177
  }
174
178
  }
179
+ /**
180
+ * Destroys the queue and releases all resources.
181
+ * After calling this method, the queue must not be used again.
182
+ */
183
+ async destroy() {
184
+ if (this.destroyed)
185
+ return;
186
+ this.destroyed = true;
187
+ try {
188
+ await Promise.all([this.deleteFile(this.queuePath), this.deleteFile(this.currentPath), this.deleteFile(this.previousPath)]);
189
+ }
190
+ catch (err) {
191
+ console.error(err instanceof MagmastreamError_1.MagmaStreamError
192
+ ? err
193
+ : new MagmastreamError_1.MagmaStreamError({
194
+ code: Enums_1.MagmaStreamErrorCode.QUEUE_JSON_ERROR,
195
+ message: `Failed to destroy JSONQueue for guild ${this.guildId}`,
196
+ cause: err,
197
+ }));
198
+ }
199
+ }
175
200
  /**
176
201
  * @returns The total duration of the queue.
177
202
  */
@@ -16,6 +16,10 @@ class MemoryQueue extends Array {
16
16
  manager;
17
17
  /** The guild ID property. */
18
18
  guildId;
19
+ /**
20
+ * Whether the queue has been destroyed.
21
+ */
22
+ destroyed = false;
19
23
  /**
20
24
  * Constructs a new Queue.
21
25
  * @param guildId The guild ID.
@@ -34,7 +38,7 @@ class MemoryQueue extends Array {
34
38
  * @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
35
39
  * @param [offset=null] The position to add the track(s) at. If not provided, the track(s) will be added at the end of the queue.
36
40
  */
37
- async add(track, offset) {
41
+ add(track, offset) {
38
42
  try {
39
43
  const isArray = Array.isArray(track);
40
44
  const tracks = isArray ? [...track] : [track];
@@ -122,7 +126,7 @@ class MemoryQueue extends Array {
122
126
  * Adds a track to the previous tracks.
123
127
  * @param track The track or tracks to add. Can be a single `Track` or an array of `Track`s.
124
128
  */
125
- async addPrevious(track) {
129
+ addPrevious(track) {
126
130
  try {
127
131
  const max = this.manager.options.maxPreviousTracks;
128
132
  if (Array.isArray(track)) {
@@ -154,7 +158,7 @@ class MemoryQueue extends Array {
154
158
  * Clears the queue.
155
159
  * This will remove all tracks from the queue and emit a state update event.
156
160
  */
157
- async clear() {
161
+ clear() {
158
162
  try {
159
163
  // Capture the current state of the player for event emission.
160
164
  const oldPlayer = this.manager.players.get(this.guildId) ? { ...this.manager.players.get(this.guildId) } : null;
@@ -186,20 +190,32 @@ class MemoryQueue extends Array {
186
190
  /**
187
191
  * Clears the previous tracks.
188
192
  */
189
- async clearPrevious() {
193
+ clearPrevious() {
190
194
  this.previous = [];
191
195
  }
192
196
  /**
193
197
  * Removes the first element from the queue.
194
198
  */
195
- async dequeue() {
199
+ dequeue() {
196
200
  return super.shift();
197
201
  }
202
+ /**
203
+ * Destroys the queue and releases all resources.
204
+ * After calling this method, the queue must not be used again.
205
+ */
206
+ destroy() {
207
+ if (this.destroyed)
208
+ return;
209
+ this.destroyed = true;
210
+ this.splice(0);
211
+ this.previous.length = 0;
212
+ this.current = null;
213
+ }
198
214
  /**
199
215
  * The total duration of the queue in milliseconds.
200
216
  * This includes the duration of the currently playing track.
201
217
  */
202
- async duration() {
218
+ duration() {
203
219
  const current = this.current?.duration ?? 0;
204
220
  return this.reduce((acc, cur) => acc + (cur.duration || 0), current);
205
221
  }
@@ -207,7 +223,7 @@ class MemoryQueue extends Array {
207
223
  * Adds the specified track or tracks to the front of the queue.
208
224
  * @param track The track or tracks to add.
209
225
  */
210
- async enqueueFront(track) {
226
+ enqueueFront(track) {
211
227
  if (Array.isArray(track)) {
212
228
  this.unshift(...track);
213
229
  }
@@ -218,49 +234,49 @@ class MemoryQueue extends Array {
218
234
  /**
219
235
  * @returns Whether all elements in the queue satisfy the provided testing function.
220
236
  */
221
- async everyAsync(callback) {
237
+ everyAsync(callback) {
222
238
  return this.every(callback);
223
239
  }
224
240
  /**
225
241
  * @returns A new array with all elements that pass the test implemented by the provided function.
226
242
  */
227
- async filterAsync(callback) {
243
+ filterAsync(callback) {
228
244
  return this.filter(callback);
229
245
  }
230
246
  /**
231
247
  * @returns The first element in the queue that satisfies the provided testing function.
232
248
  */
233
- async findAsync(callback) {
249
+ findAsync(callback) {
234
250
  return this.find(callback);
235
251
  }
236
252
  /**
237
253
  * @returns The current track.
238
254
  */
239
- async getCurrent() {
255
+ getCurrent() {
240
256
  return this.current;
241
257
  }
242
258
  /**
243
259
  * @returns The previous tracks.
244
260
  */
245
- async getPrevious() {
261
+ getPrevious() {
246
262
  return [...this.previous];
247
263
  }
248
264
  /**
249
265
  * @returns The tracks in the queue from start to end.
250
266
  */
251
- async getSlice(start, end) {
267
+ getSlice(start, end) {
252
268
  return this.slice(start, end); // Native sync method, still wrapped in a Promise
253
269
  }
254
270
  /**
255
271
  * @returns The tracks in the queue.
256
272
  */
257
- async getTracks() {
273
+ getTracks() {
258
274
  return [...this]; // clone to avoid direct mutation
259
275
  }
260
276
  /**
261
277
  * @returns A new array with the results of calling a provided function on every element in the queue.
262
278
  */
263
- async mapAsync(callback) {
279
+ mapAsync(callback) {
264
280
  return this.map(callback);
265
281
  }
266
282
  /**
@@ -270,16 +286,16 @@ class MemoryQueue extends Array {
270
286
  * @param items The elements to add to the queue.
271
287
  * @returns The modified queue.
272
288
  */
273
- async modifyAt(start, deleteCount = 0, ...items) {
289
+ modifyAt(start, deleteCount = 0, ...items) {
274
290
  return super.splice(start, deleteCount, ...items);
275
291
  }
276
292
  /**
277
293
  * @returns The newest track.
278
294
  */
279
- async popPrevious() {
295
+ popPrevious() {
280
296
  return this.previous.pop() || null; // get newest track
281
297
  }
282
- async remove(startOrPosition = 0, end) {
298
+ remove(startOrPosition = 0, end) {
283
299
  try {
284
300
  const oldPlayer = this.manager.players.get(this.guildId) ? { ...this.manager.players.get(this.guildId) } : null;
285
301
  if (typeof end !== "undefined") {
@@ -331,7 +347,7 @@ class MemoryQueue extends Array {
331
347
  /**
332
348
  * Shuffles the queue to play tracks requested by each user one by one.
333
349
  */
334
- async roundRobinShuffle() {
350
+ roundRobinShuffle() {
335
351
  try {
336
352
  // Capture the current state of the player for event emission.
337
353
  const oldPlayer = this.manager.players.get(this.guildId) ? { ...this.manager.players.get(this.guildId) } : null;
@@ -394,20 +410,20 @@ class MemoryQueue extends Array {
394
410
  /**
395
411
  * @param track The track to set.
396
412
  */
397
- async setCurrent(track) {
413
+ setCurrent(track) {
398
414
  this.current = track;
399
415
  }
400
416
  /**
401
417
  * @param tracks The tracks to set.
402
418
  */
403
- async setPrevious(tracks) {
419
+ setPrevious(tracks) {
404
420
  this.previous = [...tracks];
405
421
  }
406
422
  /**
407
423
  * Shuffles the queue.
408
424
  * This will randomize the order of the tracks in the queue and emit a state update event.
409
425
  */
410
- async shuffle() {
426
+ shuffle() {
411
427
  try {
412
428
  // Capture the current state of the player for event emission.
413
429
  const oldPlayer = this.manager.players.get(this.guildId) ? { ...this.manager.players.get(this.guildId) } : null;
@@ -443,13 +459,13 @@ class MemoryQueue extends Array {
443
459
  * This does not include the currently playing track.
444
460
  * @returns The size of tracks in the queue.
445
461
  */
446
- async size() {
462
+ size() {
447
463
  return this.length;
448
464
  }
449
465
  /**
450
466
  * @returns Whether at least one element in the queue satisfies the provided testing function.
451
467
  */
452
- async someAsync(callback) {
468
+ someAsync(callback) {
453
469
  return this.some(callback);
454
470
  }
455
471
  /**
@@ -457,13 +473,13 @@ class MemoryQueue extends Array {
457
473
  * This includes the current track if it is not null.
458
474
  * @returns The total size of tracks in the queue including the current track.
459
475
  */
460
- async totalSize() {
476
+ totalSize() {
461
477
  return this.length + (this.current ? 1 : 0);
462
478
  }
463
479
  /**
464
480
  * Shuffles the queue to play tracks requested by each user one block at a time.
465
481
  */
466
- async userBlockShuffle() {
482
+ userBlockShuffle() {
467
483
  try {
468
484
  // Capture the current state of the player for event emission.
469
485
  const oldPlayer = this.manager.players.get(this.guildId) ? { ...this.manager.players.get(this.guildId) } : null;
@@ -18,6 +18,10 @@ class RedisQueue {
18
18
  * The Redis instance.
19
19
  */
20
20
  redis;
21
+ /**
22
+ * Whether the queue has been destroyed.
23
+ */
24
+ destroyed = false;
21
25
  /**
22
26
  * Constructs a new RedisQueue.
23
27
  * @param guildId The guild ID.
@@ -222,6 +226,28 @@ class RedisQueue {
222
226
  console.error(error);
223
227
  }
224
228
  }
229
+ /**
230
+ * Destroys the queue and releases all resources.
231
+ * After calling this method, the queue must not be used again.
232
+ */
233
+ async destroy() {
234
+ if (this.destroyed)
235
+ return;
236
+ this.destroyed = true;
237
+ try {
238
+ await this.redis.del(this.queueKey, this.previousKey, this.currentKey);
239
+ }
240
+ catch (err) {
241
+ const error = err instanceof MagmastreamError_1.MagmaStreamError
242
+ ? err
243
+ : new MagmastreamError_1.MagmaStreamError({
244
+ code: Enums_1.MagmaStreamErrorCode.QUEUE_REDIS_ERROR,
245
+ message: `Failed to destroy RedisQueue for guild ${this.guildId}: ${err.message}`,
246
+ cause: err,
247
+ });
248
+ console.error(error);
249
+ }
250
+ }
225
251
  /**
226
252
  * @returns The total duration of the queue in milliseconds.
227
253
  * This includes the duration of the currently playing track.
@@ -273,13 +273,11 @@ class Player {
273
273
  this.voiceReceiverWsClient.close();
274
274
  this.voiceReceiverWsClient = null;
275
275
  }
276
- await this.queue.clear();
277
- await this.queue.clearPrevious();
278
- await this.queue.setCurrent(null);
279
276
  if (disconnect) {
280
277
  await this.disconnect().catch(() => { });
281
278
  }
282
279
  await this.node.rest.destroyPlayer(this.guildId).catch(() => { });
280
+ await this.queue.destroy();
283
281
  this.nowPlayingMessage = undefined;
284
282
  this.manager.emit(Enums_1.ManagerEventTypes.PlayerDestroy, this);
285
283
  const deleted = this.manager.players.delete(this.guildId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magmastream",
3
- "version": "2.9.3-dev.11",
3
+ "version": "2.9.3-dev.13",
4
4
  "description": "A user-friendly Lavalink client designed for NodeJS.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "lint": "eslint \"src/**/*.{ts,js}\"",
16
16
  "lint:fix": "eslint --fix \"src/**/*.{ts,js}\"",
17
17
  "ci": "run-s format:check lint build types",
18
- "release:dev": "npm run format && npm run lint:fix && npm run ci && npm version prerelease --preid=dev && npm publish --tag dev"
18
+ "release:dev": "npm run format && npm run lint:fix && npm run ci && npm version prerelease --preid=dev && git push && npm publish --tag dev"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@favware/rollup-type-bundler": "^4.0.0",