Skip to content

hikariwave.client

Client

VoiceClient

VoiceClient(
    bot: hikari.GatewayBot, *, config: Config | None = None
)

Voice system implementation for hikari-based gateway applications.

Create a new voice system client.

PARAMETER DESCRIPTION
bot

The hikari-based gateway application to link this voice system with.

TYPE: hikari.GatewayBot

config

If provided, the global configuration settings.

TYPE: Config | None DEFAULT: None

RAISES DESCRIPTION
ClientError

If a voice client is already active in this process.

TypeError
  • If bot is not hikari.GatewayBot.
  • If provided, config is not Config.

bot property

The linked hikari-based gateway application.

connections property

connections: Mapping[GuildID, VoiceConnection]

A live view of all active voice connections.

close async

close() -> None

Disconnect each connection and clean up.

connect async

connect(
    guild_id: hikari.Snowflakeish,
    channel_id: hikari.Snowflakeish,
    *,
    mute: bool = False,
    deaf: bool = True
) -> VoiceConnection

Connect to a voice channel.

PARAMETER DESCRIPTION
guild_id

The ID of the guild to connect to.

TYPE: hikari.Snowflakeish

channel_id

The ID of the voice channel to connect to.

TYPE: hikari.Snowflakeish

mute

If the bot should be muted upon joining the voice channel.

TYPE: bool DEFAULT: False

deaf

If the bot should be deafened upon joining the voice channel.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
VoiceConnection

Once fully connected, the active voice connection to this guild/channel.

RAISES DESCRIPTION
asyncio.TimeoutError

If Discord fails to send a corresponding voice server/state update.

ClientError
  • If the voice client isn't able to open new connections.
  • If an active connection to this guild/channel already exists.
TypeError
  • If guild_id or channel_id are not hikari.Snowflakeish.
  • If mute or deaf are not bool.

disconnect async

disconnect(
    *,
    guild_id: hikari.Snowflakeish | None = None,
    channel_id: hikari.Snowflakeish | None = None
) -> None

Disconnect from a voice channel.

PARAMETER DESCRIPTION
guild_id

If provided, the ID of the guild that is connected.

TYPE: hikari.Snowflakeish | None DEFAULT: None

channel_id

If provided, the ID of the voice channel that is connected.

TYPE: hikari.Snowflakeish | None DEFAULT: None

Note

Either guild_id or channel_id must be provided.

RAISES DESCRIPTION
ClientError

If no active connection to the guild/channel exists.

TypeError

If guild_id or channel_id are not hikari.Snowflakeish.

ValueError

If neither guild_id nor channel_id are provided.

get_connection

get_connection(
    *,
    guild_id: hikari.Snowflakeish | None = None,
    channel_id: hikari.Snowflakeish | None = None
) -> VoiceConnection | None

Get an active voice connection.

PARAMETER DESCRIPTION
guild_id

If provided, the ID of the guild that is connected.

TYPE: hikari.Snowflakeish | None DEFAULT: None

channel_id

If provided, the ID of the voice channel that is connected.

TYPE: hikari.Snowflakeish | None DEFAULT: None

Note

Either guild_id or channel_id must be provided.

RETURNS DESCRIPTION
VoiceConnection | None

If found, the active voice connection to the guild/channel.

RAISES DESCRIPTION
TypeError

If guild_id or channel_id are not hikari.Snowflakeish.

ValueError

If neither guild_id nor channel_id are provided.

move async

move(
    new_channel_id: hikari.Snowflakeish,
    *,
    guild_id: hikari.Snowflakeish | None = None,
    old_channel_id: hikari.Snowflakeish | None = None,
    mute: bool = False,
    deaf: bool = True
) -> VoiceConnection

Move to another voice channel (disconnect from old, connect to new).

PARAMETER DESCRIPTION
new_channel_id

The ID of the new voice channel to move to (connect).

TYPE: hikari.Snowflakeish

guild_id

If provided, the ID of the guild of the connection.

TYPE: hikari.Snowflakeish | None DEFAULT: None

old_channel_id

If provided, the ID of the old voice channel to move from (disconnect).

TYPE: hikari.Snowflakeish | None DEFAULT: None

mute

If the bot should be muted upon moving channels.

TYPE: bool | None DEFAULT: False

deaf

If the bot should be deafened upon moving channels.

TYPE: bool | None DEFAULT: True

Note

Either guild_id or old_channel_id must be provided.

RETURNS DESCRIPTION
VoiceConnection

Once fully connected, the active voice connection to this guild/new channel.

RAISES DESCRIPTION
asyncio.TimeoutError

If Discord fails to send a corresponding voice server/state update.

ClientError
  • If the voice client isn't able to open new connections.
  • If no active voice connection already exists.
TypeError
  • If new_channel_id, guild_id, or old_channel_id are not hikari.Snowflakeish.
  • If mute or deaf are not bool.
ValueError

If neither of guild_id nor old_channel_id are provided.