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
|
|
@@ -127,6 +127,7 @@ class Player {
|
|
|
127
127
|
clearTimeout(this.get("internal_queueempty"));
|
|
128
128
|
this.set("internal_queueempty", undefined);
|
|
129
129
|
}
|
|
130
|
+
let replaced = false;
|
|
130
131
|
// if clientTrack provided, play it
|
|
131
132
|
if (options?.clientTrack && (this.LavalinkManager.utils.isTrack(options?.clientTrack) || this.LavalinkManager.utils.isUnresolvedTrack(options.clientTrack))) {
|
|
132
133
|
if (this.LavalinkManager.utils.isUnresolvedTrack(options.clientTrack))
|
|
@@ -134,16 +135,18 @@ class Player {
|
|
|
134
135
|
if (typeof options.track.userData === "object")
|
|
135
136
|
options.clientTrack.userData = { ...(options?.clientTrack.userData || {}), ...(options.track.userData || {}) };
|
|
136
137
|
await this.queue.add(options?.clientTrack, 0);
|
|
137
|
-
await
|
|
138
|
+
return await this.skip();
|
|
138
139
|
}
|
|
139
140
|
else if (options?.track?.encoded) {
|
|
140
141
|
// handle play encoded options manually // TODO let it resolve by lavalink!
|
|
141
142
|
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);
|
|
142
143
|
if (typeof options.track.userData === "object")
|
|
143
144
|
track.userData = { ...(track.userData || {}), ...(options.track.userData || {}) };
|
|
144
|
-
if (track)
|
|
145
|
+
if (track) {
|
|
146
|
+
replaced = true;
|
|
145
147
|
this.queue.add(track, 0);
|
|
146
|
-
|
|
148
|
+
await (0, Utils_1.queueTrackEnd)(this);
|
|
149
|
+
}
|
|
147
150
|
}
|
|
148
151
|
else if (options?.track?.identifier) {
|
|
149
152
|
// handle play identifier options manually // TODO let it resolve by lavalink!
|
|
@@ -152,9 +155,11 @@ class Player {
|
|
|
152
155
|
}, options?.track?.identifier || this.queue?.current?.requester || this.queue.previous?.[0]?.requester || this.queue.tracks?.[0]?.requester || this.LavalinkManager.options.client);
|
|
153
156
|
if (typeof options.track.userData === "object")
|
|
154
157
|
res.tracks[0].userData = { ...(res.tracks[0].userData || {}), ...(options.track.userData || {}) };
|
|
155
|
-
if (res.tracks[0])
|
|
158
|
+
if (res.tracks[0]) {
|
|
159
|
+
replaced = true;
|
|
156
160
|
this.queue.add(res.tracks[0], 0);
|
|
157
|
-
|
|
161
|
+
await (0, Utils_1.queueTrackEnd)(this);
|
|
162
|
+
}
|
|
158
163
|
}
|
|
159
164
|
if (!this.queue.current && this.queue.tracks.length)
|
|
160
165
|
await (0, Utils_1.queueTrackEnd)(this);
|
|
@@ -211,7 +216,7 @@ class Player {
|
|
|
211
216
|
const now = performance.now();
|
|
212
217
|
await this.node.updatePlayer({
|
|
213
218
|
guildId: this.guildId,
|
|
214
|
-
noReplace: options?.noReplace ?? false,
|
|
219
|
+
noReplace: replaced ? replaced : (options?.noReplace ?? false),
|
|
215
220
|
playerOptions: finalOptions,
|
|
216
221
|
});
|
|
217
222
|
this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
|
|
@@ -467,6 +472,7 @@ class Player {
|
|
|
467
472
|
paused: data.paused,
|
|
468
473
|
filters: { ...data.filters, equalizer: data.equalizer },
|
|
469
474
|
voice: this.voice,
|
|
475
|
+
track: this.queue.current ?? undefined
|
|
470
476
|
// track: this.queue.current,
|
|
471
477
|
},
|
|
472
478
|
});
|