aboutsummaryrefslogtreecommitdiff
path: root/src/commands/mod.rs
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-01-19 22:31:41 -0600
committerNathan Ringo <nathan@remexre.com>2024-01-19 22:31:41 -0600
commite9ce0f5ca752f044716c17384bd7ef2486d74805 (patch)
treee848073b6e939884bcc607f7182446311122d41e /src/commands/mod.rs
parentd9e3caab5ed77eff9263c416b457f110b1f29ace (diff)
Fix interactions with button responses.
Diffstat (limited to 'src/commands/mod.rs')
-rw-r--r--src/commands/mod.rs22
1 files changed, 7 insertions, 15 deletions
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(())
}
}