aqualink 1.6.1-beta → 1.6.2-beta2

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
@@ -25,7 +25,12 @@ This code is based in riffy, but its an 100% Rewrite made from scratch...
25
25
 
26
26
  - Example bot: https://github.com/ToddyTheNoobDud/Thorium-Music
27
27
 
28
- # Omg version 1.6.0 || 1.6.1 woah aqualink
28
+ # Omg version 1.6.0 || 1.6.1 || 1.6.2 woah aqualink
29
+
30
+ Version 1.6.2-2
31
+ - Fixed the rejected error (connection, for example using destroy returns an error)
32
+ - Added bun support (now it should work with bun too)
33
+ - 2: fix all connections errors (hope)
29
34
 
30
35
  Version 1.6.1:
31
36
 
@@ -38,7 +43,7 @@ Version 1.6.1:
38
43
  - Some misc changes on player, small optimziations, use Fisher-Yates algorithm, and remove useless asyncs.
39
44
  - Improved the internal code Garbage collection.
40
45
  - Use more WeakSet and WeakMaps for memory friendly
41
-
46
+ - Extra: Also fixed requesting every 1 sec, reducing the requests system and memory usage by a lot i think;
42
47
  -- Im working on new features, ex: autoplay, lyrics system, and more to come... its hard to me as an solo dev
43
48
 
44
49
 
@@ -78,17 +78,13 @@ class Aqua extends EventEmitter {
78
78
  }
79
79
  }
80
80
 
81
- updateVoiceState(packet) {
82
- if (!packet?.d?.guild_id) return;
83
- const player = this.players.get(packet.d.guild_id);
84
- if (!player) return;
85
- const updateType = packet.t === "VOICE_SERVER_UPDATE" ? "setServerUpdate" : "setStateUpdate";
86
- player.connection[updateType](packet.d);
87
- if (packet.d.status === "disconnected") {
88
- this.cleanupPlayer(player);
81
+ updateVoiceState({ d, t }) {
82
+ const player = this.players.get(d.guild_id);
83
+ if (player && (t === "VOICE_SERVER_UPDATE" || t === "VOICE_STATE_UPDATE" && d.user_id === this.clientId)) {
84
+ player.connection[t === "VOICE_SERVER_UPDATE" ? "setServerUpdate" : "setStateUpdate"](d);
85
+ if (d.status === "disconnected") this.cleanupPlayer(player);
89
86
  }
90
87
  }
91
-
92
88
  fetchRegion(region) {
93
89
  if (!region) return this.leastUsedNodes;
94
90
  const lowerRegion = region.toLowerCase();
@@ -104,8 +100,8 @@ class Aqua extends EventEmitter {
104
100
 
105
101
  createConnection(options) {
106
102
  this.ensureInitialized();
107
- const existingPlayer = this.players.get(options.guildId);
108
- if (existingPlayer?.voiceChannel) return existingPlayer;
103
+ const player = this.players.get(options.guildId);
104
+ if (player && player.voiceChannel) return player;
109
105
  const node = options.region ? this.fetchRegion(options.region)[0] : this.leastUsedNodes[0];
110
106
  if (!node) throw new Error("No nodes are available");
111
107
  return this.createPlayer(node, options);
@@ -39,9 +39,8 @@ class Connection {
39
39
  return;
40
40
  }
41
41
 
42
- if (this.player.voiceChannel !== data.channel_id) {
43
- this.player.aqua.emit("playerMove", this.player.voiceChannel, data.channel_id);
44
- this.player.voiceChannel = data.channel_id;
42
+ if (this.voiceChannel !== data.channel_id) {
43
+ this.player.aqua.emit("playerMove", this.voiceChannel, data.channel_id);
45
44
  this.voiceChannel = data.channel_id;
46
45
  }
47
46
 
@@ -30,13 +30,13 @@ class Rest {
30
30
 
31
31
  const response = await request(`${this.url}${endpoint}`, options);
32
32
  this.calls++;
33
- const data = await response.body.json()
33
+ const data = await response.body.json();
34
34
  this.aqua.emit("apiResponse", endpoint, {
35
35
  status: response.statusCode,
36
36
  headers: response.headers,
37
37
  });
38
- response.body.dump();
39
- return data
38
+ response.body.destroy();
39
+ return data;
40
40
  }
41
41
 
42
42
  updatePlayer(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aqualink",
3
- "version": "1.6.1-beta",
3
+ "version": "1.6.2-beta2",
4
4
  "description": "An Lavalink wrapper, focused in speed, performance, and features, Based in Riffy!",
5
5
  "main": "build/index.js",
6
6
  "scripts": {