pub trait Handler: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn check_update(&self, ctx: &Context) -> bool;
fn handle_update<'life0, 'async_trait>(
&'life0 self,
bot: Bot,
ctx: Context,
) -> Pin<Box<dyn Future<Output = HandlerResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Core trait every handler implements.
Required Methods§
Sourcefn check_update(&self, ctx: &Context) -> bool
fn check_update(&self, ctx: &Context) -> bool
Return true if this handler should process the update. Keep it cheap.
Sourcefn handle_update<'life0, 'async_trait>(
&'life0 self,
bot: Bot,
ctx: Context,
) -> Pin<Box<dyn Future<Output = HandlerResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_update<'life0, 'async_trait>(
&'life0 self,
bot: Bot,
ctx: Context,
) -> Pin<Box<dyn Future<Output = HandlerResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Run the handler. Return Err(ContinueGroups) or Err(EndGroups) to change dispatch flow.