lavalink-client 2.2.0 → 2.2.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.
Files changed (42) hide show
  1. package/README.md +116 -15
  2. package/dist/cjs/structures/Filters.d.ts +1 -1
  3. package/dist/cjs/structures/Filters.js +9 -9
  4. package/dist/cjs/structures/LavalinkManager.d.ts +24 -7
  5. package/dist/cjs/structures/LavalinkManager.js +15 -2
  6. package/dist/cjs/structures/LavalinkManagerStatics.d.ts +3 -0
  7. package/dist/cjs/structures/LavalinkManagerStatics.js +4 -1
  8. package/dist/cjs/structures/Node.d.ts +307 -22
  9. package/dist/cjs/structures/Node.js +328 -72
  10. package/dist/cjs/structures/NodeManager.js +3 -1
  11. package/dist/cjs/structures/Player.d.ts +44 -8
  12. package/dist/cjs/structures/Player.js +27 -18
  13. package/dist/cjs/structures/Queue.d.ts +47 -0
  14. package/dist/cjs/structures/Queue.js +104 -1
  15. package/dist/cjs/structures/Track.d.ts +1 -0
  16. package/dist/cjs/structures/Utils.d.ts +3 -0
  17. package/dist/cjs/structures/Utils.js +6 -4
  18. package/dist/esm/structures/Filters.d.ts +1 -1
  19. package/dist/esm/structures/Filters.js +9 -9
  20. package/dist/esm/structures/LavalinkManager.d.ts +24 -7
  21. package/dist/esm/structures/LavalinkManager.js +15 -2
  22. package/dist/esm/structures/LavalinkManagerStatics.d.ts +3 -0
  23. package/dist/esm/structures/LavalinkManagerStatics.js +4 -1
  24. package/dist/esm/structures/Node.d.ts +307 -22
  25. package/dist/esm/structures/Node.js +328 -72
  26. package/dist/esm/structures/NodeManager.js +3 -1
  27. package/dist/esm/structures/Player.d.ts +44 -8
  28. package/dist/esm/structures/Player.js +27 -18
  29. package/dist/esm/structures/Queue.d.ts +47 -0
  30. package/dist/esm/structures/Queue.js +104 -1
  31. package/dist/esm/structures/Track.d.ts +1 -0
  32. package/dist/esm/structures/Utils.d.ts +3 -0
  33. package/dist/esm/structures/Utils.js +6 -4
  34. package/dist/types/structures/Filters.d.ts +1 -1
  35. package/dist/types/structures/LavalinkManager.d.ts +24 -7
  36. package/dist/types/structures/LavalinkManagerStatics.d.ts +3 -0
  37. package/dist/types/structures/Node.d.ts +307 -22
  38. package/dist/types/structures/Player.d.ts +44 -8
  39. package/dist/types/structures/Queue.d.ts +47 -0
  40. package/dist/types/structures/Track.d.ts +1 -0
  41. package/dist/types/structures/Utils.d.ts +3 -0
  42. package/package.json +2 -3
@@ -11,7 +11,9 @@ class NodeManager extends stream_1.EventEmitter {
11
11
  super();
12
12
  this.LavalinkManager = LavalinkManager;
13
13
  if (this.LavalinkManager.options.nodes)
14
- this.LavalinkManager.options.nodes.forEach(node => this.createNode(node));
14
+ this.LavalinkManager.options.nodes.forEach(node => {
15
+ this.createNode(node);
16
+ });
15
17
  }
16
18
  /**
17
19
  * Disconnects all Nodes from lavalink ws sockets
@@ -4,28 +4,58 @@ import { LavalinkNode, SponsorBlockSegment } from "./Node";
4
4
  import { Queue } from "./Queue";
5
5
  import { Track, UnresolvedTrack } from "./Track";
6
6
  import { Base64, LavalinkPlayerVoiceOptions, LavaSearchQuery, SearchQuery } from "./Utils";
7
- type PlayerDestroyReasons = "QueueEmpty" | "NodeDestroy" | "NodeDeleted" | "LavalinkNoVoice" | "NodeReconnectFail" | "PlayerReconnectFail" | "Disconnected" | "ChannelDeleted" | "ReconnectAllNodes" | "DisconnectAllNodes";
8
- export type DestroyReasonsType = PlayerDestroyReasons | string;
9
- export declare const DestroyReasons: Record<PlayerDestroyReasons, PlayerDestroyReasons>;
7
+ export declare enum DestroyReasons {
8
+ QueueEmpty = "QueueEmpty",
9
+ NodeDestroy = "NodeDestroy",
10
+ NodeDeleted = "NodeDeleted",
11
+ LavalinkNoVoice = "LavalinkNoVoice",
12
+ NodeReconnectFail = "NodeReconnectFail",
13
+ Disconnected = "Disconnected",
14
+ PlayerReconnectFail = "PlayerReconnectFail",
15
+ ChannelDeleted = "ChannelDeleted",
16
+ DisconnectAllNodes = "DisconnectAllNodes",
17
+ ReconnectAllNodes = "ReconnectAllNodes"
18
+ }
19
+ export type DestroyReasonsType = keyof typeof DestroyReasons | string;
10
20
  export interface PlayerJson {
21
+ /** Guild Id where the player was playing in */
11
22
  guildId: string;
23
+ /** Options provided to the player */
12
24
  options: PlayerOptions;
25
+ /** Voice Channel Id the player was playing in */
13
26
  voiceChannelId: string;
27
+ /** Text Channel Id the player was synced to */
14
28
  textChannelId?: string;
29
+ /** Position the player was at */
15
30
  position: number;
31
+ /** Lavalink's position the player was at */
16
32
  lastPosition: number;
33
+ /** Last time the position was sent from lavalink */
34
+ lastPositionChange: number;
35
+ /** Volume in % from the player (without volumeDecrementer) */
17
36
  volume: number;
37
+ /** Real Volume used in lavalink (with the volumeDecrementer) */
18
38
  lavalinkVolume: number;
39
+ /** The repeatmode from the player */
19
40
  repeatMode: RepeatMode;
41
+ /** Pause state */
20
42
  paused: boolean;
43
+ /** Wether the player was playing or not */
21
44
  playing: boolean;
45
+ /** When the player was created */
22
46
  createdTimeStamp?: number;
47
+ /** All current used fitlers Data */
23
48
  filters: FilterData;
49
+ /** The player's ping object */
24
50
  ping: {
51
+ /** Ping to the voice websocket server */
25
52
  ws: number;
53
+ /** Avg. calc. Ping to the lavalink server */
26
54
  lavalink: number;
27
55
  };
56
+ /** Equalizer Bands used in lavalink */
28
57
  equalizer: EQBand[];
58
+ /** The Id of the last used node */
29
59
  nodeId?: string;
30
60
  }
31
61
  export type RepeatMode = "queue" | "track" | "off";
@@ -88,10 +118,15 @@ export interface PlayOptions extends LavalinkPlayOptions {
88
118
  clientTrack?: Track | UnresolvedTrack;
89
119
  }
90
120
  export interface Player {
121
+ /** Filter Manager per player */
91
122
  filterManager: FilterManager;
123
+ /** circular reference to the lavalink Manager from the Player for easier use */
92
124
  LavalinkManager: LavalinkManager;
125
+ /** Player options currently used, mutation doesn't affect player's state */
93
126
  options: PlayerOptions;
127
+ /** The lavalink node assigned the the player, don't change it manually */
94
128
  node: LavalinkNode;
129
+ /** The queue from the player */
95
130
  queue: Queue;
96
131
  }
97
132
  export declare class Player {
@@ -117,7 +152,9 @@ export declare class Player {
117
152
  /** The Volume Lavalink actually is outputting */
118
153
  lavalinkVolume: number;
119
154
  /** The current Positin of the player (Calculated) */
120
- position: number;
155
+ get position(): number;
156
+ /** The timestamp when the last position change update happened */
157
+ lastPositionChange: number;
121
158
  /** The current Positin of the player (from Lavalink) */
122
159
  lastPosition: number;
123
160
  /** When the player was created [Timestamp in Ms] (from lavalink) */
@@ -163,7 +200,7 @@ export declare class Player {
163
200
  * @param ignoreVolumeDecrementer If it should ignore the volumedecrementer option
164
201
  */
165
202
  setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<this>;
166
- lavaSearch(query: LavaSearchQuery, requestUser: unknown): Promise<import("./Utils").SearchResult | import("./Utils").LavaSearchResponse>;
203
+ lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Utils").SearchResult | import("./Utils").LavaSearchResponse>;
167
204
  setSponsorBlock(segments?: SponsorBlockSegment[]): Promise<void>;
168
205
  getSponsorBlock(): Promise<SponsorBlockSegment[]>;
169
206
  deleteSponsorBlock(): Promise<void>;
@@ -172,7 +209,7 @@ export declare class Player {
172
209
  * @param query Query for your data
173
210
  * @param requestUser
174
211
  */
175
- search(query: SearchQuery, requestUser: unknown): Promise<import("./Utils").SearchResult | import("./Utils").UnresolvedSearchResult>;
212
+ search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<import("./Utils").SearchResult | import("./Utils").UnresolvedSearchResult>;
176
213
  /**
177
214
  * Pause the player
178
215
  */
@@ -220,7 +257,7 @@ export declare class Player {
220
257
  /**
221
258
  * Destroy the player and disconnect from the voice channel
222
259
  */
223
- destroy(reason?: string, disconnect?: boolean): Promise<this>;
260
+ destroy(reason?: DestroyReasons | string, disconnect?: boolean): Promise<this>;
224
261
  /**
225
262
  * Move the player on a different Audio-Node
226
263
  * @param newNode New Node / New Node Id
@@ -229,4 +266,3 @@ export declare class Player {
229
266
  /** Converts the Player including Queue to a Json state */
230
267
  toJSON(): PlayerJson;
231
268
  }
232
- export {};
@@ -5,18 +5,20 @@ const BandCampSearch_1 = require("./CustomSearches/BandCampSearch");
5
5
  const Filters_1 = require("./Filters");
6
6
  const Queue_1 = require("./Queue");
7
7
  const Utils_1 = require("./Utils");
8
- exports.DestroyReasons = {
9
- QueueEmpty: "QueueEmpty",
10
- NodeDestroy: "NodeDestroy",
11
- NodeDeleted: "NodeDeleted",
12
- LavalinkNoVoice: "LavalinkNoVoice",
13
- NodeReconnectFail: "NodeReconnectFail",
14
- Disconnected: "Disconnected",
15
- PlayerReconnectFail: "PlayerReconnectFail",
16
- ChannelDeleted: "ChannelDeleted",
17
- DisconnectAllNodes: "DisconnectAllNodes",
18
- ReconnectAllNodes: "ReconnectAllNodes"
19
- };
8
+ var DestroyReasons;
9
+ (function (DestroyReasons) {
10
+ DestroyReasons["QueueEmpty"] = "QueueEmpty";
11
+ DestroyReasons["NodeDestroy"] = "NodeDestroy";
12
+ DestroyReasons["NodeDeleted"] = "NodeDeleted";
13
+ DestroyReasons["LavalinkNoVoice"] = "LavalinkNoVoice";
14
+ DestroyReasons["NodeReconnectFail"] = "NodeReconnectFail";
15
+ DestroyReasons["Disconnected"] = "Disconnected";
16
+ DestroyReasons["PlayerReconnectFail"] = "PlayerReconnectFail";
17
+ DestroyReasons["ChannelDeleted"] = "ChannelDeleted";
18
+ DestroyReasons["DisconnectAllNodes"] = "DisconnectAllNodes";
19
+ DestroyReasons["ReconnectAllNodes"] = "ReconnectAllNodes";
20
+ })(DestroyReasons || (exports.DestroyReasons = DestroyReasons = {}));
21
+ ;
20
22
  class Player {
21
23
  /** The Guild Id of the Player */
22
24
  guildId;
@@ -42,7 +44,11 @@ class Player {
42
44
  /** The Volume Lavalink actually is outputting */
43
45
  lavalinkVolume = 100;
44
46
  /** The current Positin of the player (Calculated) */
45
- position = 0;
47
+ get position() {
48
+ return this.lastPosition + (this.lastPositionChange ? Date.now() - this.lastPositionChange : 0);
49
+ }
50
+ /** The timestamp when the last position change update happened */
51
+ lastPositionChange = null;
46
52
  /** The current Positin of the player (from Lavalink) */
47
53
  lastPosition = 0;
48
54
  /** When the player was created [Timestamp in Ms] (from lavalink) */
@@ -245,8 +251,8 @@ class Player {
245
251
  this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
246
252
  return this;
247
253
  }
248
- async lavaSearch(query, requestUser) {
249
- return this.node.lavaSearch(query, requestUser);
254
+ async lavaSearch(query, requestUser, throwOnEmpty = false) {
255
+ return this.node.lavaSearch(query, requestUser, throwOnEmpty);
250
256
  }
251
257
  async setSponsorBlock(segments = ["sponsor", "selfpromo"]) {
252
258
  return this.node.setSponsorBlock(this, segments);
@@ -262,11 +268,11 @@ class Player {
262
268
  * @param query Query for your data
263
269
  * @param requestUser
264
270
  */
265
- async search(query, requestUser) {
271
+ async search(query, requestUser, throwOnEmpty = false) {
266
272
  const Query = this.LavalinkManager.utils.transformQuery(query);
267
273
  if (["bcsearch", "bandcamp"].includes(Query.source) && !this.node.info.sourceManagers.includes("bandcamp"))
268
274
  return await (0, BandCampSearch_1.bandCampSearch)(this, Query.query, requestUser);
269
- return this.node.search(Query, requestUser);
275
+ return this.node.search(Query, requestUser, throwOnEmpty);
270
276
  }
271
277
  /**
272
278
  * Pause the player
@@ -275,6 +281,7 @@ class Player {
275
281
  if (this.paused && !this.playing)
276
282
  throw new Error("Player is already paused - not able to pause.");
277
283
  this.paused = true;
284
+ this.lastPositionChange = null; // needs to removed to not cause issues
278
285
  const now = performance.now();
279
286
  await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { paused: true } });
280
287
  this.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
@@ -306,7 +313,7 @@ class Player {
306
313
  throw new RangeError("Current Track is not seekable / a stream");
307
314
  if (position < 0 || position > this.queue.current.info.duration)
308
315
  position = Math.max(Math.min(position, this.queue.current.info.duration), 0);
309
- this.position = position;
316
+ this.lastPositionChange = Date.now();
310
317
  this.lastPosition = position;
311
318
  const now = performance.now();
312
319
  await this.node.updatePlayer({ guildId: this.guildId, playerOptions: { position } });
@@ -488,6 +495,7 @@ class Player {
488
495
  textChannelId: this.textChannelId,
489
496
  position: this.position,
490
497
  lastPosition: this.lastPosition,
498
+ lastPositionChange: this.lastPositionChange,
491
499
  volume: this.volume,
492
500
  lavalinkVolume: this.lavalinkVolume,
493
501
  repeatMode: this.repeatMode,
@@ -498,6 +506,7 @@ class Player {
498
506
  equalizer: this.filterManager?.equalizerBands || [],
499
507
  nodeId: this.node?.id,
500
508
  ping: this.ping,
509
+ queue: this.queue.utils.toJSON(),
501
510
  };
502
511
  }
503
512
  }
@@ -113,4 +113,51 @@ export declare class Queue {
113
113
  * @returns {Track} Spliced Track
114
114
  */
115
115
  splice(index: number, amount: number, TrackOrTracks?: Track | UnresolvedTrack | (Track | UnresolvedTrack)[]): any;
116
+ /**
117
+ * Remove stuff from the queue.tracks array
118
+ * - single Track | UnresolvedTrack
119
+ * - multiple Track | UnresovedTrack
120
+ * - at the index or multiple indexes
121
+ * @param removeQueryTrack
122
+ * @returns null (if nothing was removed) / { removed } where removed is an array with all removed elements
123
+ *
124
+ * @example
125
+ * ```js
126
+ * // remove single track
127
+ *
128
+ * const track = player.queue.tracks[4];
129
+ * await player.queue.remove(track);
130
+ *
131
+ * // if you already have the index you can straight up pass it too
132
+ * await player.queue.remove(4);
133
+ *
134
+ *
135
+ * // if you want to remove multiple tracks, e.g. from position 4 to position 10 you can do smt like this
136
+ * await player.queue.remove(player.queue.tracks.slice(4, 10)) // get's the tracks from 4 - 10, which then get's found in the remove function to be removed
137
+ *
138
+ * // I still highly suggest to use .splice!
139
+ *
140
+ * await player.queue.splice(4, 10); // removes at index 4, 10 tracks
141
+ *
142
+ * await player.queue.splice(1, 1); // removes at index 1, 1 track
143
+ *
144
+ * await player.queue.splice(4, 0, ...tracks) // removes 0 tracks at position 4, and then inserts all tracks after position 4.
145
+ * ```
146
+ */
147
+ remove<T extends Track | UnresolvedTrack | number | Track[] | UnresolvedTrack[] | number[] | (number | Track | UnresolvedTrack)[]>(removeQueryTrack: T): Promise<{
148
+ removed: (Track | UnresolvedTrack)[];
149
+ } | null>;
150
+ /**
151
+ * Shifts the previous array, to return the last previous track & thus remove it from the previous queue
152
+ * @returns
153
+ *
154
+ * @example
155
+ * ```js
156
+ * // example on how to play the previous track again
157
+ * const previous = await player.queue.shiftPrevious(); // get the previous track and remove it from the previous queue array!!
158
+ * if(!previous) return console.error("No previous track found");
159
+ * await player.play({ clientTrack: previous }); // play it again
160
+ * ```
161
+ */
162
+ shiftPrevious(): Promise<Track>;
116
163
  }
@@ -123,7 +123,7 @@ class Queue {
123
123
  if (this.tracks.length <= 1)
124
124
  return this.tracks.length;
125
125
  // swap #1 and #2 if only 2 tracks.
126
- if (this.tracks.length == 2) {
126
+ if (this.tracks.length === 2) {
127
127
  [this.tracks[0], this.tracks[1]] = [this.tracks[1], this.tracks[0]];
128
128
  }
129
129
  else { // randomly swap places.
@@ -197,5 +197,108 @@ class Queue {
197
197
  // return the things
198
198
  return spliced.length === 1 ? spliced[0] : spliced;
199
199
  }
200
+ /**
201
+ * Remove stuff from the queue.tracks array
202
+ * - single Track | UnresolvedTrack
203
+ * - multiple Track | UnresovedTrack
204
+ * - at the index or multiple indexes
205
+ * @param removeQueryTrack
206
+ * @returns null (if nothing was removed) / { removed } where removed is an array with all removed elements
207
+ *
208
+ * @example
209
+ * ```js
210
+ * // remove single track
211
+ *
212
+ * const track = player.queue.tracks[4];
213
+ * await player.queue.remove(track);
214
+ *
215
+ * // if you already have the index you can straight up pass it too
216
+ * await player.queue.remove(4);
217
+ *
218
+ *
219
+ * // if you want to remove multiple tracks, e.g. from position 4 to position 10 you can do smt like this
220
+ * await player.queue.remove(player.queue.tracks.slice(4, 10)) // get's the tracks from 4 - 10, which then get's found in the remove function to be removed
221
+ *
222
+ * // I still highly suggest to use .splice!
223
+ *
224
+ * await player.queue.splice(4, 10); // removes at index 4, 10 tracks
225
+ *
226
+ * await player.queue.splice(1, 1); // removes at index 1, 1 track
227
+ *
228
+ * await player.queue.splice(4, 0, ...tracks) // removes 0 tracks at position 4, and then inserts all tracks after position 4.
229
+ * ```
230
+ */
231
+ async remove(removeQueryTrack) {
232
+ if (typeof removeQueryTrack === "number") {
233
+ const toRemove = this.tracks[removeQueryTrack];
234
+ if (!toRemove)
235
+ return null;
236
+ const removed = this.tracks.splice(removeQueryTrack, 1);
237
+ await this.utils.save();
238
+ console.log("0st", removed, toRemove);
239
+ return { removed };
240
+ }
241
+ if (Array.isArray(removeQueryTrack)) {
242
+ if (removeQueryTrack.every(v => typeof v === "number")) {
243
+ const removed = [];
244
+ for (const i of removeQueryTrack) {
245
+ if (this.tracks[i])
246
+ removed.push(...this.tracks.splice(i, 1));
247
+ }
248
+ console.log("1st", removed, removeQueryTrack);
249
+ if (!removed.length)
250
+ return null;
251
+ await this.utils.save();
252
+ return { removed };
253
+ }
254
+ const tracksToRemove = this.tracks.map((v, i) => ({ v, i })).filter(({ v, i }) => removeQueryTrack.find(t => typeof t === "number" && (t === i) ||
255
+ typeof t === "object" && (t.encoded && t.encoded === v.encoded ||
256
+ t.info?.identifier && t.info.identifier === v.info?.identifier ||
257
+ t.info?.uri && t.info.uri === v.info?.uri ||
258
+ t.info?.title && t.info.title === v.info?.title ||
259
+ t.info?.isrc && t.info.isrc === v.info?.isrc ||
260
+ t.info?.artworkUrl && t.info.artworkUrl === v.info?.artworkUrl)));
261
+ if (!tracksToRemove.length)
262
+ return null;
263
+ const removed = [];
264
+ for (const { i } of tracksToRemove) {
265
+ if (this.tracks[i])
266
+ removed.push(...this.tracks.splice(i, 1));
267
+ }
268
+ await this.utils.save();
269
+ console.log("2nd", removed, tracksToRemove);
270
+ return { removed };
271
+ }
272
+ const toRemove = this.tracks.findIndex((v) => removeQueryTrack.encoded && removeQueryTrack.encoded === v.encoded ||
273
+ removeQueryTrack.info?.identifier && removeQueryTrack.info.identifier === v.info?.identifier ||
274
+ removeQueryTrack.info?.uri && removeQueryTrack.info.uri === v.info?.uri ||
275
+ removeQueryTrack.info?.title && removeQueryTrack.info.title === v.info?.title ||
276
+ removeQueryTrack.info?.isrc && removeQueryTrack.info.isrc === v.info?.isrc ||
277
+ removeQueryTrack.info?.artworkUrl && removeQueryTrack.info.artworkUrl === v.info?.artworkUrl);
278
+ if (toRemove < 0)
279
+ return null;
280
+ const removed = this.tracks.splice(toRemove, 1);
281
+ await this.utils.save();
282
+ console.log("3rd", removed, toRemove);
283
+ return { removed };
284
+ }
285
+ /**
286
+ * Shifts the previous array, to return the last previous track & thus remove it from the previous queue
287
+ * @returns
288
+ *
289
+ * @example
290
+ * ```js
291
+ * // example on how to play the previous track again
292
+ * const previous = await player.queue.shiftPrevious(); // get the previous track and remove it from the previous queue array!!
293
+ * if(!previous) return console.error("No previous track found");
294
+ * await player.play({ clientTrack: previous }); // play it again
295
+ * ```
296
+ */
297
+ async shiftPrevious() {
298
+ const removed = this.previous.shift();
299
+ if (removed)
300
+ await this.utils.save();
301
+ return removed ?? null;
302
+ }
200
303
  }
201
304
  exports.Queue = Queue;
@@ -81,6 +81,7 @@ export interface PluginInfo {
81
81
  uri?: string;
82
82
  /** You can put specific track information here, to transform the tracks... */
83
83
  clientData?: {
84
+ previousTrack?: boolean;
84
85
  [key: string]: any;
85
86
  };
86
87
  }
@@ -105,6 +105,7 @@ export declare class ManagerUtils {
105
105
  validateQueryString(node: LavalinkNode, queryString: string, sourceString?: LavalinkSearchPlatform): void;
106
106
  transformQuery(query: SearchQuery): {
107
107
  query: string;
108
+ extraQueryUrlParams: URLSearchParams;
108
109
  source: any;
109
110
  };
110
111
  transformLavaSearchQuery(query: LavaSearchQuery): {
@@ -453,6 +454,8 @@ export interface LavaSearchResponse {
453
454
  export type SearchQuery = {
454
455
  /** lavalink search Query / identifier string */
455
456
  query: string;
457
+ /** Extra url query params to use, e.g. for flowertts */
458
+ extraQueryUrlParams?: URLSearchParams;
456
459
  /** Source to append to the search query string */
457
460
  source?: SearchPlatform;
458
461
  } | /** Our just the search query / identifier string */ string;
@@ -241,6 +241,7 @@ class ManagerUtils {
241
241
  const sourceOfQuery = typeof query === "string" ? undefined : (LavalinkManagerStatics_1.DefaultSources[(query.source?.trim?.()?.toLowerCase?.()) ?? this.LavalinkManager?.options?.playerOptions?.defaultSearchPlatform?.toLowerCase?.()] ?? (query.source?.trim?.()?.toLowerCase?.()));
242
242
  const Query = {
243
243
  query: typeof query === "string" ? query : query.query,
244
+ extraQueryUrlParams: typeof query !== "string" ? query.extraQueryUrlParams : undefined,
244
245
  source: sourceOfQuery ?? this.LavalinkManager?.options?.playerOptions?.defaultSearchPlatform?.toLowerCase?.()
245
246
  };
246
247
  const foundSource = Object.keys(LavalinkManagerStatics_1.DefaultSources).find(source => Query.query?.toLowerCase?.()?.startsWith(`${source}:`.toLowerCase()))?.trim?.()?.toLowerCase?.();
@@ -344,10 +345,11 @@ class MiniMap extends Map {
344
345
  }
345
346
  exports.MiniMap = MiniMap;
346
347
  async function queueTrackEnd(player) {
347
- if (player.queue.current) { // if there was a current Track -> Add it
348
+ if (player.queue.current && !player.queue.current?.pluginInfo?.clientData?.previousTrack) { // If there was a current Track already and repeatmode === true, add it to the queue.
348
349
  player.queue.previous.unshift(player.queue.current);
349
350
  if (player.queue.previous.length > player.queue.options.maxPreviousTracks)
350
351
  player.queue.previous.splice(player.queue.options.maxPreviousTracks, player.queue.previous.length);
352
+ await player.queue.utils.save();
351
353
  }
352
354
  // and if repeatMode == queue, add it back to the queue!
353
355
  if (player.repeatMode === "queue" && player.queue.current)
@@ -377,11 +379,11 @@ async function applyUnresolvedData(resTrack, data, utils) {
377
379
  resTrack.info.author = data.info.author;
378
380
  }
379
381
  else { // only overwrite if undefined / invalid
380
- if ((resTrack.info.title == 'Unknown title' || resTrack.info.title == "Unspecified description") && resTrack.info.title != data.info.title)
382
+ if ((resTrack.info.title === 'Unknown title' || resTrack.info.title === "Unspecified description") && resTrack.info.title != data.info.title)
381
383
  resTrack.info.title = data.info.title;
382
- if (resTrack.info.author != data.info.author)
384
+ if (resTrack.info.author !== data.info.author)
383
385
  resTrack.info.author = data.info.author;
384
- if (resTrack.info.artworkUrl != data.info.artworkUrl)
386
+ if (resTrack.info.artworkUrl !== data.info.artworkUrl)
385
387
  resTrack.info.artworkUrl = data.info.artworkUrl;
386
388
  }
387
389
  for (const key of Object.keys(data.info))
@@ -7,7 +7,7 @@ export declare class FilterManager {
7
7
  /** The Equalizer bands currently applied to the Lavalink Server */
8
8
  equalizerBands: EQBand[];
9
9
  /** Private Util for the instaFix Filters option */
10
- filterUpdatedState: number;
10
+ filterUpdatedState: boolean;
11
11
  /** All "Active" / "disabled" Player Filters */
12
12
  filters: PlayerFilters;
13
13
  /** The Filter Data sent to Lavalink, only if the filter is enabled (ofc.) */
@@ -5,7 +5,7 @@ export class FilterManager {
5
5
  /** The Equalizer bands currently applied to the Lavalink Server */
6
6
  equalizerBands = [];
7
7
  /** Private Util for the instaFix Filters option */
8
- filterUpdatedState = 0;
8
+ filterUpdatedState = false;
9
9
  /** All "Active" / "disabled" Player Filters */
10
10
  filters = {
11
11
  volume: false,
@@ -75,9 +75,9 @@ export class FilterManager {
75
75
  // "cutoffFrequency": 284, // Integer, higher than zero, in Hz.
76
76
  // "boostFactor": 1.24389 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
77
77
  },
78
- "normalization": { // Attenuates peaking where peaks are defined as having a higher value than {maxAmplitude}.
78
+ "normalization": { // Attenuates peaking where peaks are defined as having a higher value than {maxAmplitude}.
79
79
  // "maxAmplitude": 0.6327, // Float, within the range of 0.0 - 1.0. A value of 0.0 mutes the output.
80
- // "adaptive": true // false
80
+ // "adaptive": true // false
81
81
  },
82
82
  "echo": { // Self-explanatory; provides an echo effect.
83
83
  // "echoLength": 0.5649, // Float, higher than 0.0, in seconds (1.0 = 1 second).
@@ -157,6 +157,8 @@ export class FilterManager {
157
157
  delete sendData[key];
158
158
  }
159
159
  const now = performance.now();
160
+ if (this.player.options.instaUpdateFiltersFix === true)
161
+ this.filterUpdatedState = true;
160
162
  await this.player.node.updatePlayer({
161
163
  guildId: this.player.guildId,
162
164
  playerOptions: {
@@ -164,8 +166,6 @@ export class FilterManager {
164
166
  }
165
167
  });
166
168
  this.player.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
167
- if (this.player.options.instaUpdateFiltersFix === true)
168
- this.filterUpdatedState = 1;
169
169
  return;
170
170
  }
171
171
  /**
@@ -250,9 +250,9 @@ export class FilterManager {
250
250
  // "cutoffFrequency": 284, // Integer, higher than zero, in Hz.
251
251
  // "boostFactor": 1.24389 // Float, higher than 0.0. This alters volume output. A value of 1.0 means no volume change.
252
252
  },
253
- "normalization": { // Attenuates peaking where peaks are defined as having a higher value than {maxAmplitude}.
253
+ "normalization": { // Attenuates peaking where peaks are defined as having a higher value than {maxAmplitude}.
254
254
  // "maxAmplitude": 0.6327, // Float, within the range of 0.0 - 1.0. A value of 0.0 mutes the output.
255
- // "adaptive": true // false
255
+ // "adaptive": true // false
256
256
  },
257
257
  "echo": { // Self-explanatory; provides an echo effect.
258
258
  // "echoLength": 0.5649, // Float, higher than 0.0, in seconds (1.0 = 1 second).
@@ -651,6 +651,8 @@ export class FilterManager {
651
651
  if (!this.player.node.sessionId)
652
652
  throw new Error("The Lavalink-Node is either not ready or not up to date");
653
653
  const now = performance.now();
654
+ if (this.player.options.instaUpdateFiltersFix === true)
655
+ this.filterUpdatedState = true;
654
656
  await this.player.node.updatePlayer({
655
657
  guildId: this.player.guildId,
656
658
  playerOptions: {
@@ -658,8 +660,6 @@ export class FilterManager {
658
660
  }
659
661
  });
660
662
  this.player.ping.lavalink = Math.round((performance.now() - now) / 10) / 100;
661
- if (this.player.options.instaUpdateFiltersFix === true)
662
- this.filterUpdatedState = 1;
663
663
  return this;
664
664
  }
665
665
  /** Clears the equalizer bands. */