/// This function handles the vote-interactions and the report interaction and
/// calls the appropriate functions for them (logging stuff in the logs)
This function handles the vote-interactions and the report interaction and
calls the appropriate functions for them (logging stuff in the logs)
This function handles the vote - interactions and the report interaction and calls the appropriate functions for them ( logging stuff in the logs )
pub async fn handle_vote_interaction(ctx: &Context, interaction: Interaction) {
    if let Interaction::MessageComponent(mut component) = interaction {
        match component.data.custom_id.as_str() {
            "delete_button" => {
                info!("Delete vote by {}", component.user.tag());
                add_delete_vote(&ctx, component.user.clone(), &mut component.message).await;
            }
            "ban_button" => {
                info!("Ban vote by {}", component.user.tag());
                add_silence_vote(&ctx, component.user.clone(), &mut component.message).await;
            }
            "abuse_button" => {
                info!("Abuse vote by {}", component.user.tag());
                add_abuse_vote(&ctx, component.user.clone(), &mut component.message).await;
            }
            _ => {
                debug!("Unknown interaction: {}", component.data.custom_id);
                return;
            }
        }
        component
            .create_interaction_response(&ctx.http, |r| {
                r.interaction_response_data(|d| d.content("Ilmiannettu"));
                r.kind(DeferredUpdateMessage)
            })
            .await
            .unwrap();
    }
}
pub async fn handle_vote_interaction ( ctx : & Context , interaction : Interaction ) { if let Interaction :: MessageComponent ( mut component ) = interaction { match component . data . custom_id . as_str ( ) { " " => { info ! ( " " component user tag ( ) ) ; add_delete_vote ( & ctx , component . user . clone ( ) , & mut component . message ) . await ; } " " => { info ! ( " " component user tag ( ) ) ; add_silence_vote ( & ctx , component . user . clone ( ) , & mut component . message ) . await ; } " " => { info ! ( " " component user tag ( ) ) ; add_abuse_vote ( & ctx , component . user . clone ( ) , & mut component . message ) . await ; } _ => { debug ! ( " " component data custom_id ) ; return ; } } component . create_interaction_response ( & ctx . http , | r | { r . interaction_response_data ( | d | d . content ( " " ) ) ; r . kind ( DeferredUpdateMessage ) } ) . await . unwrap ( ) ; } }
This function handles the vote-interactions and the report interaction and
calls the appropriate functions for them (logging stuff in the logs)
This function handles the vote - interactions and the report interaction and calls the appropriate functions for them ( logging stuff in the logs )
ctx
&Context
interaction
Interaction