mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
hotfix
This commit is contained in:
1 parent
6fa8f3b540
commit
28fc86103c
4 files changed
+110
-16
No files matched your search
@@ -745,9 +745,25 @@ export class Remix {
|
||||
|
||||
// Handle autoleave — clean up the player map and destroy the player
|
||||
player.on("autoleave", () => {
|
||||
// Safety guard: don't destroy 24/7 players or players with humans/queue
|
||||
const mode = player._get247Mode();
|
||||
if (mode === "auto" || mode === "on") {
|
||||
logger.inactivity(`[_spawnPlayer] autoleave suppressed for 24/7 ${mode} channel ${cleanChannelId} (guild ${cleanGuildId})`);
|
||||
return;
|
||||
}
|
||||
if (player._hasHumansInChannel()) {
|
||||
logger.inactivity(`[_spawnPlayer] autoleave suppressed — humans in channel ${cleanChannelId}`);
|
||||
return;
|
||||
}
|
||||
if (player.queue?.getCurrent() || !player.queue?.isEmpty()) {
|
||||
logger.inactivity(`[_spawnPlayer] autoleave suppressed — queue has songs in channel ${cleanChannelId}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const activeChId = String(player._channelId ?? cleanChannelId).replace(/\D/g, "") || cleanChannelId;
|
||||
const homeChId = String(player._home247Channel ?? activeChId).replace(/\D/g, "") || activeChId;
|
||||
this.players.playerMap.delete(activeChId);
|
||||
this.players._unindexPlayer?.(cleanGuildId, activeChId);
|
||||
if (activeChId !== cleanChannelId) this.players.playerMap.delete(cleanChannelId);
|
||||
if (homeChId !== activeChId) this.players.playerMap.delete(homeChId);
|
||||
player.destroy();
|
||||
|
||||
Reference in new issue
Block a user