VoiceConnection

class VoiceConnection(val data: VoiceConnectionData, val gateway: Gateway, val voiceGateway: VoiceGateway, val socket: VoiceUdpSocket, var voiceGatewayConfiguration: VoiceGatewayConfiguration, val streams: Streams, val audioProvider: AudioProvider, val frameInterceptor: FrameInterceptor, val frameSender: AudioFrameSender, val nonceStrategy: NonceStrategy, connectionDetachDuration: Duration)(source)

A VoiceConnection is an adapter that forms the concept of a voice connection, or a connection between you and Discord voice servers.

Parameters

gateway

the Gateway that handles events for the guild this VoiceConnection represents.

voiceGateway

the underlying VoiceGateway for this voice connection.

data

the data representing this VoiceConnection.

voiceGatewayConfiguration

the configuration used on each new connect for the voiceGateway.

audioProvider

a AudioProvider that will provide AudioFrame when required.

frameInterceptor

a FrameInterceptor that will intercept all outgoing AudioFrames.

frameSender

the AudioFrameSender that will handle the sending of audio packets.

nonceStrategy

the NonceStrategy that is used during encryption of audio.

Constructors

Link copied to clipboard
constructor(data: VoiceConnectionData, gateway: Gateway, voiceGateway: VoiceGateway, socket: VoiceUdpSocket, voiceGatewayConfiguration: VoiceGatewayConfiguration, streams: Streams, audioProvider: AudioProvider, frameInterceptor: FrameInterceptor, frameSender: AudioFrameSender, nonceStrategy: NonceStrategy, connectionDetachDuration: Duration)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
suspend fun connect(scope: CoroutineScope = this.scope)

Starts the VoiceGateway for this VoiceConnection. This will begin the process for audio transmission.

Link copied to clipboard
suspend fun disconnect()

Disconnects from the voice servers, does not change the voice state.

Link copied to clipboard
suspend fun leave()

Disconnects from Discord voice servers, and leaves the voice channel.

Link copied to clipboard
suspend fun move(channelId: Snowflake, selfMute: Boolean = false, selfDeaf: Boolean = false)

Sends a gateway command to update the connection in the current guild.

Link copied to clipboard
suspend fun shutdown()

Releases all resources related to this VoiceConnection (except gateway) and then stops its CoroutineScope.