From e9ce0f5ca752f044716c17384bd7ef2486d74805 Mon Sep 17 00:00:00 2001 From: Nathan Ringo Date: Fri, 19 Jan 2024 22:31:41 -0600 Subject: Fix interactions with button responses. --- src/commands/mod.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/commands/mod.rs') diff --git a/src/commands/mod.rs b/src/commands/mod.rs index d793c95..f51a3e2 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -39,21 +39,13 @@ pub async fn handle_interaction( } }, Interaction::Component(component) => { - match component - .message - .interaction - .as_ref() - .map(|i| &i.name as &str) - { - Some("discocaml") => { - discocaml::handle_button(ctx, &config.discocaml, db, component) - .await - .context("failed to handle discocaml command") - } - _ => { - log::warn!("unexpected interaction: {:#?}", interaction); - Ok(()) - } + if component.data.custom_id.starts_with("discocaml-") { + discocaml::handle_button(ctx, &config.discocaml, db, component) + .await + .context("failed to handle discocaml command") + } else { + log::warn!("unexpected interaction: {:#?}", interaction); + Ok(()) } } -- cgit v1.2.3