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:
co-authored by
Claude Opus 4.8
parent
30c9e86edc
commit
3a7b005d95
@@ -17,7 +17,10 @@ export interface BroadcastFunctions {
|
||||
messageCreated: BroadcastFn;
|
||||
messageUpdated: BroadcastFn;
|
||||
messageDeleted: BroadcastFn;
|
||||
messageAnalyzed: BroadcastFn;
|
||||
attachmentUploaded: BroadcastFn;
|
||||
voicePcmData: BroadcastFn;
|
||||
voiceActiveUser: BroadcastFn;
|
||||
raw: BroadcastRawFn;
|
||||
binary: BroadcastBinaryFn;
|
||||
}
|
||||
@@ -53,6 +56,15 @@ export const broadcastMessageDeleted: BroadcastFn = (data) =>
|
||||
export const broadcastAttachmentUploaded: BroadcastFn = (data) =>
|
||||
(_fns?.attachmentUploaded ?? noop)(data);
|
||||
|
||||
export const broadcastMessageAnalyzed: BroadcastFn = (data) =>
|
||||
(_fns?.messageAnalyzed ?? noop)(data);
|
||||
|
||||
export const broadcastVoicePcmData: BroadcastFn = (data) =>
|
||||
(_fns?.voicePcmData ?? noop)(data);
|
||||
|
||||
export const broadcastVoiceActiveUser: BroadcastFn = (data) =>
|
||||
(_fns?.voiceActiveUser ?? noop)(data);
|
||||
|
||||
export const broadcastRaw: BroadcastRawFn = (type, data) =>
|
||||
(_fns?.raw ?? noopRaw)(type, data);
|
||||
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("backend", () => {
|
||||
it("should load without errors", () => {
|
||||
|
||||
Reference in New Issue
Block a user