lavalink-client 2.1.4 → 2.1.6
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/cjs/structures/Filters.d.ts +360 -360
- package/dist/cjs/structures/Filters.js +899 -899
- package/dist/cjs/structures/Player.d.ts +2 -2
- package/dist/cjs/structures/Player.js +12 -6
- package/dist/esm/structures/Filters.d.ts +360 -360
- package/dist/esm/structures/Filters.js +895 -895
- package/dist/esm/structures/Player.d.ts +2 -2
- package/dist/esm/structures/Player.js +12 -6
- package/dist/types/structures/Filters.d.ts +360 -360
- package/dist/types/structures/Player.d.ts +2 -2
- package/package.json +2 -2
|
@@ -84,7 +84,7 @@ export interface LavalinkPlayOptions extends BasePlayOptions {
|
|
|
84
84
|
export interface PlayOptions extends LavalinkPlayOptions {
|
|
85
85
|
/** Whether to not replace the track if a play payload is sent. */
|
|
86
86
|
noReplace?: boolean;
|
|
87
|
-
/**
|
|
87
|
+
/** Adds track on queue and skips to it */
|
|
88
88
|
clientTrack?: Track | UnresolvedTrack;
|
|
89
89
|
}
|
|
90
90
|
export interface Player {
|
|
@@ -195,7 +195,7 @@ export declare class Player {
|
|
|
195
195
|
* Skip the current song, or a specific amount of songs
|
|
196
196
|
* @param amount provide the index of the next track to skip to
|
|
197
197
|
*/
|
|
198
|
-
skip(skipTo?: number, throwError?: boolean):
|
|
198
|
+
skip(skipTo?: number, throwError?: boolean): any;
|
|
199
199
|
/**
|
|
200
200
|
* Clears the queue and stops playing. Does not destroy the Player and not leave the channel
|
|
201
201
|
* @returns
|
|
@@ -124,6 +124,7 @@ export class Player {
|
|
|
124
124
|
clearTimeout(this.get("internal_queueempty"));
|
|
125
125
|
this.set("internal_queueempty", undefined);
|
|
126
126
|
}
|
|
127
|
+
let replaced = false;
|
|
127
128
|
// if clientTrack provided, play it
|
|
128
129
|
if (options?.clientTrack && (this.LavalinkManager.utils.isTrack(options?.clientTrack) || this.LavalinkManager.utils.isUnresolvedTrack(options.clientTrack))) {
|
|
129
130
|
if (this.LavalinkManager.utils.isUnresolvedTrack(options.clientTrack))
|
|
@@ -131,16 +132,18 @@ export class Player {
|
|
|
131
132
|
if (typeof options.track.userData === "object")
|
|
132
133
|
options.clientTrack.userData = { ...(options?.clientTrack.userData || {}), ...(options.track.userData || {}) };
|
|
133
134
|
await this.queue.add(options?.clientTrack, 0);
|
|
134
|
-
await
|
|
135
|
+
return await this.skip();
|
|
135
136
|
}
|
|
136
137
|
else if (options?.track?.encoded) {
|
|
137
138
|
// handle play encoded options manually // TODO let it resolve by lavalink!
|
|
138
139
|
const track = await this.node.decode.singleTrack(options.track?.encoded, options.track?.requester || this.queue?.current?.requester || this.queue.previous?.[0]?.requester || this.queue.tracks?.[0]?.requester || this.LavalinkManager.options.client);
|
|
139
140
|
if (typeof options.track.userData === "object")
|
|
140
141
|
track.userData = { ...(track.userData || {}), ...(options.track.userData || {}) };
|
|
141
|
-
if (track)
|
|
142
|
+
if (track) {
|
|
143
|
+
replaced = true;
|
|
142
144
|
this.queue.add(track, 0);
|
|
143
|
-
|
|
145
|
+
await queueTrackEnd(this);
|
|
146
|
+
}
|
|
144
147
|
}
|
|
145
148
|
else if (options?.track?.identifier) {
|
|
146
149
|
// handle play identifier options manually // TODO let it resolve by lavalink!
|
|
@@ -149,9 +152,11 @@ export class Player {
|
|
|
149
152
|
}, options?.track?.identifier || this.queue?.current?.requester || this.queue.previous?.[0]?.requester || this.queue.tracks?.[0]?.requester || this.LavalinkManager.options.client);
|
|
150
153
|
if (typeof options.track.userData === "object")
|
|
151
154
|
res.tracks[0].userData = { ...(res.tracks[0].userData || {}), ...(options.track.userData || {}) };
|
|
152
|
-
if (res.tracks[0])
|
|
155
|
+
if (res.tracks[0]) {
|
|
156
|
+
replaced = true;
|
|
153
157
|
this.queue.add(res.tracks[0], 0);
|
|
154
|
-
|
|
158
|
+
await queueTrackEnd(this);
|
|
159
|
+
}
|
|
155
160
|
}
|
|
156
161
|
if (!this.queue.current && this.queue.tracks.length)
|
|
157
162
|
await queueTrackEnd(this);
|
|
@@ -208,7 +213,7 @@ export class Player {
|
|
|
208
213
|
const now = performance.now();
|
|
209
214
|
await this.node.updatePlayer({
|
|
210
215
|
guildId: this.guildId,
|
|
211
|
-
noReplace: options?.noReplace ?? false,
|
|
216
|
+
noReplace: replaced ? replaced : (options?.noReplace ?? false),
|
|
212
217
|
playerOptions: finalOptions,
|
|
213
218
|
});
|
|
214
219
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
@@ -464,6 +469,7 @@ export class Player {
|
|
|
464
469
|
paused: data.paused,
|
|
465
470
|
filters: { ...data.filters, equalizer: data.equalizer },
|
|
466
471
|
voice: this.voice,
|
|
472
|
+
track: this.queue.current ?? undefined
|
|
467
473
|
// track: this.queue.current,
|
|
468
474
|
},
|
|
469
475
|
});
|