From 1577ce38e10d59e62f0c94365e944fc7faca0c34 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Wed, 7 Jan 2026 17:10:36 +0100 Subject: [PATCH] Initial voice chat #42 --- src/lib/auth.ts | 6 ++++++ src/types/protocol.ts | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/lib/auth.ts b/src/lib/auth.ts index d560ff9..032a3e4 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.ts @@ -84,6 +84,12 @@ export default async function auth({ case "authenticated": if (!onIndicator) break; msg.params.indicators.forEach(onIndicator); + if (!onVoiceJoin) break; + Object.entries(msg.params.voice_chat).forEach(([channelId, users]) => + Object.entries(users).forEach(([userId, voiceId]) => + onVoiceJoin(userId, channelId, voiceId) + ) + ); break; case "message_create": diff --git a/src/types/protocol.ts b/src/types/protocol.ts index 577d99c..c06529b 100644 --- a/src/types/protocol.ts +++ b/src/types/protocol.ts @@ -25,7 +25,14 @@ export type ClientMessage = | EnumType<"leave_voice", { channel_id: string }>; export type ServerMessage = - | EnumType<"authenticated", { uuid: string; indicators: IndicatorContext[] }> + | EnumType< + "authenticated", + { + uuid: string; + indicators: IndicatorContext[]; + voice_chat: Record>; + } + > | EnumType<"temp_message", { message: string }> | EnumType<"message_create", Message> | EnumType<"message_update", { message_id: number; contents: string }>