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
@@ -10,7 +10,7 @@ export function useAudioPlayback() {
|
||||
Array.from({ length: 32 }, () => 0.04),
|
||||
);
|
||||
const audioContextRef = useRef<AudioContext | null>(null);
|
||||
const userTimelinesRef = useRef(new Map<number, number>());
|
||||
const userTimelinesRef = useRef(new Map<string, number>());
|
||||
|
||||
const handleIncomingPcm = useCallback(
|
||||
(data: { userId: string; pcm: string }) => {
|
||||
@@ -57,13 +57,12 @@ export function useAudioPlayback() {
|
||||
source.connect(audioContext.destination);
|
||||
|
||||
// Schedule playback per user to avoid overlaps
|
||||
const userIdHash = parseInt(data.userId, 10);
|
||||
const currentTime = audioContext.currentTime;
|
||||
let nextStart = userTimelinesRef.current.get(userIdHash) || 0;
|
||||
let nextStart = userTimelinesRef.current.get(data.userId) || 0;
|
||||
if (nextStart < currentTime) nextStart = currentTime + 0.05;
|
||||
source.start(nextStart);
|
||||
userTimelinesRef.current.set(
|
||||
userIdHash,
|
||||
data.userId,
|
||||
nextStart + audioBuffer.duration,
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user