tulpje_framework/handler/
command_handler.rsuse std::{future::Future, pin::Pin};
use twilight_model::application::command::Command;
use super::super::context::CommandContext;
use crate::Error;
pub(crate) type CommandFunc<T> =
fn(CommandContext<T>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
#[derive(Clone)]
pub struct CommandHandler<T: Clone + Send + Sync> {
pub module: String,
pub definition: Command,
pub func: CommandFunc<T>,
}
impl<T: Clone + Send + Sync> CommandHandler<T> {
pub async fn run(&self, ctx: CommandContext<T>) -> Result<(), Error> {
(self.func)(ctx).await
}
}