From 6c26be9d3fa6ee092b9e418618596dfdf443097b Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Fri, 10 May 2024 21:42:48 +0100 Subject: [PATCH] Remove impl AsRef --- examples/feature_showcase/modal.rs | 6 ++++-- src/modal.rs | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/feature_showcase/modal.rs b/examples/feature_showcase/modal.rs index 99a7fbaef046..e4f1dbf25c5b 100644 --- a/examples/feature_showcase/modal.rs +++ b/examples/feature_showcase/modal.rs @@ -37,13 +37,15 @@ pub async fn component_modal(ctx: crate::Context<'_>) -> Result<(), Error> { ctx.send(reply).await?; - while let Some(mci) = serenity::ComponentInteractionCollector::new(ctx.serenity_context()) + let serenity_ctx = ctx.serenity_context(); + while let Some(mci) = serenity::ComponentInteractionCollector::new(serenity_ctx) .timeout(std::time::Duration::from_secs(120)) .filter(move |mci| mci.data.custom_id == "open_modal") .await { let data = - poise::execute_modal_on_component_interaction::(ctx, mci, None, None).await?; + poise::execute_modal_on_component_interaction::(serenity_ctx, mci, None, None) + .await?; println!("Got data: {:?}", data); } Ok(()) diff --git a/src/modal.rs b/src/modal.rs index 8d9269be7973..d1edeb69f8e2 100644 --- a/src/modal.rs +++ b/src/modal.rs @@ -120,14 +120,14 @@ pub async fn execute_modal( /// 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. pub async fn execute_modal_on_component_interaction( - ctx: impl AsRef, + ctx: &serenity::Context, interaction: serenity::ComponentInteraction, defaults: Option, timeout: Option, ) -> Result, serenity::Error> { execute_modal_generic( - ctx.as_ref(), - |resp| interaction.create_response(ctx.as_ref(), resp), + ctx, + |resp| interaction.create_response(ctx, resp), interaction.id.to_string(), defaults, timeout,