VoiceManager
Manages voice connections. Use `getVoiceManager(client)` to obtain an instance.
Extends EventEmitter
Constructor
(client: Client, options: VoiceManagerOptions)| Param | Type | Description |
|---|---|---|
| client | Client | |
| options | VoiceManagerOptions |
Properties
: Client (readonly): Map<string, string> (readonly)channel_id -> connection_id (from VoiceServerUpdate; required for voice state updates)
: Collection<string, VoiceConnection | LiveKitRtcConnection> (readonly)channel_id -> connection (Fluxer multi-channel: allows multiple connections per guild)
: Map<string, { channel: VoiceChannel; resolve: (c: VoiceConnection | LiveKitRtcConnection) => void; reject: (e: Error) => void; server?: GatewayVoiceServerUpdateDispatchData | undefined; state?: GatewayVoiceStateUpdateDispatchData | undefined; }> (readonly)channel_id -> pending join
: VoiceStateMap (readonly)guild_id -> user_id -> channel_id
Methods
(channelOrGuildId: string): VoiceConnection | LiveKitRtcConnection | undefinedGet the active voice connection for a channel or guild.
| Param | Type | Description |
|---|---|---|
| channelOrGuildId | string | Channel ID (primary) or guild ID (returns first connection in that guild) |
(guildId: string, userId: string): string | nullGet the voice channel ID the user is currently in, or null if not in voice.
| Param | Type | Description |
|---|---|---|
| guildId | string | Guild ID to look up |
| userId | string | User ID to look up |
(data: GatewayVoiceServerUpdateDispatchData): void| Param | Type | Description |
|---|---|---|
| data | GatewayVoiceServerUpdateDispatchData |
(data: { guildId: string; voiceStates: Array<{ user_id: string; channel_id: string | null; }>; }): void| Param | Type | Description |
|---|---|---|
| data | { guildId: string; voiceStates: Array<{ user_id: string; channel_id: string | null; }>; } |
(data: GatewayVoiceStateUpdateDispatchData): void| Param | Type | Description |
|---|---|---|
| data | GatewayVoiceStateUpdateDispatchData |
(channel: VoiceChannel): Promise<VoiceConnection | LiveKitRtcConnection>Join a voice channel. Resolves when the connection is ready. Supports multiple connections per guild (Fluxer multi-channel).
| Param | Type | Description |
|---|---|---|
| channel | VoiceChannel | The voice channel to join |
(guildId: string): voidLeave all voice channels in a guild. With multi-channel support, disconnects from every channel in the guild.
| Param | Type | Description |
|---|---|---|
| guildId | string | Guild ID to leave |
(channelId: string): voidLeave a specific voice channel by channel ID.
| Param | Type | Description |
|---|---|---|
| channelId | string | Channel ID to leave |
(guildId: string, channelId: string): string[]List participant user IDs currently in a specific voice channel.
| Param | Type | Description |
|---|---|---|
| guildId | string | |
| channelId | string |
(channelId: string, conn: VoiceConnection | LiveKitRtcConnection): void| Param | Type | Description |
|---|---|---|
| channelId | string | |
| conn | VoiceConnection | LiveKitRtcConnection |
(channelId: string, connectionId: string | null | undefined): void| Param | Type | Description |
|---|---|---|
| channelId | string | |
| connectionId | string | null | undefined |
(channelId: string, opts?: { autoResubscribe?: boolean; }): LiveKitReceiveSubscription[]Subscribe to inbound audio for all known participants currently in a voice channel. Only supported for LiveKit connections.
| Param | Type | Description |
|---|---|---|
| channelId | string | |
| opts? | { autoResubscribe?: boolean; } |
(channelId: string, pending: { channel: VoiceChannel; resolve: (c: VoiceConnection | LiveKitRtcConnection) => void; reject: (e: Error) => void; server?: GatewayVoiceServerUpdateDispatchData; state?: GatewayVoiceStateUpdateDispatchData; }): void| Param | Type | Description |
|---|---|---|
| channelId | string | |
| pending | { channel: VoiceChannel; resolve: (c: VoiceConnection | LiveKitRtcConnection) => void; reject: (e: Error) => void; server?: GatewayVoiceServerUpdateDispatchData; state?: GatewayVoiceStateUpdateDispatchData; } |
(channelId: string, partial: { self_stream?: boolean; self_video?: boolean; self_mute?: boolean; self_deaf?: boolean; }): voidUpdate voice state (e.g. self_stream, self_video) while in a channel. Sends a VoiceStateUpdate to the gateway so the server and clients see the change. Requires connection_id (from VoiceServerUpdate); without it, the gateway would treat the update as a new join and trigger a new VoiceServerUpdate, causing connection loops.
| Param | Type | Description |
|---|---|---|
| channelId | string | Channel ID (connection key) |
| partial | { self_stream?: boolean; self_video?: boolean; self_mute?: boolean; self_deaf?: boolean; } | Partial voice state to update (self_stream, self_video, self_mute, self_deaf) |
(channelId: string, conn: VoiceConnection | LiveKitRtcConnection): Promise<void>Upload a placeholder stream preview so the preview URL returns 200 instead of 404.
| Param | Type | Description |
|---|---|---|
| channelId | string | |
| conn | VoiceConnection | LiveKitRtcConnection |