stat_summoner/
interactions.rs1use crate::models::data::Data;
2use crate::models::error::Error;
3use crate::module::askingforflex::interaction_flex_buttons::handle_interaction_button_flex;
4use crate::module::suggestions::interaction_black_list::handle_interaction_button_black_list;
32use poise::serenity_prelude::Interaction;
33
34pub async fn handle_button_click(
35 ctx: poise::serenity_prelude::Context,
36 interaction: Interaction,
37 ctx_data: &Data,
38) -> Result<(), Error> {
39 if let Some(message_component_interaction) = interaction.message_component() {
40 let http = ctx.http.clone();
41 message_component_interaction.defer(http).await?;
42 let custom_id = &message_component_interaction.data.custom_id;
43
44 if custom_id.starts_with("blacklist_user:") {
45 handle_interaction_button_black_list(ctx, message_component_interaction, ctx_data)
46 .await?;
47 } else if custom_id.starts_with("flex_user:") {
48 handle_interaction_button_flex(ctx, message_component_interaction, ctx_data).await?;
49 }
50 }
51 Ok(())
52}