pub trait VoiceGatewayManager: Send + Sync {
    // Required methods
    fn initialise<'life0, 'async_trait>(
        &'life0 self,
        shard_count: u32,
        user_id: UserId
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn register_shard<'life0, 'async_trait>(
        &'life0 self,
        shard_id: u32,
        sender: Sender<ShardRunnerMessage>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn deregister_shard<'life0, 'async_trait>(
        &'life0 self,
        shard_id: u32
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: '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 Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: '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 Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Available on crate features voice and gateway 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§

source

fn initialise<'life0, 'async_trait>( &'life0 self, shard_count: u32, user_id: UserId ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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.

source

fn register_shard<'life0, 'async_trait>( &'life0 self, shard_id: u32, sender: Sender<ShardRunnerMessage> ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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.

source

fn deregister_shard<'life0, 'async_trait>( &'life0 self, shard_id: u32 ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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.

source

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 Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handler for VOICE_SERVER_UPDATE messages.

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

source

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 Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handler for VOICE_STATE_UPDATE messages.

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

Implementors§