flow_bot/base/service.rs
1use async_trait::async_trait;
2
3use crate::event::BotEvent;
4
5use super::{context::BotContext, handler::HandlerControl};
6
7#[async_trait]
8pub trait Service: Send + Sync {
9 /// Extractors are not possible to be used in services but you can call [`FromEvent::from_event`] manually.
10 ///
11 /// [`FromEvent::from_event`]: crate::base::extract::FromEvent::from_event
12 async fn serve(&self, context: BotContext, event: BotEvent) -> HandlerControl;
13}