From 5588808852a2fd379be0e9c01cf67cfdcbcdd4c3 Mon Sep 17 00:00:00 2001 From: Nathan Ringo Date: Thu, 18 Jan 2024 19:02:16 -0600 Subject: Prepare to output non-single-expr messages. --- src/commands/mod.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/commands/mod.rs') diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 899bb8f..d793c95 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -34,13 +34,31 @@ pub async fn handle_interaction( .await .context("failed to handle discocaml command"), _ => { - log::warn!("unexpected interaction: {:?}", interaction); + log::warn!("unexpected interaction: {:#?}", interaction); Ok(()) } }, + 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(()) + } + } + } _ => { - log::warn!("unexpected interaction: {:?}", interaction); + log::warn!("unexpected interaction: {:#?}", interaction); Ok(()) } } -- cgit v1.2.3