/// This function handles the press off the "abuse_button"
/// If the vote-goal is reached, the user will be given a
/// role that prevents them from further abusing the reporting feature
This function handles the press off the "abuse_button"
If the vote-goal is reached, the user will be given a
role that prevents them from further abusing the reporting feature
This function handles the press off the " abuse_button " If the vote - goal is reached the user will be given a role that prevents them from further abusing the reporting feature
async fn add_abuse_vote(ctx: &Context, voter: User, message: &mut Message) {
    let db = ctx.get_db().await;
    let event = db.get_voting_event(message.id.0).await.unwrap();
    if event.block_reporter_votes == event.block_reporter_votes_required {
        return;
    }
    if db
        .add_vote(event.vote_message_id, voter.id.0, 2)
        .await
        .unwrap()
        == 0
    {
        return;
    }
    let event = db.get_voting_event(message.id.0).await.unwrap();
    if event.block_reporter_votes == event.block_reporter_votes_required {
        let guild_id: u64 = env::var("GUILD_ID")
            .expect("Expected GUILD_ID in .env")
            .parse()
            .expect("Invalid GUILD_ID provided");
        let abuse_role: u64 = env::var("NO_REPORTS_ROLE_ID")
            .expect("Expected NO_REPORTS_ROLE_ID in .env")
            .parse()
            .expect("Invalid NO_REPORTS_ROLE_ID provided");
        let mut member = ctx
            .http
            .get_member(guild_id, event.reporter_id as u64)
            .await
            .unwrap();
        member.add_role(&ctx.http, abuse_role).await.unwrap();
    }
    update_voting_message(ctx, event.vote_message_id as u64).await;
}
async fn add_abuse_vote ( ctx : & Context , voter : User , message : & mut Message ) { let db = ctx . get_db ( ) . await ; let event = db . get_voting_event ( message . id . 0 ) . await . unwrap ( ) ; if event . block_reporter_votes == event . block_reporter_votes_required { return ; } if db . add_vote ( event . vote_message_id , voter . id . 0 , 2 ) . await . unwrap ( ) == 0 { return ; } let event = db . get_voting_event ( message . id . 0 ) . await . unwrap ( ) ; if event . block_reporter_votes == event . block_reporter_votes_required { let guild_id : u64 = env :: var ( " " ) . expect ( " " ) . parse ( ) . expect ( " " ) ; let abuse_role : u64 = env :: var ( " " ) . expect ( " " ) . parse ( ) . expect ( " " ) ; let mut member = ctx . http . get_member ( guild_id , event . reporter_id as u64 ) . await . unwrap ( ) ; member . add_role ( & ctx . http , abuse_role ) . await . unwrap ( ) ; } update_voting_message ( ctx , event . vote_message_id as u64 ) . await ; }
This function handles the press off the "abuse_button"
If the vote-goal is reached, the user will be given a
role that prevents them from further abusing the reporting feature
This function handles the press off the " abuse_button " If the vote - goal is reached the user will be given a role that prevents them from further abusing the reporting feature
ctx
&Context
voter
User
message
&mut Message