aqualink 1.6.2-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
@@ -27,9 +27,10 @@ This code is based in riffy, but its an 100% Rewrite made from scratch...
27
27
 
28
28
  # Omg version 1.6.0 || 1.6.1 || 1.6.2 woah aqualink
29
29
 
30
- Version 1.6.2
30
+ Version 1.6.2-2
31
31
  - Fixed the rejected error (connection, for example using destroy returns an error)
32
32
  - Added bun support (now it should work with bun too)
33
+ - 2: fix all connections errors (hope)
33
34
 
34
35
  Version 1.6.1:
35
36
 
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aqualink",
3
- "version": "1.6.2-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": {