Skip to content

hikari.impl.voice#

Implementation of a simple voice management system.

VoiceComponentImpl #

VoiceComponentImpl(app: GatewayBotAware)

Bases: VoiceComponent

A standard voice component management implementation.

This is the regular implementation you will generally use to connect to voice channels with.

connections instance-attribute #

connections: Mapping[Snowflake, VoiceConnection] = MappingProxyType(
    _connections
)

Return a mapping of guild-id to active voice connection.

is_alive property #

is_alive: bool

Whether this component is alive.

close async #

close() -> None

Shut down all connections, waiting for them to terminate.

Once this is done, unsubscribe from any events.

If you simply wish to disconnect every connection, use hikari.api.VoiceComponent.disconnect instead.

connect_to async #

connect_to(
    guild: SnowflakeishOr[PartialGuild],
    channel: SnowflakeishOr[GuildVoiceChannel],
    voice_connection_type: Type[_VoiceConnectionT],
    *,
    deaf: bool = False,
    mute: bool = False,
    timeout: Optional[int] = 5,
    **kwargs: Any
) -> _VoiceConnectionT

Connect to a given voice channel.

PARAMETER DESCRIPTION
guild

The guild to connect to.

TYPE: SnowflakeishOr[Guild]

channel

The channel or channel ID to connect to.

TYPE: SnowflakeishOr[GuildVoiceChannel]

voice_connection_type

The type of voice connection to use. This should be initialized internally using the hikari.api.voice.VoiceConnection.initialize classmethod.

TYPE: Type[VoiceConnection]

deaf

If True, the client will enter the voice channel deafened (thus unable to hear other users).

TYPE: bool DEFAULT: False

mute

If True, the client will enter the voice channel muted (thus unable to send audio).

TYPE: bool DEFAULT: False

timeout

The amount of time, in seconds, to wait before erroring when connecting to the voice channel. If timeout is None there will be no timeout.

Warning

If timeout is None, this function will be awaited forever if an invalid guild_id or channel_id is provided.

TYPE: Optional[int] DEFAULT: 5

**kwargs

Any arguments to provide to the hikari.api.voice.VoiceConnection.initialize method.

TYPE: Any DEFAULT: {}

RETURNS DESCRIPTION
VoiceConnection

A voice connection implementation of some sort.

disconnect async #

disconnect(guild: SnowflakeishOr[PartialGuild]) -> None

Disconnect from a given guild.

PARAMETER DESCRIPTION
guild

The guild to disconnect from.

TYPE: SnowflakeishOr[Guild]

disconnect_all async #

disconnect_all() -> None

Disconnect all the active voice connections.

start #

start() -> None

Start this voice component.