Connection
ruvyrias / Connection
Class: Connection
Defined in: src/Connection.ts:8
Manages the connection between the player and an external source.
Constructors
Constructor
new Connection(
player
):Connection
Defined in: src/Connection.ts:22
The connection class
Parameters
player
Returns
Connection
Properties
channel_id
channel_id:
null
|string
Defined in: src/Connection.ts:13
endpoint
endpoint:
null
|string
Defined in: src/Connection.ts:16
player
readonly
player:Player
Defined in: src/Connection.ts:9
region
region:
null
|string
Defined in: src/Connection.ts:10
self_deaf
self_deaf:
boolean
Defined in: src/Connection.ts:12
self_mute
self_mute:
boolean
Defined in: src/Connection.ts:11
session_id
session_id:
null
|string
Defined in: src/Connection.ts:14
token
token:
null
|string
Defined in: src/Connection.ts:15
Methods
updateVoiceServer()
updateVoiceServer(
data
):Promise
<void
>
Defined in: src/Connection.ts:41
Handles updates from the voice server, setting connection properties and notifying the player node with the new voice session information.
Parameters
data
Object containing the voice server endpoint and token.
Returns
Promise
<void
>
Resolves when the player node has been updated.
Throws
If the endpoint is missing from the voice server data.
updateVoiceState()
updateVoiceState(
data
):Promise
<void
>
Defined in: src/Connection.ts:76
Handles updates from the voice state, updating the connection's session, channel, and mute/deaf status. Stops the player if the bot is removed from the voice channel and updates the player's voice channel ID if it changed.
Parameters
data
Object containing session ID, channel ID, self-mute, and self-deaf status.
Returns
Promise
<void
>
Resolves after updating the connection state.