Example Guide
All Events:
On Lavalink-Manager:
Player related logs
playerCreate
➡️(player) => {}
playerDestroy
➡️(player, reason) => {}
playerDisconnect
➡️(player, voiceChannelId) => {}
playerMove
➡️(player, oldChannelId, newChannelId) => {}
- Updating the voice channel is handled by the client automatically
playerSocketClosed
➡️(player, payload) => {}
Track / Manager related logs
trackStart
➡️(player, track, payload) => {}
trackStuck
➡️(player, track, payload) => {}
trackError
➡️(player, track, payload) => {}
trackEnd
➡️(player, track, payload) => {}
queueEnd
➡️(player, track, payload) => {}
playerUpdate
➡️(player) => {}
On Node-Manager:
raw
➡️(node, payload) => {}
disconnect
➡️(node, reason) => {}
connect
➡️(node) => {}
reconnecting
➡️(node) => {}
create
➡️(node) => {}
destroy
➡️(node) => {}
error
➡️(node, error, payload) => {}
resumed
➡️(node, payload, players) => {}
- Resuming needs to be handled manually by you (aka add the players to the manager)
- e.g. of listening to node events:
How to log queue logs?
When creating the manager, add the option:
queueOptions.queueChangesWatcher: new myCustomWatcher(botClient)
E.g:
How to do resuming
- You need to enable resuming on a connected Lavalink node :
node.updateSession(true, 360e3)
- The NodeManager#resumed event will emit when the node resumes, you retrieves all fetchedPlayers (fetched by the client), and thus all you need to do is re-create all player instances (and possibly the queues too)
- For that is the queuestore useful
- To save the playerData you can utilize smt like playerUpdate event.
Resuming full Example
Full code sample: can be found on the Testbot in here