@@ -185,6 +185,31 @@ client.lavalink = new LavalinkManager({
185
185
})
186
186
` ` `
187
187
188
+ ## How to do resuming
189
+
190
+ ` ` ` js
191
+ // 1. while the player is playing, make sure to enable it:
192
+ const durationToKeepPlayingInMS = 600_000;
193
+ await player.node.updateSession(true, durationToKeepPlayingInMS);
194
+ ` ` `
195
+
196
+ ` ` ` js
197
+ // 2. make sure to have an eventlistener for resuming events somewhere
198
+ client.lavalink.nodeManager.on("resumed", (node, payload, fetchedPlayers) => {
199
+ // create players:
200
+ for(const fetchedPlayer of fetchedPlayers) {
201
+ const player = client.lavalink.createPlayer({
202
+ guildId: fetchedPlayer.guildId,
203
+ });
204
+ player.setVolume(fetchedPlayer.volume);
205
+ // and apply other things (e.g. paused, voice, filters, state, ...) (stuff like vc channel, text channel you need to store somewhere)
206
+ await player.queue.utils.sync(); // only works with a queuestore
207
+ // you can now overwride the player.queue.current track from the fetchedPlayer, or use the one from the queue.uztils.sync function
208
+ // continue with your resuming code...
209
+ }
210
+ })
211
+ ` ` `
212
+
188
213
***
189
214
190
215
# UpdateLog
@@ -241,7 +266,7 @@ client.lavalink = new LavalinkManager({
241
266
242
267
# Node Resuming got supported
243
268
# First enable it by doing:
244
- + await player .node .updateResuming (true , 360_000 );
269
+ + await player .node .updateSession (true , 360_000 );
245
270
# then when reconnecting to the node add to the node .createeOptions the sessionId: " " of the previous session
246
271
# and after connecting the nodeManager .on (" resumed" , (node , payload , players ) => {}) will be executed, where you can sync the players!
247
272
0 commit comments