diff --git a/examples/basic_structure/commands.rs b/examples/basic_structure/commands.rs index 376da639e3c2..511609331192 100644 --- a/examples/basic_structure/commands.rs +++ b/examples/basic_structure/commands.rs @@ -28,9 +28,11 @@ pub async fn vote( ctx: Context<'_>, #[description = "What to vote for"] choice: String, ) -> Result<(), Error> { + let data = ctx.data(); + // Lock the Mutex in a block {} so the Mutex isn't locked across an await point let num_votes = { - let mut hash_map = ctx.data().votes.lock().unwrap(); + let mut hash_map = data.votes.lock().unwrap(); let num_votes = hash_map.entry(choice.clone()).or_default(); *num_votes += 1; *num_votes diff --git a/src/modal.rs b/src/modal.rs index b8ad3f4f19aa..71d01c81f34c 100644 --- a/src/modal.rs +++ b/src/modal.rs @@ -82,7 +82,7 @@ async fn execute_modal_generic< /// 1. sends the modal via [`Modal::create()`] /// 2. waits for the user to submit via [`serenity::ModalInteractionCollector`] /// 3. acknowledges the submitted data so that Discord closes the pop-up for the user -/// 4. parses the submitted data via [`Modal::parse()`], wrapping errors in [`serenity::Error::Other`] +/// 4. parses the submitted data via [`Modal::parse()`] /// /// If you need more specialized behavior, you can copy paste the implementation of this function /// and adjust to your needs. The code of this function is just a starting point. @@ -113,7 +113,7 @@ pub async fn execute_modal( /// 1. sends the modal via [`Modal::create()`] as a mci interaction response /// 2. waits for the user to submit via [`serenity::ModalInteractionCollector`] /// 3. acknowledges the submitted data so that Discord closes the pop-up for the user -/// 4. parses the submitted data via [`Modal::parse()`], wrapping errors in [`serenity::Error::Other`] +/// 4. parses the submitted data via [`Modal::parse()`] /// /// If you need more specialized behavior, you can copy paste the implementation of this function /// and adjust to your needs. The code of this function is just a starting point. diff --git a/src/prefix_argument/macros.rs b/src/prefix_argument/macros.rs index 3a86d3884c4f..fa1d0e1942c7 100644 --- a/src/prefix_argument/macros.rs +++ b/src/prefix_argument/macros.rs @@ -178,14 +178,7 @@ to use this macro directly. ```rust,no_run # #[tokio::main] async fn main() -> Result<(), Box> { # use poise::serenity_prelude as serenity; -# let ctx = serenity::Context { -# data: Default::default(), -# shard: todo!(), -# shard_id: todo!(), -# http: std::sync::Arc::new(::serenity::http::Http::new("example")), -# #[cfg(feature = "cache")] -# cache: Default::default(), -# }; +# let ctx = todo!(); # let msg = serenity::CustomMessage::new().build(); assert_eq!(