Trait discord_flows::Bot

source ·
pub trait Bot {
    // Required method
    fn get_token(&self) -> String;

    // Provided methods
    fn listen_to_messages_from_channel<'life0, 'async_trait>(
        &'life0 self,
        channel_id: u64
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn listen_to_application_commands_from_channel<'life0, 'async_trait>(
        &'life0 self,
        channel_id: u64
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn get_client(&self) -> Http { ... }
}

Required Methods§

source

fn get_token(&self) -> String

Provided Methods§

source

fn listen_to_messages_from_channel<'life0, 'async_trait>( &'life0 self, channel_id: u64 ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait,

Create a message listener for Discord bot provided by flows.network

Example
#[tokio::main]
pub async run() {
    let bot = DefaultBot;
    bot.listen_to_messages_from_channel(123456).await;
}
source

fn listen_to_application_commands_from_channel<'life0, 'async_trait>( &'life0 self, channel_id: u64 ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait,

Create a application command listener for Discord bot provided by flows.network

Example
#[tokio::main]
pub async run() {
    let bot = DefaultBot;
    bot.listen_to_application_commands_from_channel(123456).await;
}
source

fn get_client(&self) -> Http

Get a Discord Client as a bot represented by bot_token

Implementors§