Skip to content

Commit

Permalink
Don't panic on modal timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
kangalio committed Dec 5, 2022
1 parent 6778130 commit 7015c2b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ pub async fn execute_modal<U: Send + Sync, E, M: Modal>(
let response = serenity::CollectModalInteraction::new(&ctx.serenity_context.shard)
.filter(move |d| d.data.custom_id == interaction_id)
.timeout(timeout.unwrap_or(std::time::Duration::from_secs(3600)))
.await
.unwrap();
.await;
let response = match response {
Some(x) => x,
None => return Ok(None),
};

// Send acknowledgement so that the pop-up is closed
response
Expand Down

0 comments on commit 7015c2b

Please sign in to comment.