Skip to content

VoiceSession

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

Property Type Description
bitrate number The channel bitrate in bits per second.
channelId string -
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>


rejoin(): Promise<void>

Leaves and rejoins the current channel; resolves after the connected event with the fresh credentials.

Promise<void>


release(): Promise<void>

Leaves the channel once; every caller shares that completion. Later join, setSelfState and rejoin 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 Adapter, such as a remote engine’s. The session applies its own recovery policy. Does nothing after release started.

Parameter Type
code number

void