Skip to content

VoiceSession

One guild’s voice presence, which also owns bounded recovery. Only a terminal disconnect reaches core. join, setSelfState and release run one at a time in call order.

Property Type Description
bitrate number The channel bitrate in bits per second.
channelId string The channel the bot’s latest voice state names; the one owner of the voice’s channel.
clientUserId string -
gateway? VoiceGatewayData Current credentials, or undefined until the first connection settles.
guildId string -
selfDeaf boolean -
selfMute boolean -

join(channelId, options?): Promise<void>

Joins or moves to channelId, sending the requested voice state; resolves after acknowledgement.

Parameter Type
channelId string
options? JoinOptions

Promise<void>


release(): Promise<void>

Leaves the channel once; every caller shares that completion. Later join and setSelfState reject.

Promise<void>


setSelfState(state): Promise<void>

Changes only the flags, in the channel the session holds when the write runs; resolves after acknowledgement. Never rebuilds the connection or publishes connected.

Parameter Type
state JoinOptions

Promise<void>


subscribe(listener): () => void

Parameter Type
listener (event) => void

() => void


voiceClosed(code): void

Reports a Discord voice close code from a voice socket outside the session, such as a remote engine’s, and the session recovers. A session that holds its own voice socket ignores it. Does nothing after release started.

Parameter Type
code number

void