use std::{error::Error, fmt};
use async_trait::async_trait;
use crate::{framework::context::Context, Bot};
#[derive(Debug, Clone, Copy)]
pub struct ContinueGroups;
impl fmt::Display for ContinueGroups {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("ContinueGroups")
}
}
impl Error for ContinueGroups {}
#[derive(Debug, Clone, Copy)]
pub struct EndGroups;
impl fmt::Display for EndGroups {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("EndGroups")
}
}
impl Error for EndGroups {}
pub type HandlerResult = Result<(), Box<dyn Error + Send + Sync>>;
#[async_trait]
pub trait Handler: Send + Sync {
fn name(&self) -> &str;
fn check_update(&self, ctx: &Context) -> bool;
async fn handle_update(&self, bot: Bot, ctx: Context) -> HandlerResult;
}