magmastream 2.10.3 → 2.10.5-alpha.1

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.
@@ -438,7 +438,9 @@ class Manager extends events_1.EventEmitter {
438
438
  const player = this.getPlayer(update.guild_id);
439
439
  if (!player)
440
440
  return;
441
- this.emit(Enums_1.ManagerEventTypes.Debug, `[MANAGER] Updating voice state: ${Utils_1.JSONUtils.safe(update, 2)}`);
441
+ if (this.listenerCount(Enums_1.ManagerEventTypes.Debug)) {
442
+ this.emit(Enums_1.ManagerEventTypes.Debug, `[MANAGER] Updating voice state: ${Utils_1.JSONUtils.safe(update, 2)}`);
443
+ }
442
444
  if ("token" in update) {
443
445
  return await this.handleVoiceServerUpdate(player, update);
444
446
  }
@@ -544,7 +544,7 @@ class Node {
544
544
  if (!player || player.node.options.identifier !== this.options.identifier)
545
545
  return;
546
546
  player.position = payload.state.position ?? 0;
547
- player.state = payload.state.connected ? Enums_1.StateTypes.Connected : Enums_1.StateTypes.Disconnected;
547
+ // Transport status can lag lifecycle events; expose it without overwriting player.state.
548
548
  this.manager.emit(Enums_1.ManagerEventTypes.PlayerUpdate, player, payload);
549
549
  }
550
550
  /**
@@ -1239,7 +1239,7 @@ class Node {
1239
1239
  * @param {WebSocketClosedEvent} payload - The event payload containing additional data about the WebSocket close event.
1240
1240
  */
1241
1241
  socketClosed(player, payload) {
1242
- player.state = Enums_1.StateTypes.Disconnected;
1242
+ // This may describe the old voice socket after a channel move, not a lifecycle disconnect.
1243
1243
  this.manager.emit(Enums_1.ManagerEventTypes.SocketClosed, player, payload);
1244
1244
  this.manager.emit(Enums_1.ManagerEventTypes.Debug, `[NODE] Websocket closed for player: ${player.guildId} with payload: ${Utils_1.JSONUtils.safe(payload, 2)}`);
1245
1245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magmastream",
3
- "version": "2.10.3",
3
+ "version": "2.10.5-alpha.1",
4
4
  "description": "A user-friendly Lavalink client designed for NodeJS.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,11 +11,12 @@
11
11
  "prepare": "npm run build",
12
12
  "build": "tsc",
13
13
  "types": "rtb --dist dist",
14
+ "test": "npm run build && node --test tests/player-state.test.cjs",
14
15
  "format": "prettier --write .",
15
16
  "format:check": "prettier --check .",
16
17
  "lint": "eslint \"src/**/*.{ts,js}\"",
17
18
  "lint:fix": "eslint --fix \"src/**/*.{ts,js}\"",
18
- "ci": "run-s format:check lint build types",
19
+ "ci": "run-s format:check lint build types test",
19
20
  "version:alpha": "node scripts/prerelease-version.cjs alpha",
20
21
  "version:dev": "node scripts/prerelease-version.cjs dev",
21
22
  "release:alpha": "npm run format && npm run lint:fix && npm run ci && npm run version:alpha && npm publish --tag alpha && git push && git push --follow-tags",