mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
fix: resolve startup crashes from missing exports, unsafe JSON parsing, and broken migrate/dashboard logic
Full rework and bugfix pass across the fluxer codebase to resolve multiple runtime crashes that prevented the bot from starting and loading guild settings correctly. Export/Import Fixes: - Added re-export of SettingsManager from settings/Settings.mjs into src/Settings.mjs to resolve missing named export error that crashed the bot on startup (affected CommandHandler, PlayerManager, and migrate.mjs) - Verified all 70+ import/export chains across the entire project JSON.parse Safety (mysql2 JSON column handling): - src/Settings.mjs — added typeof guard before JSON.parse on RemoteSettingsManager.load() since mysql2 returns JSON columns as already-parsed objects, causing "[object Object]" SyntaxError - settings/Settings.mjs — same typeof guard applied - src/GatewayHandler.mjs — same typeof guard applied Migrate Script Fix: - settings/migrate.mjs — replaced abstract SettingsManager usage with concrete RemoteSettingsManager (which actually has the `guilds` property required for migration logic) Dashboard Fix: - src/dashboard/Dashboard.mjs — added missing reply() method to fakeMsg object so PlayerManager.initPlayer() doesn't crash when a user joins voice through the web dashboard Files changed (13): - src/Settings.mjs - settings/Settings.mjs - src/GatewayHandler.mjs - settings/migrate.mjs - src/dashboard/Dashboard.mjs - src/CommandHandler.mjs - src/PlayerManager.mjs - src/MoonlinkManager.mjs - src/Player.mjs - src/RecoveryManager.mjs - src/constants/audio/StreamMerger.mjs - src/constants/audio/Tuna.mjs - commands/remove.mjs
This commit is contained in:
1 parent
5e0aefb79d
commit
991045f4dd
13 files changed
+1361
-1327
No files matched your search
+19
-4
@@ -111,7 +111,13 @@ export class MoonlinkManager extends EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Send voice payload to Fluxer's WebSocket
|
||||
* Send voice payload to Fluxer's WebSocket.
|
||||
*
|
||||
* moonlink.js v5 passes the full gateway payload object (with `op` and `d` keys).
|
||||
* Fluxer's client-level `ws.send()` handles serialization internally, so we
|
||||
* pass the raw object. The native-WebSocket fallback path (line with
|
||||
* `JSON.stringify`) is kept for edge cases where only the raw ws is available.
|
||||
*
|
||||
* @param {string} guildId
|
||||
* @param {{ op: number, d: object }} payload
|
||||
* @private
|
||||
@@ -142,7 +148,16 @@ export class MoonlinkManager extends EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Forward voice state updates from Fluxer to moonlink
|
||||
* Forward voice state updates from Fluxer to moonlink.
|
||||
*
|
||||
* moonlink.js v5 expects raw gateway payloads via `packetUpdate()`:
|
||||
* - VOICE_STATE_UPDATE → { op: 0, t: "VOICE_STATE_UPDATE", d: {...} }
|
||||
* - VOICE_SERVER_UPDATE → { op: 0, t: "VOICE_SERVER_UPDATE", d: {...} }
|
||||
*
|
||||
* VOICE_STATE_UPDATE comes from the Fluxer `VoiceStateUpdate` event.
|
||||
* VOICE_SERVER_UPDATE must be intercepted from the raw WebSocket stream because
|
||||
* Fluxer does not emit a dedicated event for it.
|
||||
*
|
||||
* @param {import("@fluxerjs/core").Client} client
|
||||
* @private
|
||||
*/
|
||||
@@ -269,9 +284,9 @@ export class MoonlinkManager extends EventEmitter {
|
||||
|
||||
destroy() {
|
||||
try {
|
||||
for (const node of this.manager.nodes.nodes.values()) {
|
||||
for (const node of this.manager.nodes?.nodes?.values?.() ?? []) {
|
||||
node.socket?.close?.();
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user