Skip to content

hikariwave.connection

Connection

ConnectionState

Bases: IntEnum

The voice connection's state.

CONNECTED class-attribute instance-attribute

CONNECTED = 0

Voice connection has established it's voice gateway and voice server connections.

CONNECTING class-attribute instance-attribute

CONNECTING = 1

Voice connection is pending connections with the voice gateway and voice server.

DISCONNECTED class-attribute instance-attribute

DISCONNECTED = 2

Voice connection is not connected to any voice gateway or voice server.

DISCONNECTING class-attribute instance-attribute

DISCONNECTING = 3

Voice connection is pending disconnect with the voice gateway and voice server.

VoiceConnection

VoiceConnection(
    client: VoiceClient,
    guild_id: hikari.Snowflake,
    channel_id: hikari.Snowflake,
    endpoint: str,
    session_id: str,
    token: str,
)

An active connection to a voice channel.

Create a new voice connection.

PARAMETER DESCRIPTION
client

The controlling voice system client managing this connection.

TYPE: VoiceClient

guild_id

The ID of the guild this connection manages.

TYPE: hikari.Snowflake

channel_id

The ID of the voice channel this connection manages.

TYPE: hikari.Snowflake

endpoint

The voice gateway websocket URI.

TYPE: str

session_id

The voice gateway session ID.

TYPE: str

token

The voice gateway token.

TYPE: str

channel_id property

channel_id: hikari.Snowflake

The ID of the voice channel this connection manages.

client property

client: VoiceClient

The controlling voice system client managing this connection.

guild_id property

guild_id: hikari.Snowflake

The ID of the guild this connection manages.

latency property

latency: float | None

The heartbeat latency of the voice gateway connection, if connected.

player property

player: AudioPlayer

The audio player responsible for managing all audio playback.

disconnect async

disconnect() -> None

Disconnect from the current channel.

set_config

set_config(config: Config) -> None

Set this specific connection's configuration.

PARAMETER DESCRIPTION
config

This connection's configuration.

TYPE: Config

RAISES DESCRIPTION
TypeError

If the provided config isn't Config.