Class

VoiceManager

Manages voice connections. Use getVoiceManager(client) to obtain an instance.

Extends EventEmitter

Constructor

new VoiceManager(client: Client, options: VoiceManagerOptions)
client
Client

Properties

NameTypeDescription
clientread-onlyClient
voiceStatesread-onlyVoiceStateMapguild_id -> user_id -> channel_id

Methods

.getVoiceChannelId(guildId, userId)

guildId: string, userId: stringstring | null

Get the voice channel ID the user is currently in, or null if not in voice.

guildId
stringGuild ID to look up
userId
stringUser ID to look up
voiceManager.getVoiceChannelId(guildId, userId);

.leave(guildId)

guildId: stringvoid

Leave all voice channels in a guild. With multi-channel support, disconnects from every channel in the guild.

guildId
stringGuild ID to leave
voiceManager.leave(guildId);

.leaveChannel(channelId)

channelId: stringvoid

Leave a specific voice channel by channel ID.

channelId
stringChannel ID to leave
voiceManager.leaveChannel(channelId);

.updateVoiceState(channelId, partial)

channelId: string, partial: { self_stream?: boolean; self_video?: boolean; self_mute?: boolean; self_deaf?: boolean; }void

Update 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.

channelId
stringChannel 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)
voiceManager.updateVoiceState(channelId, partial);