lavalink-client 2.4.3 → 2.4.4

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/README.md CHANGED
@@ -790,10 +790,21 @@ if(previousTrack) {
790
790
 
791
791
  - Added the new events and configuration to the docs
792
792
 
793
+ ## **Version 2.4.1**
794
+
795
+ - Did some cleanup and comment removal + removed the playerVoiceEmptyStart because it would mean i'd need to add voice-state tracking, which wasn't the plan of doing by the client.
796
+
797
+ ## **Verison 2.4.2**
798
+
799
+ - Merged [PR#78](https://github.com/Tomato6966/lavalink-client/pull/78) from @hwangsihu - Added the configs to eslint ignore
800
+ - Merged [PR#80](https://github.com/Tomato6966/lavalink-client/pull/80) from @EvilG-MC - Argument Typo fix in resume event type declaration
801
+ - Merged [PR#83](https://github.com/Tomato6966/lavalink-client/pull/83) from @EvilG-MC - Fix if statement in Node#syncPlayerData() to allow syncing of "single entry objects"
802
+ - Some minor improvements by removing unnecessary spreading
803
+
793
804
  ## **Version 2.4.3**
794
805
  - `managerOptions#playerOptions.onDisconnect.autoReconnect`:
795
806
  - Added the option `managerOptions#playerOptions.onDisconnect.autoReconnectOnlyWithTracks` to control wether to try reconnecting only when there are tracks in the queue / current track or not
796
807
  - Added a new debug log for that
797
808
  - Added the try to play the next track if there is no current track
798
- - *There was a problem trying to auto-reconnect on "empty-queue" events, which caused the player to get destroyed by that and log the error in console "`There is no Track in the Queue, nor provided in the PlayOptions`"*
799
- - *Now you have to handle that case manually if you want to or set autoReconnectOnlyWithTracks to false (default)*
809
+ - *There was a problem trying to auto-reconnect on-Disconnect while the queue was empty, which caused the player to get destroyed by that and log the error in console "`There is no Track in the Queue, nor provided in the PlayOptions`"*
810
+ - *Now you have to handle that case manually if you want to or set autoReconnectOnlyWithTracks to false (default)*
@@ -142,12 +142,11 @@ class LavalinkNode {
142
142
  const url = new URL(`${this.restAddress}${options.path}`);
143
143
  url.searchParams.append("trace", "true");
144
144
  const urlToUse = this.getRequestingUrl(url, options?.extraQueryUrlParams);
145
- const originalOptions = structuredClone(options);
146
- delete options.path;
147
- delete options.extraQueryUrlParams;
148
- const response = await fetch(urlToUse, options);
145
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
146
+ const { path, extraQueryUrlParams, ...fetchOptions } = options; // destructure fetch only options
147
+ const response = await fetch(urlToUse, fetchOptions);
149
148
  this.calls++;
150
- return { response, options: originalOptions };
149
+ return { response, options: options };
151
150
  }
152
151
  async request(endpoint, modify, parseAsText) {
153
152
  if (!this.connected)
@@ -1425,7 +1424,7 @@ class LavalinkNode {
1425
1424
  }
1426
1425
  }
1427
1426
  player.set("internal_skipped", false);
1428
- player.set("internal_autoplayStopPlaying", Date.now());
1427
+ player.set("internal_autoplayStopPlaying", undefined);
1429
1428
  if (track && !track?.pluginInfo?.clientData?.previousTrack) { // If there was a current Track already and repeatmode === true, add it to the queue.
1430
1429
  player.queue.previous.unshift(track);
1431
1430
  if (player.queue.previous.length > player.queue.options.maxPreviousTracks)
@@ -217,7 +217,7 @@ class Queue {
217
217
  try {
218
218
  this.queueChanges.tracksAdd(this.guildId, (Array.isArray(TrackOrTracks) ? TrackOrTracks : [TrackOrTracks]).filter(v => this.managerUtils.isTrack(v) || this.managerUtils.isUnresolvedTrack(v)), this.tracks.length, oldStored, this.utils.toJSON());
219
219
  }
220
- catch (e) { /* */ }
220
+ catch { /* */ }
221
221
  // save the queue
222
222
  await this.utils.save();
223
223
  // return the amount of the tracks
@@ -243,7 +243,7 @@ class Queue {
243
243
  try {
244
244
  this.queueChanges.tracksAdd(this.guildId, (Array.isArray(TrackOrTracks) ? TrackOrTracks : [TrackOrTracks]).filter(v => this.managerUtils.isTrack(v) || this.managerUtils.isUnresolvedTrack(v)), index, oldStored, this.utils.toJSON());
245
245
  }
246
- catch (e) { /* */ }
246
+ catch { /* */ }
247
247
  // remove the tracks (and add the new ones)
248
248
  let spliced = TrackOrTracks ? this.tracks.splice(index, amount, ...(Array.isArray(TrackOrTracks) ? TrackOrTracks : [TrackOrTracks]).filter(v => this.managerUtils.isTrack(v) || this.managerUtils.isUnresolvedTrack(v))) : this.tracks.splice(index, amount);
249
249
  // get the spliced array
@@ -253,7 +253,7 @@ class Queue {
253
253
  try {
254
254
  this.queueChanges.tracksRemoved(this.guildId, spliced, index, oldStored, this.utils.toJSON());
255
255
  }
256
- catch (e) { /* */ }
256
+ catch { /* */ }
257
257
  // save the queue
258
258
  await this.utils.save();
259
259
  // return the things
@@ -302,7 +302,7 @@ class Queue {
302
302
  try {
303
303
  this.queueChanges.tracksRemoved(this.guildId, removed, removeQueryTrack, oldStored, this.utils.toJSON());
304
304
  }
305
- catch (e) { /* */ }
305
+ catch { /* */ }
306
306
  await this.utils.save();
307
307
  return { removed };
308
308
  }
@@ -321,7 +321,7 @@ class Queue {
321
321
  try {
322
322
  this.queueChanges.tracksRemoved(this.guildId, removed, removeQueryTrack, oldStored, this.utils.toJSON());
323
323
  }
324
- catch (e) { /* */ }
324
+ catch { /* */ }
325
325
  await this.utils.save();
326
326
  return { removed };
327
327
  }
@@ -345,7 +345,7 @@ class Queue {
345
345
  try {
346
346
  this.queueChanges.tracksRemoved(this.guildId, removed, tracksToRemove.map(v => v.i), oldStored, this.utils.toJSON());
347
347
  }
348
- catch (e) { /* */ }
348
+ catch { /* */ }
349
349
  await this.utils.save();
350
350
  return { removed };
351
351
  }
@@ -363,7 +363,7 @@ class Queue {
363
363
  try {
364
364
  this.queueChanges.tracksRemoved(this.guildId, removed, toRemove, oldStored, this.utils.toJSON());
365
365
  }
366
- catch (e) { /* */ }
366
+ catch { /* */ }
367
367
  await this.utils.save();
368
368
  return { removed };
369
369
  }
@@ -138,12 +138,11 @@ export class LavalinkNode {
138
138
  const url = new URL(`${this.restAddress}${options.path}`);
139
139
  url.searchParams.append("trace", "true");
140
140
  const urlToUse = this.getRequestingUrl(url, options?.extraQueryUrlParams);
141
- const originalOptions = structuredClone(options);
142
- delete options.path;
143
- delete options.extraQueryUrlParams;
144
- const response = await fetch(urlToUse, options);
141
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
142
+ const { path, extraQueryUrlParams, ...fetchOptions } = options; // destructure fetch only options
143
+ const response = await fetch(urlToUse, fetchOptions);
145
144
  this.calls++;
146
- return { response, options: originalOptions };
145
+ return { response, options: options };
147
146
  }
148
147
  async request(endpoint, modify, parseAsText) {
149
148
  if (!this.connected)
@@ -1421,7 +1420,7 @@ export class LavalinkNode {
1421
1420
  }
1422
1421
  }
1423
1422
  player.set("internal_skipped", false);
1424
- player.set("internal_autoplayStopPlaying", Date.now());
1423
+ player.set("internal_autoplayStopPlaying", undefined);
1425
1424
  if (track && !track?.pluginInfo?.clientData?.previousTrack) { // If there was a current Track already and repeatmode === true, add it to the queue.
1426
1425
  player.queue.previous.unshift(track);
1427
1426
  if (player.queue.previous.length > player.queue.options.maxPreviousTracks)
@@ -212,7 +212,7 @@ export class Queue {
212
212
  try {
213
213
  this.queueChanges.tracksAdd(this.guildId, (Array.isArray(TrackOrTracks) ? TrackOrTracks : [TrackOrTracks]).filter(v => this.managerUtils.isTrack(v) || this.managerUtils.isUnresolvedTrack(v)), this.tracks.length, oldStored, this.utils.toJSON());
214
214
  }
215
- catch (e) { /* */ }
215
+ catch { /* */ }
216
216
  // save the queue
217
217
  await this.utils.save();
218
218
  // return the amount of the tracks
@@ -238,7 +238,7 @@ export class Queue {
238
238
  try {
239
239
  this.queueChanges.tracksAdd(this.guildId, (Array.isArray(TrackOrTracks) ? TrackOrTracks : [TrackOrTracks]).filter(v => this.managerUtils.isTrack(v) || this.managerUtils.isUnresolvedTrack(v)), index, oldStored, this.utils.toJSON());
240
240
  }
241
- catch (e) { /* */ }
241
+ catch { /* */ }
242
242
  // remove the tracks (and add the new ones)
243
243
  let spliced = TrackOrTracks ? this.tracks.splice(index, amount, ...(Array.isArray(TrackOrTracks) ? TrackOrTracks : [TrackOrTracks]).filter(v => this.managerUtils.isTrack(v) || this.managerUtils.isUnresolvedTrack(v))) : this.tracks.splice(index, amount);
244
244
  // get the spliced array
@@ -248,7 +248,7 @@ export class Queue {
248
248
  try {
249
249
  this.queueChanges.tracksRemoved(this.guildId, spliced, index, oldStored, this.utils.toJSON());
250
250
  }
251
- catch (e) { /* */ }
251
+ catch { /* */ }
252
252
  // save the queue
253
253
  await this.utils.save();
254
254
  // return the things
@@ -297,7 +297,7 @@ export class Queue {
297
297
  try {
298
298
  this.queueChanges.tracksRemoved(this.guildId, removed, removeQueryTrack, oldStored, this.utils.toJSON());
299
299
  }
300
- catch (e) { /* */ }
300
+ catch { /* */ }
301
301
  await this.utils.save();
302
302
  return { removed };
303
303
  }
@@ -316,7 +316,7 @@ export class Queue {
316
316
  try {
317
317
  this.queueChanges.tracksRemoved(this.guildId, removed, removeQueryTrack, oldStored, this.utils.toJSON());
318
318
  }
319
- catch (e) { /* */ }
319
+ catch { /* */ }
320
320
  await this.utils.save();
321
321
  return { removed };
322
322
  }
@@ -340,7 +340,7 @@ export class Queue {
340
340
  try {
341
341
  this.queueChanges.tracksRemoved(this.guildId, removed, tracksToRemove.map(v => v.i), oldStored, this.utils.toJSON());
342
342
  }
343
- catch (e) { /* */ }
343
+ catch { /* */ }
344
344
  await this.utils.save();
345
345
  return { removed };
346
346
  }
@@ -358,7 +358,7 @@ export class Queue {
358
358
  try {
359
359
  this.queueChanges.tracksRemoved(this.guildId, removed, toRemove, oldStored, this.utils.toJSON());
360
360
  }
361
- catch (e) { /* */ }
361
+ catch { /* */ }
362
362
  await this.utils.save();
363
363
  return { removed };
364
364
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lavalink-client",
3
- "version": "2.4.3",
3
+ "version": "2.4.4",
4
4
  "description": "Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",