From d7c84a2d260c7ee014e69950300b0dc1e59c9ac2 Mon Sep 17 00:00:00 2001 From: trivernis Date: Thu, 22 Apr 2021 12:10:19 +0200 Subject: [PATCH] Add documentation for event handler Signed-off-by: trivernis --- src/events/handler.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/events/handler.rs b/src/events/handler.rs index b941412..278d021 100644 --- a/src/events/handler.rs +++ b/src/events/handler.rs @@ -29,6 +29,19 @@ impl EventCallback { } /// 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>>, }