tulpje_framework/handler/
component_interaction_handler.rsuse std::{future::Future, pin::Pin};
use super::super::context::ComponentInteractionContext;
use crate::Error;
pub(crate) type ComponentInteractionFunc<T> =
fn(ComponentInteractionContext<T>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
#[derive(Clone)]
pub struct ComponentInteractionHandler<T: Clone + Send + Sync> {
pub module: String,
pub custom_id: String,
pub func: ComponentInteractionFunc<T>,
}
impl<T: Clone + Send + Sync> ComponentInteractionHandler<T> {
pub async fn run(&self, ctx: ComponentInteractionContext<T>) -> Result<(), Error> {
(self.func)(ctx).await
}
}