diff options
author | Nathan Ringo <nathan@remexre.com> | 2024-01-18 19:02:16 -0600 |
---|---|---|
committer | Nathan Ringo <nathan@remexre.com> | 2024-01-18 19:02:16 -0600 |
commit | 5588808852a2fd379be0e9c01cf67cfdcbcdd4c3 (patch) | |
tree | 0bd001973612cc858ac391ee009d943b15940393 /src/commands/mod.rs | |
parent | 81fb055292f49a76732c1966874b8d2ad2cb1807 (diff) |
Prepare to output non-single-expr messages.
Diffstat (limited to 'src/commands/mod.rs')
-rw-r--r-- | src/commands/mod.rs | 22 |
1 files changed, 20 insertions, 2 deletions
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(()) } } |