This version is 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; see the 2.10.5 release notes. The historical content below is preserved and may describe behavior that no longer applies, including socket-closure state handling. This notice does not mean npm registry deprecation has already been applied.
Changes in 2.10.4
This patch fixes a player-state regression introduced in 2.10.3. Periodic
server updates could make a connected player appear disconnected inside the
trackStart callback until a later update arrived.
Previous release notes cover the Lavalink v4 corrections and NodeLink integration introduced in 2.10.3.
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.
Player Lifecycle State Fix
In 2.10.3, every playerUpdate assigned player.state from
message.state.connected. That server flag describes the voice transport and
can lag the local player lifecycle, including while track-start processing
awaits the queue.
In 2.10.4:
- Periodic updates still update playback position and emit
playerUpdate. - Periodic updates no longer overwrite
player.state. - Explicit connect/disconnect operations, Discord voice leave, voice socket closure, and native NodeLink lifecycle events retain their state handling.
- Late telemetry cannot resurrect a disconnected player or overwrite a disconnecting, destroying, or reconnecting lifecycle state.
trackStartdoes not forceCONNECTEDor hide a genuine disconnect.
The reported server connection status remains available as
message.state.connected in the playerUpdate callback. Use that field when
you need the server's current voice-transport observation; player.state is
the library lifecycle state, not proof that audio is already reaching Discord.
Following a socket closure, lifecycle state is restored by an explicit
connect() or the corresponding native NodeLink lifecycle event, not by
periodic telemetry alone.
Regression Coverage
The library now provides npm test, and npm run ci includes the tests.
There are 44 automated regression cases, covering both Lavalink and NodeLink:
- Startup and updates received during asynchronous track resolution.
- All lifecycle states with true, false, or missing server connection flags.
- Explicit disconnects, Discord voice leave, and voice socket closure.
- Native NodeLink reconnect, connect, and destroy events.
- Unknown guilds, previous-node updates, and unchanged player-update payloads.
The suite has passed on Node.js 20.19.0 and 24.15.0, together with formatting, lint, compilation, and declaration checks. These are mocked gateway tests, not a record of successful live Discord/server integration testing.
Upgrade Notes
No public signature, runtime dependency, or storage configuration changes are
part of this patch. Read the migration guide if your application
used periodic connection flags to interpret player.state. Test the first
track, voice leave, and reconnect paths against your actual backend.