Interfaces used to describe voice client implementations.
- class hikari.api.voice.VoiceComponent#
Interface for a voice system implementation.
- abstract property connections: Mapping[hikari.snowflakes.Snowflake, VoiceConnection]#
Return a mapping of guild-id to active voice connection.
- abstract async close()#
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)#
Connect to a given voice channel.
The guild to connect to.
The channel or channel ID to connect to.
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)#
Disconnect from a given guild.
- abstract async disconnect_all()#
Disconnect all the active voice connections.
- class hikari.api.voice.VoiceConnection#
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#
ID of the voice channel this voice connection is in.
- abstract property guild_id: hikari.snowflakes.Snowflake#
ID of the guild this voice connection is in.
- abstract async disconnect()#
Signal the process to shut down.
- abstract async classmethod initialize(channel_id, endpoint, guild_id, on_close, owner, session_id, shard_id, token, user_id, **kwargs)#
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.
- abstract async join()#
Wait for the process to halt before continuing.
- abstract async notify(event)#
Submit an event to the voice connection to be processed.