pub trait VoiceGatewayManager: Send + Sync {
    fn initialise<'life0, 'async_trait>(
        &'life0 self,
        shard_count: u64,
        user_id: UserId
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn register_shard<'life0, 'async_trait>(
        &'life0 self,
        shard_id: u64,
        sender: Sender<InterMessage>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn deregister_shard<'life0, 'async_trait>(
        &'life0 self,
        shard_id: u64
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn server_update<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        guild_id: GuildId,
        endpoint: &'life1 Option<String>,
        token: &'life2 str
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        Self: 'async_trait
; fn state_update<'life0, 'life1, 'async_trait>(
        &'life0 self,
        guild_id: GuildId,
        voice_state: &'life1 VoiceState
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; }
Available on crate features client and voice only.
Expand description

Interface for any compatible voice plugin.

This interface covers several serenity-specific hooks, as well as packet handlers for voice-specific gateway messages.

Required Methods

Performs initial setup at the start of a connection to Discord.

This will only occur once, and provides the bot’s ID and shard count.

Handler fired in response to a Ready event.

This provides the voice plugin with a channel to send gateway messages to Discord, once per active shard.

Handler fired in response to a disconnect, reconnection, or rebalance.

This event invalidates the last sender associated with shard_id. Unless the bot is fully disconnecting, this is often followed by a call to Self::register_shard. Users may wish to buffer manually any gateway messages sent between these calls.

Handler for VOICE_SERVER_UPDATE messages.

These contain the endpoint and token needed to form a voice connection session.

Handler for VOICE_STATE_UPDATE messages.

These contain the session ID needed to form a voice connection session.

Implementors