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.
Properties
Section titled “Properties”| 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 |
- |
Methods
Section titled “Methods”join()
Section titled “join()”join(
channelId,options?):Promise<void>
Joins or moves to channelId, sending the requested voice state; resolves after acknowledgement.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
channelId |
string |
options? |
JoinOptions |
Returns
Section titled “Returns”Promise<void>
rejoin()
Section titled “rejoin()”rejoin():
Promise<void>
Leaves and rejoins the current channel; resolves after the connected event with the fresh credentials.
Returns
Section titled “Returns”Promise<void>
release()
Section titled “release()”release():
Promise<void>
Leaves the channel once; every caller shares that completion. Later join, setSelfState and rejoin reject.
Returns
Section titled “Returns”Promise<void>
setSelfState()
Section titled “setSelfState()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
state |
JoinOptions |
Returns
Section titled “Returns”Promise<void>
subscribe()
Section titled “subscribe()”subscribe(
listener): () =>void
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
listener |
(event) => void |
Returns
Section titled “Returns”() => void
voiceClosed()
Section titled “voiceClosed()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
code |
number |
Returns
Section titled “Returns”void