mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
test
This commit is contained in:
1 parent
7b201a74b3
commit
57f3d9c481
2 files changed
+26
-4
No files matched your search
@@ -304,7 +304,8 @@ class Remix {
|
|||||||
const isTransient = e.message?.includes("engine is closed") ||
|
const isTransient = e.message?.includes("engine is closed") ||
|
||||||
e.message?.includes("MediaPlayer after retry") ||
|
e.message?.includes("MediaPlayer after retry") ||
|
||||||
e.message?.includes("LiveKit connection timeout") ||
|
e.message?.includes("LiveKit connection timeout") ||
|
||||||
e.message?.includes("LiveKit failed");
|
e.message?.includes("LiveKit failed") ||
|
||||||
|
e.message?.includes("No room available");
|
||||||
const shouldRetry = isTransient && !recoveryData?.queue?.length
|
const shouldRetry = isTransient && !recoveryData?.queue?.length
|
||||||
? (() => {
|
? (() => {
|
||||||
try {
|
try {
|
||||||
@@ -877,6 +878,11 @@ class Remix {
|
|||||||
if (existingPlayer && cleanId !== cleanOld) {
|
if (existingPlayer && cleanId !== cleanOld) {
|
||||||
this.players.playerMap.delete(cleanOld);
|
this.players.playerMap.delete(cleanOld);
|
||||||
this.players.playerMap.set(cleanId, existingPlayer);
|
this.players.playerMap.set(cleanId, existingPlayer);
|
||||||
|
// CRITICAL: also update the player's own _channelId so that
|
||||||
|
// _recoverConnection, _is247Enabled, and _hasHumansInChannel
|
||||||
|
// all use the correct channel. Without this they keep referencing
|
||||||
|
// the old channel even after the bot has moved.
|
||||||
|
existingPlayer._channelId = cleanId;
|
||||||
logger.voice247(`[247] Re-keyed playerMap ${cleanOld} → ${cleanId}`);
|
logger.voice247(`[247] Re-keyed playerMap ${cleanOld} → ${cleanId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+19
-3
@@ -407,13 +407,25 @@ export default class Player extends EventEmitter {
|
|||||||
if (!set?.get) return false;
|
if (!set?.get) return false;
|
||||||
const raw = set.get("stay_247");
|
const raw = set.get("stay_247");
|
||||||
if (!raw || raw === "none") return false;
|
if (!raw || raw === "none") return false;
|
||||||
|
const mode = set.get("stay_247_mode") ?? "auto";
|
||||||
|
if (mode !== "on" && mode !== "auto") return false;
|
||||||
|
|
||||||
const channels = Array.isArray(raw)
|
const channels = Array.isArray(raw)
|
||||||
? raw.map(id => String(id).replace(/\D/g, "")).filter(Boolean)
|
? raw.map(id => String(id).replace(/\D/g, "")).filter(Boolean)
|
||||||
: [String(raw).replace(/\D/g, "")];
|
: [String(raw).replace(/\D/g, "")];
|
||||||
const currentChannel = String(this._channelId).replace(/\D/g, "");
|
const currentChannel = String(this._channelId).replace(/\D/g, "");
|
||||||
if (!channels.includes(currentChannel)) return false;
|
|
||||||
const mode = set.get("stay_247_mode") ?? "auto";
|
// Primary check: current channel is in the 247 list.
|
||||||
return mode === "on" || mode === "auto";
|
if (channels.includes(currentChannel)) return true;
|
||||||
|
|
||||||
|
// Fallback: if the player is mid-recovery or mid-join, the bot may
|
||||||
|
// temporarily be in a transit channel (e.g. "move") that isn't in the
|
||||||
|
// 247 list yet. If the guild has ANY 247 channels configured and active,
|
||||||
|
// treat the player as 247 to prevent premature inactivity/alone timers
|
||||||
|
// from firing while the player is still reconnecting to the right channel.
|
||||||
|
if ((this._isRecovering || this._isJoining) && channels.length > 0) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.settingsMgr?.getServer) return checkSettings(this.settingsMgr.getServer(this._guildId));
|
if (this.settingsMgr?.getServer) return checkSettings(this.settingsMgr.getServer(this._guildId));
|
||||||
@@ -1098,6 +1110,10 @@ export default class Player extends EventEmitter {
|
|||||||
|
|
||||||
logger.mediaplayer("[Player] Proceeding to create MediaPlayer (room confirmed alive)");
|
logger.mediaplayer("[Player] Proceeding to create MediaPlayer (room confirmed alive)");
|
||||||
} else {
|
} else {
|
||||||
|
// connection.room is null — this happens when joinVoiceChannel returns
|
||||||
|
// a stale/recycled connection object before the LiveKit room is assigned,
|
||||||
|
// usually due to a concurrent join race or a channel that no longer has
|
||||||
|
// an active room. Treat it as transient so the retry loop handles it.
|
||||||
throw new Error("No room available after joinVoiceChannel");
|
throw new Error("No room available after joinVoiceChannel");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user