From 24ad0f54e457193c25e0f22dd7923f257ef917ef Mon Sep 17 00:00:00 2001 From: trivernis Date: Mon, 25 Apr 2022 20:16:23 +0200 Subject: [PATCH] Rename project to serenity-additions Signed-off-by: trivernis --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 14 +++++++------- src/core.rs | 14 +++++++------- src/events/handler.rs | 9 ++++++--- src/lib.rs | 2 +- 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 522eec2..b8198b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1090,7 +1090,7 @@ dependencies = [ ] [[package]] -name = "serenity-rich-interaction" +name = "serenity-additions" version = "0.3.0" dependencies = [ "dashmap", diff --git a/Cargo.toml b/Cargo.toml index 5e00d07..fb0c1b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "serenity-rich-interaction" +name = "serenity-additions" version = "0.3.0" authors = ["trivernis "] edition = "2018" diff --git a/README.md b/README.md index fedb710..1a7630b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Serenity Rich Interaction +# Serenity Additions This crate provides some types for rich interactions with serenity such as Menus and Ephemeral (self deleting) Messages. @@ -7,12 +7,12 @@ This crate provides some types for rich interactions with serenity such as Menus You have to register the module in the serenity client builder. ```rust use serenity::client::Client; -use serenity_rich_interaction::RegisterRichInteractions; +use serenity_additions::RegisterRichInteractions; #[tokio::main] async fn get_client { // stuff - let client = Client::builder("TOKEN").register_rich_interactions().await?; + let client = Client::builder("TOKEN").register_serenity_additions().await?; // stuff } ``` @@ -25,7 +25,7 @@ use serenity::client::Context; use serenity::model::id::ChannelId; use serenity_rich_interaction::menu::{MenuBuilder, Page}; use std::time::Duration; -use serenity_rich_interaction::Result; +use serenity_additions::Result; pub async fn create_menu( ctx: &Context, @@ -51,9 +51,9 @@ pub async fn create_menu( ## Ephemeral Message ```rust -use serenity_rich_interaction::core::SHORT_TIMEOUT; -use serenity_rich_interaction::ephemeral_message::EphemeralMessage; -use serenity_rich_interaction::Result; +use serenity_additions::core::SHORT_TIMEOUT; +use serenity_additions::ephemeral_message::EphemeralMessage; +use serenity_additions::Result; use serenity::client::Context; use serenity::model::id::ChannelId; diff --git a/src/core.rs b/src/core.rs index dc71b15..de82905 100644 --- a/src/core.rs +++ b/src/core.rs @@ -70,19 +70,19 @@ impl MessageHandle { } } -pub trait RegisterRichInteractions { - fn register_rich_interactions(self) -> Self; - fn register_rich_interactions_with(self, rich_handler: RichEventHandler) -> Self; +pub trait RegisterAdditions { + fn register_serenity_additions(self) -> Self; + fn register_serenity_additions_with(self, rich_handler: RichEventHandler) -> Self; } -impl<'a> RegisterRichInteractions for ClientBuilder<'a> { +impl<'a> RegisterAdditions for ClientBuilder<'a> { /// Registers the rich interactions configuration on the client - fn register_rich_interactions(self) -> Self { - self.register_rich_interactions_with(RichEventHandler::default()) + fn register_serenity_additions(self) -> Self { + self.register_serenity_additions_with(RichEventHandler::default()) } /// Registers the rich interactions with a custom rich event handler - fn register_rich_interactions_with(self, rich_handler: RichEventHandler) -> Self { + fn register_serenity_additions_with(self, rich_handler: RichEventHandler) -> Self { self.type_map_insert::(Arc::new(DashMap::new())) .raw_event_handler(rich_handler) } diff --git a/src/events/handler.rs b/src/events/handler.rs index d21f880..7bf32da 100644 --- a/src/events/handler.rs +++ b/src/events/handler.rs @@ -31,18 +31,21 @@ impl EventCallback { /// A handler for raw serenity events /// ``` -/// use serenity_rich_interaction::events::RichEventHandler; +/// use serenity_additions::events::RichEventHandler; /// use serenity::model::event; /// use serenity::client::Client; -/// use serenity_rich_interaction::RegisterRichInteractions; +/// use serenity_additions::RegisterAdditions; +/// # async fn a() -> serenity_additions::Result<()> { /// /// 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").register_rich_interactions_with(handler).await?; +/// let client = Client::builder("TOKEN").register_serenity_additions_with(handler).await?; /// // ... +/// # unimplemented!() +/// # } /// ``` pub struct RichEventHandler { callbacks: HashMap>>, diff --git a/src/lib.rs b/src/lib.rs index 2fb84a3..8128167 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,5 +5,5 @@ pub mod events; pub mod menu; pub static VERSION: &str = env!("CARGO_PKG_VERSION"); -pub use crate::core::RegisterRichInteractions; +pub use crate::core::RegisterAdditions; pub use error::*;