magmastream 2.8.6-dev.1 → 2.8.6-dev.2
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 +3 -3
- package/dist/structures/Manager.js +1 -1
- package/dist/structures/Player.js +3 -18
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -932,7 +932,7 @@ declare class Manager extends EventEmitter {
|
|
|
932
932
|
* @param requester
|
|
933
933
|
* @returns The search result.
|
|
934
934
|
*/
|
|
935
|
-
search<T
|
|
935
|
+
search<T = unknown>(query: string | SearchQuery, requester?: T): Promise<SearchResult>;
|
|
936
936
|
/**
|
|
937
937
|
* Creates a player or returns one if it already exists.
|
|
938
938
|
* @param options The options to create the player with.
|
|
@@ -1445,7 +1445,7 @@ declare class Player {
|
|
|
1445
1445
|
* @param query
|
|
1446
1446
|
* @param requester
|
|
1447
1447
|
*/
|
|
1448
|
-
search<T
|
|
1448
|
+
search<T = unknown>(query: string | SearchQuery, requester?: T): Promise<SearchResult>;
|
|
1449
1449
|
/**
|
|
1450
1450
|
* Connects the player to the voice channel.
|
|
1451
1451
|
* @throws {RangeError} If no voice channel has been set.
|
|
@@ -1518,7 +1518,7 @@ declare class Player {
|
|
|
1518
1518
|
* recommended track if the first one doesn't work.
|
|
1519
1519
|
* @returns {this} - The player instance.
|
|
1520
1520
|
*/
|
|
1521
|
-
setAutoplay(autoplayState: boolean, botUser?:
|
|
1521
|
+
setAutoplay<T = unknown>(autoplayState: boolean, botUser?: T, tries?: number): this;
|
|
1522
1522
|
/**
|
|
1523
1523
|
* Gets recommended tracks and returns an array of tracks.
|
|
1524
1524
|
* @param {Track} track - The track to find recommendations for.
|
|
@@ -167,7 +167,7 @@ class Manager extends events_1.EventEmitter {
|
|
|
167
167
|
playlist = {
|
|
168
168
|
name: playlistData.info.name,
|
|
169
169
|
playlistInfo: playlistData.pluginInfo,
|
|
170
|
-
requester,
|
|
170
|
+
requester: requester,
|
|
171
171
|
tracks,
|
|
172
172
|
duration: tracks.reduce((acc, cur) => acc + (cur.duration || 0), 0),
|
|
173
173
|
};
|
|
@@ -708,35 +708,20 @@ class Player {
|
|
|
708
708
|
* @throws {RangeError} If the amount is greater than the queue length.
|
|
709
709
|
*/
|
|
710
710
|
async stop(amount) {
|
|
711
|
-
const oldPlayer =
|
|
711
|
+
const oldPlayer = { ...this };
|
|
712
712
|
let removedTracks = [];
|
|
713
|
-
// If an amount is provided, remove that many tracks from the queue.
|
|
714
713
|
if (typeof amount === "number" && amount > 1) {
|
|
715
|
-
if (amount > this.queue.length)
|
|
714
|
+
if (amount > this.queue.length)
|
|
716
715
|
throw new RangeError("Cannot skip more than the queue length.");
|
|
717
|
-
}
|
|
718
716
|
removedTracks = this.queue.slice(0, amount - 1);
|
|
719
717
|
this.queue.splice(0, amount - 1);
|
|
720
718
|
}
|
|
721
|
-
|
|
722
|
-
// If no amount is provided, remove the current track if it exists.
|
|
723
|
-
if (this.queue.current) {
|
|
724
|
-
removedTracks.push(this.queue.current);
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
// Stop the player and send an event to the manager.
|
|
728
|
-
await this.node.rest.updatePlayer({
|
|
719
|
+
this.node.rest.updatePlayer({
|
|
729
720
|
guildId: this.guildId,
|
|
730
721
|
data: {
|
|
731
722
|
encodedTrack: null,
|
|
732
723
|
},
|
|
733
724
|
});
|
|
734
|
-
if (this.queue.length) {
|
|
735
|
-
this.queue.current = this.queue.shift();
|
|
736
|
-
// If autoplay is enabled, play the next track
|
|
737
|
-
if (this.manager.options.autoPlay)
|
|
738
|
-
await this.play();
|
|
739
|
-
}
|
|
740
725
|
this.manager.emit(Manager_1.ManagerEventTypes.PlayerStateUpdate, oldPlayer, this, {
|
|
741
726
|
changeType: Manager_1.PlayerStateEventTypes.QueueChange,
|
|
742
727
|
details: {
|