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 }>