Skip to content

DiscordVoiceConnection

The DiscordVoiceConnection class handles the voice connection functionalities for Discord-Luau. This class is responsible for managing the lifecycle of a voice connection, handling websocket operations, and ensuring proper communication with Discord’s voice servers.

Properties

voiceWebsocket

DiscordVoiceConnection.voiceWebsocket  :: Network.DiscordWebsocket

voiceUDP

DiscordVoiceConnection.voiceUDP  :: Network.VoiceUDP

reporter

DiscordVoiceConnection.reporter  :: Vendor.Console

heartbeatTask

DiscordVoiceConnection.heartbeatTask  :: thread?

resumeSessionId

DiscordVoiceConnection.resumeSessionId  :: string

heartbeatInterval

DiscordVoiceConnection.heartbeatInterval  :: number

heartbeatAck

DiscordVoiceConnection.heartbeatAck  :: boolean?

heartbeatPing

DiscordVoiceConnection.heartbeatPing  :: number?

heartbeatNonce

DiscordVoiceConnection.heartbeatNonce  :: number?

heartbeatClockTime

DiscordVoiceConnection.heartbeatClockTime  :: number?

encryptionKey

DiscordVoiceConnection.encryptionKey  :: buffer

mediaSessionId

DiscordVoiceConnection.mediaSessionId  :: string

channelId

DiscordVoiceConnection.channelId  :: string

guildId

DiscordVoiceConnection.guildId  :: string

voiceServerUpdate

DiscordVoiceConnection.voiceServerUpdate  :: {
       endpoint: string,
       token: string,
       guildId: string,
    }

voiceStateUpdate

DiscordVoiceConnection.voiceStateUpdate  :: {
      {… sessionId: string …}    }

onEvent

DiscordVoiceConnection.onEvent  :: Vendor.Signal

Methods

observeWebsocketErrors

DiscordVoiceConnection : observeWebsocketErrors (

     self: DiscordVoiceConnection
)  -> ()

Observes and handles errors from the voice websocket.

observeWebsocketOperations

DiscordVoiceConnection : observeWebsocketOperations (

     self: DiscordVoiceConnection
)  -> ()

Observes and handles operations received from the voice websocket.

heartbeatAsync

DiscordVoiceConnection : heartbeatAsync (

     self: DiscordVoiceConnection
     ignoreHeartbeatAck: boolean?
)  -> Vendor.Future

Sends a heartbeat to the voice websocket and manages the heartbeat acknowledgements.

heartbeatIn

DiscordVoiceConnection : heartbeatIn (

     self: DiscordVoiceConnection
     milliseconds: number
)  -> ()

Schedules the next heartbeat to be sent after a specified interval.

connectAsync

DiscordVoiceConnection : connectAsync (

     self: DiscordVoiceConnection
     guildId: string
     channelId: string
)  -> Vendor.Future

Connects to a voice channel asynchronously.

resumeAsync

DiscordVoiceConnection : resumeAsync (

     self: DiscordVoiceConnection
)  -> Vendor.Future

Resumes a voice connection asynchronously.

reconnectAsync

DiscordVoiceConnection : reconnectAsync (

     self: DiscordVoiceConnection
)  -> Vendor.Future

Reconnects to the voice websocket asynchronously.

disconnectAsync

DiscordVoiceConnection : disconnectAsync (

     self: DiscordVoiceConnection
)  -> Vendor.Future

Disconnects from the voice websocket asynchronously.

Functions

new

DiscordVoiceConnection . new (

     discordClient: any
     id: string
)  -> ()

Creates a new instance of DiscordVoiceConnection.