use crate::{async_trait, future, Context, Result}; use serenity::model::channel::Message; /// Hook represents the asynchronous hook that is run on every message. #[async_trait] pub trait Hook: Send + Sync { async fn call(&mut self, ctx: &Context, message: &Message) -> Result<()>; } #[async_trait] impl Hook for T where T: for<'a> FnMut( &'a Context, &'a Message, ) -> std::pin::Pin> + 'a + Send>> + Send + Sync, { async fn call(&mut self, ctx: &Context, message: &Message) -> Result<()> { self(ctx, message).await } }