Interfaces used to describe voice client implementations.
- class hikari.api.voice.VoiceComponent[source]#
Interface for a voice system implementation.
- abstract property connections: Mapping[hikari.snowflakes.Snowflake, VoiceConnection][source]#
Return a mapping of guild-id to active voice connection.
- abstract async close()[source]#
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
- abstract async connect_to(guild, channel, voice_connection_type, *, deaf=False, mute=False, timeout=5, **kwargs)[source]#
Connect to a given voice channel.
The guild to connect to.
The channel or channel ID to connect to.
The type of voice connection to use. This should be initialized internally using the
True, the client will enter the voice channel deafened (thus unable to hear other users).
True, the client will enter the voice channel muted (thus unable to send audio).
5, The amount of time to wait before erroring when connecting to the voice channel. If timeout is
Nonethere will be no timeout.
If timeout is
None, this function will be awaited forever if an invalid
Any arguments to provide to the
A voice connection implementation of some sort.
- abstract async disconnect(guild)[source]#
Disconnect from a given guild.
The guild to disconnect from.
- class hikari.api.voice.VoiceConnection[source]#
An abstract interface for defining how bots can interact with voice.
Since voice will generally be run in a subprocess to prevent interfering with the bot when performing CPU-bound encoding/encryption, any implementation of this is expected to implement the appropriate mechanisms for communicating with a voice subprocess and controlling it, however, this is left to the discretion of each implementation.
Control is left to the implementation to define how to perform it. The idea is to allow various decoders to be implemented to allow this to direct interface with other types of system outside this library, such as LavaLink, for example.
- abstract property channel_id: hikari.snowflakes.Snowflake[source]#
ID of the voice channel this voice connection is in.
- abstract property guild_id: hikari.snowflakes.Snowflake[source]#
ID of the guild this voice connection is in.
- abstract property owner: VoiceComponent[source]#
Return the component that is managing this connection.
- abstract async classmethod initialize(channel_id, endpoint, guild_id, on_close, owner, session_id, shard_id, token, user_id, **kwargs)[source]#
Initialize and connect the voice connection.
The channel ID that the voice connection is actively connected to.
The voice websocket endpoint to connect to. Will contain the protocol at the start (i.e.
wss://), and end with the correct port (the port and protocol are sanitized since Discord still provide the wrong information four years later).
The guild ID that the websocket should connect to.
A shutdown hook to invoke when closing a connection to ensure the connection is unregistered from the voice component safely.
The component that made this connection object.
The voice session ID to use.
The associated shard ID that the voice connection was generated from.
The voice token to use.
The user ID of the account that just joined the voice channel.
Any implementation-specific arguments to provide to the voice connection that is being initialized.
The type of this connection object.