Skip to content

Commit

Permalink
Remove impl AsRef<serenity::Context>
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed May 23, 2024
1 parent 0f24b17 commit 9ce944f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions examples/feature_showcase/modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<MyModal>(ctx, mci, None, None).await?;
poise::execute_modal_on_component_interaction::<MyModal>(serenity_ctx, mci, None, None)
.await?;
println!("Got data: {:?}", data);
}
Ok(())
Expand Down
6 changes: 3 additions & 3 deletions src/modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ pub async fn execute_modal<U: Send + Sync, E, M: 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<M: Modal>(
ctx: impl AsRef<serenity::Context>,
ctx: &serenity::Context,
interaction: serenity::ComponentInteraction,
defaults: Option<M>,
timeout: Option<std::time::Duration>,
) -> Result<Option<M>, 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,
Expand Down

0 comments on commit 9ce944f

Please sign in to comment.