Changes in 2.10.5
This patch fixes a player-state regression left in 2.10.4: a delayed closure
of an old voice socket could mark a restored or moved player DISCONNECTED,
even though audio had resumed. The incorrect state could then cause
savePlayerState() to skip the player at a subsequent shutdown.
2.10.3 and 2.10.4 are deprecated because player connection states can be incorrect during startup, restores, or channel moves and may prevent subsequent saves. Upgrade to stable 2.10.5. The affected pre-release 2.10.3-alpha.10 also contained the socket and heartbeat state assignments; earlier 2.10.3 alpha and dev builds are not included in this bug-specific deprecation notice. Npm registry deprecation is a separate step after stable publication.
Previous release notes preserve the historical 2.10.4 fix. Their socket-closure state claims describe that release, not current behavior.
Install This Release
npm install [email protected]
For pnpm use pnpm add [email protected]; for Yarn use
yarn add [email protected]. Unqualified installs follow npm's latest tag.
The completed 2.10.5-alpha.1 test build is not the stable upgrade target.
Voice Socket Closure Fix
The socketClosed handler no longer assigns player.state = DISCONNECTED.
It still emits the same socketClosed event with the unchanged payload.
An old socket may close with 4006 during a bot restart/restore, or with 4014
after a channel move, updated voice credentials, and resumed audio. Neither
closure alone proves that the current player is disconnected.
Discord voice leave (channel_id: null), explicit disconnect() / destroy(),
and native NodeLink reconnect/connect/destroy lifecycle events continue to
handle actual state changes. The 2.10.4 heartbeat fix is retained: periodic
playerUpdate packets update position and emit their unchanged payload, but
message.state.connected does not overwrite the library lifecycle state.
Read that raw flag for the server's transport observation. Neither player.state
nor trackStart guarantees that Discord is already receiving audio.
Preserving the correct state prevents savePlayerState() from skipping an
active restored or moved player. This is a consequence of the lifecycle fix,
not a change to the save policy or storage configuration.
Debug Serialization Guard
The existing manager voice-update debug message in Manager.updateVoiceState()
now serializes its payload only when a debug listener is present. The log
pre-existed this release; this is a listener guard, not a new logging feature.
Regression Coverage
The library's npm test suite is included in npm run ci.
There are 62 automated cases, covering both Lavalink and NodeLink protocols
with mocked gateway and persistence paths:
- Startup and updates received during asynchronous track resolution.
- All lifecycle states with true, false, or missing server connection flags.
- Restart/restore
4006and late post-move4014socket closures. - Unchanged socket events, explicit disconnects, destroy, and Discord voice leave.
- Native NodeLink reconnect, connect, and destroy events.
- Unknown guilds, previous-node updates, and unchanged player-update payloads.
- Subsequent state saves after restore or move, and debug listener guarding.
The 2.10.5-alpha.1 candidate was tested successfully with a real bot before stable preparation. Automated tests use mocked gateway and persistence paths; see the validation checklist for deployment-specific checks. This does not establish a complete live backend/version matrix.
Upgrade Notes
No API signatures, dependencies, or storage configuration change in this patch. Read the migration guide, especially if your application treats every socket closure as a player disconnect. Validate first-track startup, restore, channel moves, normal shutdown/second restart, and explicit disconnects against your actual backend.