mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
bye
This commit is contained in:
1 parent
35aab94a53
commit
3ef54117bb
27 files changed
+5
-156
No files matched your search
@@ -117,15 +117,11 @@ class GatewayHandler {
|
||||
const client = remix.client;
|
||||
|
||||
try {
|
||||
// Fluxer 3.0 + sharding: the ws manager exposes shards via getShards()
|
||||
// (2.2 used a `shards` Map property) and a sharded child owns several
|
||||
// shards — track the raw socket of EVERY local shard, not just shard 0.
|
||||
const wsObjs = ShardingUtils.localShardSockets(client);
|
||||
|
||||
if (!remix._rawGatewayWsObjs) remix._rawGatewayWsObjs = new Set();
|
||||
const attached = remix._rawGatewayWsObjs;
|
||||
|
||||
// Detach listeners from sockets that went away (reconnects).
|
||||
for (const old of attached) {
|
||||
if (wsObjs.includes(old)) continue;
|
||||
try {
|
||||
@@ -142,8 +138,6 @@ class GatewayHandler {
|
||||
|
||||
let attachedNew = false;
|
||||
|
||||
// Create the shared raw-socket handlers once (stateless parsers
|
||||
// shared by every local shard socket).
|
||||
if (!remix._rawGatewayHandler) {
|
||||
remix._rawGatewayHandler = (data) => {
|
||||
try {
|
||||
@@ -249,7 +243,6 @@ class GatewayHandler {
|
||||
attachedNew = true;
|
||||
}
|
||||
|
||||
// Legacy singular field kept in sync (first socket) for compatibility.
|
||||
remix._rawGatewayWsObj = wsObjs[0] ?? null;
|
||||
this.wsListenerAttached = attached.size > 0;
|
||||
if (attachedNew) {
|
||||
@@ -294,12 +287,6 @@ class GatewayHandler {
|
||||
}];
|
||||
}
|
||||
|
||||
// Fluxer 3.0: client.ws is a throwing getter when the gateway is not
|
||||
// connected (2.2 exposed a plain optional). The raw opcode-3 payload
|
||||
// below stays in wire format (custom_status) because it bypasses
|
||||
// ClientUser.setPresence() and hits the shard directly.
|
||||
// Sharded children fan the update out to every gateway shard in this
|
||||
// process (presence is per shard); single process = shard 0 as before.
|
||||
try {
|
||||
if (client.ws?.send) {
|
||||
for (const id of ShardingUtils.localShardIds(client)) {
|
||||
@@ -596,8 +583,6 @@ class GatewayHandler {
|
||||
}
|
||||
}
|
||||
|
||||
// Attach the split-out concerns: voice-state routing (VoiceStateRouting),
|
||||
// guild sync & seeding (GuildSync), and 24/7 rejoin management (RejoinManager).
|
||||
applyMixins(GatewayHandler, VoiceStateRouting, GuildSync, RejoinManager);
|
||||
|
||||
export { GatewayHandler };
|
||||
@@ -91,10 +91,6 @@ const RejoinManager = {
|
||||
this._rejoinAttempts.delete(cleanChannelId);
|
||||
return;
|
||||
}
|
||||
// Ghost/zombie player: object alive in the map but its voice session
|
||||
// is long gone (serverLeave / dead socket). It used to block this
|
||||
// rejoin with "already has a player" — the #1 reason 24/7 silently
|
||||
// died. Evict it and respawn a live connection.
|
||||
logger.voice247(
|
||||
`[Rejoin] Existing player for ${cleanChannelId} has a dead connection — evicting before rejoin.`
|
||||
);
|
||||
|
||||
@@ -271,7 +271,6 @@ const VoiceStateRouting = {
|
||||
const guildId = vsuGuildId;
|
||||
|
||||
if (newChannelId && guildId && oldChannelId && oldChannelId !== newChannelId) {
|
||||
// During boot recovery, ignore move events — the recovery loop handles rejoining.
|
||||
if (this._bootRecoveryActive) {
|
||||
logger.voice247(
|
||||
`[247] Ignoring bot move ${cleanId(oldChannelId)} → ${cleanId(newChannelId)} during boot recovery.`
|
||||
@@ -282,7 +281,6 @@ const VoiceStateRouting = {
|
||||
const cleanNew = cleanId(newChannelId);
|
||||
const cleanOld = cleanId(oldChannelId);
|
||||
|
||||
// Check if old channel is a saved 24/7 channel
|
||||
const oldIs247 = (() => {
|
||||
try {
|
||||
const set = remix.settingsMgr.getServer(guildId);
|
||||
@@ -290,7 +288,6 @@ const VoiceStateRouting = {
|
||||
} catch (_) { return false; }
|
||||
})();
|
||||
|
||||
// Check if new channel is a saved 24/7 channel or has a pending spawn
|
||||
const newChannelSaved = (() => {
|
||||
try {
|
||||
const set = remix.settingsMgr.getServer(guildId);
|
||||
@@ -302,9 +299,6 @@ const VoiceStateRouting = {
|
||||
const existingPlayer = remix.players.playerMap.get(cleanOld);
|
||||
|
||||
if (oldIs247 && existingPlayer) {
|
||||
// Old channel is 24/7 — bot physically moved away, so the voice
|
||||
// connection to old channel is dead. Destroy the old player and
|
||||
// schedule a fresh rejoin so it gets a new live connection.
|
||||
logger.voice247(
|
||||
`[247] Bot moved away from 24/7 channel ${cleanOld} → ${cleanNew}. ` +
|
||||
`Destroying stale player, scheduling rejoin for ${cleanOld}.`
|
||||
@@ -324,13 +318,11 @@ const VoiceStateRouting = {
|
||||
}, rejoinDelay);
|
||||
}
|
||||
} else if (newChannelSaved || newChannelPendingSpawn) {
|
||||
// New channel is already 24/7 or being spawned — keep both, don't rekey.
|
||||
logger.voice247(
|
||||
`[247] Keeping both channels ${cleanOld} and ${cleanNew} ` +
|
||||
`(saved=${newChannelSaved} pending=${newChannelPendingSpawn})`
|
||||
);
|
||||
} else if (existingPlayer && cleanNew !== cleanOld) {
|
||||
// Neither channel is 24/7 — safe to rekey the player.
|
||||
const targetChannel = client.channels.get(cleanNew)
|
||||
?? client.channels.get?.(cleanNew)
|
||||
?? null;
|
||||
@@ -351,8 +343,6 @@ const VoiceStateRouting = {
|
||||
}
|
||||
}
|
||||
|
||||
// Simplified 24/7: stay_247 list only changes via !247 command.
|
||||
// Do NOT auto-add/remove channels on bot move.
|
||||
} catch (e) {
|
||||
logger.warn("[247] Bot move handler failed:", e.message);
|
||||
}
|
||||
@@ -375,11 +365,6 @@ const VoiceStateRouting = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Player missing or already dead. The old code just dropped the
|
||||
// event ("deferring until grace period ends" — nothing ever
|
||||
// replayed it), so a 24/7 channel killed during boot never came
|
||||
// back. Arm a deferred bot-level rejoin for just after the grace
|
||||
// window instead.
|
||||
const graceSet = remix.settingsMgr.getServer(guildId);
|
||||
const graceMode = graceSet ? get247ChannelMode(graceSet, cleanOld) : "off";
|
||||
if (graceMode === "on" && typeof remix.schedule247Rejoin === "function") {
|
||||
|
||||
Reference in new issue
Block a user