mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
feat(player): persist and restore autoplay state across restarts
- Save autoplay flag, recent history, and last played track in session snapshots - Guard against pruning active autoplay sessions with empty queues - Dynamically re-attach queueEnd autoplay listener during session restoration - Trigger recommendation engine automatically if recovered with empty queue - Persist player snapshots immediately when toggling autoplay on or off
This commit is contained in:
1 parent
84c597ec3c
commit
f1b2e43f8a
3 files changed
+33
-2
No files matched your search
@@ -619,6 +619,7 @@ export async function run(msg, data) {
|
||||
if (p._autoplay) {
|
||||
p._autoplayHistory = p._autoplayHistory ?? [];
|
||||
attachAutoplay(p, this);
|
||||
this.playerState?.saveSnapshot?.(p)?.catch?.(() => {});
|
||||
|
||||
if (!p.queue.getCurrent() && p.queue.isEmpty() && p._lastPlayedTrack) {
|
||||
p._autoplayHandler().catch(() => {});
|
||||
@@ -634,6 +635,7 @@ export async function run(msg, data) {
|
||||
return msg.reply({ embeds: [embed] });
|
||||
} else {
|
||||
detachAutoplay(p);
|
||||
this.playerState?.saveSnapshot?.(p)?.catch?.(() => {});
|
||||
p._autoplayHistory = [];
|
||||
p._autoplayMixPools?.clear();
|
||||
p._autoplayPreferredPoolVid = null;
|
||||
|
||||
Reference in new issue
Block a user