Add documentation for event handler

Signed-off-by: trivernis <trivernis@protonmail.com>
main
trivernis 4 years ago
parent e687477877
commit d7c84a2d26
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -29,6 +29,19 @@ impl<T> EventCallback<T> {
}
/// A handler for raw serenity events
/// ```
/// use serenity_rich_interaction::events::RichEventHandler;
/// use serenity::model::event;
/// use serenity::client::Client;
///
/// let mut handler = RichEventHandler::default();
/// handler.add_event(|ctx, e: &event::ReadyEvent| Box::pin(async move {
/// println!("Ready event received");
/// Ok(())
/// }));
/// let client = Client::builder("TOKEN").raw_event_handler(handler).await?;
/// // ...
/// ```
pub struct RichEventHandler {
callbacks: HashMap<TypeId, Vec<Box<dyn Any + Send + Sync>>>,
}

Loading…
Cancel
Save