chore(auto): task completed - unknown

This commit is contained in:
MythEclipse
2026-06-13 14:24:09 +07:00
parent 1a195b737e
commit e6e34281ff
9 changed files with 184 additions and 61 deletions
+33
View File
@@ -48,10 +48,43 @@ export default function App() {
[monitorGuildId, voice.guilds],
);
// Update speaker list from incremental voice_active_user events
const updateSpeakerList = (
prev: ActiveSpeaker[],
data: Partial<ActiveSpeaker> & { userId?: string; id?: string; speaking: boolean },
): ActiveSpeaker[] => {
const key = data.userId ?? data.id;
if (!key) return prev;
const idx = prev.findIndex(
(s) => (s.userId ?? s.id) === key,
);
if (idx >= 0) {
const next = [...prev];
next[idx] = { ...next[idx], ...data };
return next;
}
return [...prev, data as ActiveSpeaker];
};
const socket = useDashboardSocket({
onVoicePcmData: (d) =>
audio.handleIncomingPcm(d as { userId: string; pcm: string }),
onUserState: (users) => setActiveSpeakers(users as ActiveSpeaker[]),
onVoiceActiveUser: (data) =>
setActiveSpeakers((prev) =>
updateSpeakerList(
prev,
data as Partial<ActiveSpeaker> & {
userId?: string;
id?: string;
speaking: boolean;
},
),
),
onVoiceRecordingStarted: () =>
window.dispatchEvent(new CustomEvent("voice_recording_uploaded")),
onVoiceRecordingStopped: () =>
window.dispatchEvent(new CustomEvent("voice_recording_uploaded")),
onMessageCreated: (m) =>
messages.setMessages((prev) => mergeMessages(prev, [m as MessageRecord])),
onMessageUpdated: (m) => {