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§
Provided Methods§
sourcefn 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_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;
}
sourcefn 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 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;
}
sourcefn get_client(&self) -> Http
fn get_client(&self) -> Http
Get a Discord Client as a bot represented by bot_token