fix: resolve architecture disconnects and codebase weaknesses

- Add TEXT_CHANNEL_ID and TEXT_GUILD_ID to config schema (fix silent channel monitoring)
- Remove dead files: message-capture/broadcaster.ts, voice-recording/index.ts
- Fix WebSocket voice_command payload to forward from frontend
- Implement moderation:action handler in commandHandler
- Fix useMascotChat to use canonical request() wrapper
- Fix useAudioPlayback userId hash collision (use string not parseInt)
- Add catch blocks to useMediaControl.skip/stop
- Add typed broadcast functions (messageAnalyzed, voicePcmData, voiceActiveUser)
- Apply Biome formatting and lint fixes

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-09 16:36:23 +07:00
co-authored by Claude Opus 4.8
parent 30c9e86edc
commit 3a7b005d95
13 changed files with 171 additions and 109 deletions
+8 -2
View File
@@ -96,7 +96,7 @@ export function createWebSocketServer(server: Server): WebSocketServer {
},
);
} else if (message.type === "voice_command" && message.command) {
// Forward voice commands to discord-gateway
// Forward voice commands to discord-gateway with payload
import("../shared/redis/index.js").then(
({ getCommandPublisher }) => {
const publisher = getCommandPublisher();
@@ -107,7 +107,7 @@ export function createWebSocketServer(server: Server): WebSocketServer {
JSON.stringify({
id: commandId,
type: message.command,
payload: {},
payload: message.payload ?? {},
replyChannel: `reply:${commandId}`,
}),
)
@@ -186,8 +186,14 @@ export function createWebSocketServer(server: Server): WebSocketServer {
broadcast({ type: "message_updated", data }),
messageDeleted: (data: unknown) =>
broadcast({ type: "message_deleted", data }),
messageAnalyzed: (data: unknown) =>
broadcast({ type: "message_analyzed", data }),
attachmentUploaded: (data: unknown) =>
broadcast({ type: "attachment_uploaded", data }),
voicePcmData: (data: unknown) =>
broadcast({ type: "voice_pcm_data", data }),
voiceActiveUser: (data: unknown) =>
broadcast({ type: "voice_active_user", data }),
raw: (type: string, data: unknown) => broadcast({ type, data }),
binary: broadcastBinary,
});