This commit is contained in:
NoLogicAlan committed 2026-09-10 03:02:51 +03:00
1 parent 35aab94a53
commit 3ef54117bb
27 files changed
+5 -156

No files matched your search

+1 -16
View File
@@ -139,10 +139,6 @@ class Remix {
intentionalLeaveTTL: timers.intentionalLeaveTTL ?? 10_000,
};
// Fluxer 3.0: ClientOptions.presence is the normalized PresenceUpdateOptions
// shape (customStatus/emojiName/emojiId) — the 2.2 wire format
// (custom_status) is no longer read here. buildRuntimePresence() outputs
// exactly the normalized shape, so the initial presence reuses it.
const client = new Client({
waitForGuilds: true,
cache: { guilds: false, channels: false, users: false, members: false },
@@ -350,11 +346,6 @@ class Remix {
logger.commands(`Modules loaded (${succeeded} succeeded, ${failed} failed).`);
});
// Fluxer.js 3.0 sharding (opt-in, root `shard.mjs`): a child forked by a
// ShardingManager attaches the child-side ShardClientUtil BEFORE login —
// it applies FLUXER_SHARD_IDS/FLUXER_SHARD_COUNT to the client options
// and routes IDENTIFYs through the parent's shared per-IP budget — then
// reports readiness so the supervisor's spawn() promise resolves.
const startLogin = async () => {
if (ShardingUtils.isShardedProcess()) {
try {
@@ -364,8 +355,7 @@ class Remix {
`[Startup] Sharding child attached — ${ShardingUtils.describeSharding(client)}.`
);
} catch (e) {
// Fatal: without the shard slice this child would identify as shard 0
// like every other child and thrash the gateway sessions.
logger.error(
"[Startup] FATAL: running under a ShardingManager but the sharding attach failed:",
e?.message
@@ -402,7 +392,6 @@ class Remix {
.filter(id => id.length >= 15 && id.length <= 22);
if (cleaned.length > 1) {
// Only 1 channel per guild supported. Keep first, drop the rest.
serverSettings.set("stay_247", cleaned.slice(0, 1));
logger.settings(
`[settings] Trimmed stay_247 for guild ${guildId}: had ${cleaned.length} channels, kept first 1.`
@@ -547,9 +536,6 @@ class Remix {
if (shard.ws) attachToSocket(shard.ws, `Shard ${id} socket`);
};
// Fluxer 3.0: the ws manager exposes shards via getShards() (2.2 used a
// `shards` Map property) and a sharded child owns several of them —
// attach to every shard connected in this process, not just shard 0.
for (const [id, shard] of ShardingUtils.getLocalShards(this.client)) {
attachToShard(shard, id);
}
@@ -583,7 +569,6 @@ class Remix {
}
}
// Attach channel/voice operations (spawn, leave, shared servers, helpers).
applyMixins(Remix, BotVoiceMixin);
export { Remix };
+1 -6
View File
@@ -158,8 +158,6 @@ const BotVoiceMixin = {
markIntentionalLeave(channelId, ttlMs = null) {
const cleanChId = cleanId(channelId);
if (!cleanChId) return;
// A user-initiated leave must also cancel any rejoin already armed for
// this channel — otherwise the bot would come back 3s after !leave.
this.cancel247Rejoin?.(cleanChId);
if (ttlMs === null) ttlMs = this.config?.timers?.intentionalLeaveTTL ?? 10_000;
const existing = this.intentionalLeaves.get(cleanChId);
@@ -191,7 +189,7 @@ const BotVoiceMixin = {
}
if (!this._247RejoinTimers) this._247RejoinTimers = new Map();
if (this._247RejoinTimers.has(cleanCh)) return; // already armed — keep the earliest
if (this._247RejoinTimers.has(cleanCh)) return;
const delay = delayMs ?? this.config?.timers?.rejoin247Delay ?? 3_000;
logger.voice247(`[247] Arming bot-level rejoin for ${cleanCh} (guild ${cleanG}) in ${delay / 1000}s`);
@@ -251,9 +249,6 @@ const BotVoiceMixin = {
?? this.players.getPlayerByGuildAndChannel(cleanGuildId, cleanChannelId);
if (existing) {
if (!isPlayerConnectionDead(existing)) return existing;
// A connection-less zombie (e.g. a 24/7 player whose LiveKit session
// died without a serverLeave reaching us) is worse than useless: it
// blocks rejoins AND swallows !play. Evict it and spawn a live one.
logger.voice247(
`[_spawnPlayer] Existing player for ${cleanChannelId} has a dead connection — evicting and respawning.`
);
-1
View File
@@ -66,7 +66,6 @@ function _stormGate(level, tag, args) {
const st = _stormGuard.get(key);
if (st === undefined) {
if (_stormGuard.size >= STORM_MAX_KEYS) {
// Evict the oldest key to bound memory.
_stormGuard.delete(_stormGuard.keys().next().value);
}
_stormGuard.set(key, { n: 0, start: now });