aqualink 1.8.1-beta3 → 1.8.1-beta5

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
@@ -19,6 +19,7 @@ This code is based in riffy, but its an 100% Rewrite made from scratch...
19
19
  - Easy player, node, aqua manager
20
20
  - Fast responses from rest and node
21
21
  - Playlist support (My mix playlists, youtube playlists, spotify playlists, etc)
22
+ - Uses @performanc/pwsl-mini as default WebSocket system
22
23
  - Lyrics Support by Lavalink
23
24
  - https://github.com/topi314/LavaLyrics (RECOMMENDED)
24
25
  - https://github.com/DRSchlaubi/lyrics.kt (?)
@@ -31,9 +32,11 @@ This code is based in riffy, but its an 100% Rewrite made from scratch...
31
32
 
32
33
  # Brick by brick, 1.8.0 Update (yay)
33
34
 
34
- ### 1.8.1-beta3 Update:
35
- - Use pool for connections (Experimental, help me improve it.)
36
- - Remade some stuff on node related to caching
35
+ ### 1.8.1-beta5 Update:
36
+ - Use @performanc/pwsl-mini as main WebSocket
37
+ - Use pool for connections (Experimental, help me improve it. Undici pool)
38
+ - Default will not leave the VC anymore (leaveOnEnd: false default)
39
+ - Misc optimizations on node and player
37
40
 
38
41
  ### 1.8.0
39
42
  - Misc changes on FetchImage (improves the overall checking and speed)
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const WebSocket = require("ws");
2
+ const WebSocket = require("@toddynnn/pwsl-mini");
3
3
  const Rest = require("./Rest");
4
4
 
5
5
  class Node {
@@ -98,7 +98,7 @@ class Node {
98
98
  }
99
99
 
100
100
  async getStats() {
101
- const stats = await this.rest.makeRequest("GET", "/v4/stats");
101
+ const stats = await this.rest.getStats();
102
102
  this.stats = { ...this.defaultStats, ...stats };
103
103
  return this.stats;
104
104
  }
@@ -45,11 +45,15 @@ class Player extends EventEmitter {
45
45
  this.nowPlayingMessage = null;
46
46
  this.previousTracks = [];
47
47
  this.shouldDeleteMessage = options.shouldDeleteMessage ?? false;
48
- this.leaveOnEnd = options.leaveOnEnd ?? true;
48
+ this.leaveOnEnd = options.leaveOnEnd ?? false;
49
49
 
50
50
  this.onPlayerUpdate = ({ state } = {}) => {
51
51
  if (!state) return;
52
- Object.assign(this, state);
52
+ for (const key in state) {
53
+ if (state.hasOwnProperty(key)) {
54
+ this[key] = state[key];
55
+ }
56
+ }
53
57
  this.aqua.emit("playerUpdate", this, { state });
54
58
  };
55
59
  this.handleEvent = async (payload) => {
@@ -64,7 +68,6 @@ class Player extends EventEmitter {
64
68
  };
65
69
  this.on("playerUpdate", this.onPlayerUpdate);
66
70
  this.on("event", this.handleEvent);
67
- this.#dataStore = new Map();
68
71
  }
69
72
 
70
73
  get previous() {
@@ -235,7 +238,7 @@ class Player extends EventEmitter {
235
238
  this.aqua.emit("trackStart", player, track);
236
239
  }
237
240
 
238
- trackChange(player, track) {
241
+ async trackChange(player, track) {
239
242
  this.updateTrackState(true, false);
240
243
  this.aqua.emit("trackChange", player, track);
241
244
  }
@@ -308,8 +311,7 @@ class Player extends EventEmitter {
308
311
  this.aqua.send({ op: 4, d: data });
309
312
  }
310
313
 
311
- // Optimize data storage
312
- #dataStore;
314
+ #dataStore = new Map();
313
315
 
314
316
  set(key, value) {
315
317
  this.#dataStore.set(key, value);
@@ -324,11 +326,8 @@ class Player extends EventEmitter {
324
326
  return this;
325
327
  }
326
328
 
327
- async updatePlayer(data) {
328
- return this.nodes.rest.updatePlayer({
329
- guildId: this.guildId,
330
- data,
331
- });
329
+ updatePlayer(data) {
330
+ return this.nodes.rest.updatePlayer({ guildId: this.guildId, data });
332
331
  }
333
332
 
334
333
  handleUnknownEvent(payload) {
@@ -88,7 +88,7 @@ class Rest {
88
88
  }
89
89
 
90
90
  async getStats() {
91
- const endpoint = `/${this.version}/stats/all`;
91
+ const endpoint = `/${this.version}/stats`;
92
92
  return this.makeRequest("GET", endpoint);
93
93
  }
94
94
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aqualink",
3
- "version": "1.8.1-beta3",
3
+ "version": "1.8.1-beta5",
4
4
  "description": "An Lavalink wrapper, focused in speed, performance, and features, Based in Riffy!",
5
5
  "main": "build/index.js",
6
6
  "types": "index.d.ts",
@@ -37,8 +37,8 @@
37
37
  "author": "mushroom0162 (https://github.com/ToddyTheNoobDud)",
38
38
  "license": "ISC",
39
39
  "dependencies": {
40
- "undici": "^7.3.0",
41
- "ws": "^8.18.0"
40
+ "undici": "^7.4.0",
41
+ "@toddynnn/pwsl-mini": "github:ToddyTheNoobDud/websocket"
42
42
  },
43
43
  "repository": {
44
44
  "type": "git",