Add logging to autoverification

This commit is contained in:
Aadi Desai 2023-09-24 16:04:28 +01:00
parent 655b6447b0
commit aab4b43cc7
Signed by: supleed2
SSH key fingerprint: SHA256:CkbNRs0yVzXEiUp2zd0PSxsfRUMFF9bLlKXtE1xEbKM
3 changed files with 25 additions and 18 deletions

View file

@ -217,6 +217,12 @@ pub(crate) async fn login_6(
.await .await
{ {
Ok(()) => { Ok(()) => {
println!(
"{} ({}) added via login{}",
m.user.name,
m.user.id,
if fresher { " (fresher)" } else { "" }
);
let mut mm = m.member.clone().unwrap(); let mut mm = m.member.clone().unwrap();
crate::verify::apply_role(ctx, &mut mm, data.member).await?; crate::verify::apply_role(ctx, &mut mm, data.member).await?;
if fresher { if fresher {
@ -236,12 +242,6 @@ pub(crate) async fn login_6(
}) })
}) })
.await?; .await?;
println!(
"{} ({}) added via login{}",
m.user.name,
m.user.id,
if fresher { " (fresher)" } else { "" }
);
data.au_ch_id data.au_ch_id
.send_message(&ctx.http, |cm| { .send_message(&ctx.http, |cm| {
cm.add_embed(|e| { cm.add_embed(|e| {

View file

@ -223,6 +223,8 @@ pub(crate) async fn manual_4(
.await .await
.unwrap_or_default(); .unwrap_or_default();
let mut member = data.server.member(&ctx.http, &user).await?;
if verify { if verify {
match crate::db::insert_member_from_manual(&data.db, user.id.0 as i64).await { match crate::db::insert_member_from_manual(&data.db, user.id.0 as i64).await {
Ok(()) => { Ok(()) => {
@ -230,16 +232,21 @@ pub(crate) async fn manual_4(
.await? .await?
.unwrap() .unwrap()
.fresher; .fresher;
let mut mm = m.member.clone().unwrap(); println!(
crate::verify::apply_role(ctx, &mut mm, data.member).await?; "{} ({}) added via manual{}",
user.name,
user.id,
if fresher { " (fresher)" } else { "" }
);
crate::verify::apply_role(ctx, &mut member, data.member).await?;
if fresher { if fresher {
crate::verify::apply_role(ctx, &mut mm, data.fresher).await?; crate::verify::apply_role(ctx, &mut member, data.fresher).await?;
} }
m.create_interaction_response(&ctx.http, |i| { m.create_interaction_response(&ctx.http, |i| {
i.kind(serenity::InteractionResponseType::UpdateMessage) i.kind(serenity::InteractionResponseType::UpdateMessage)
.interaction_response_data(|d| { .interaction_response_data(|d| {
d.components(|c| c).embed(|e| { d.components(|c| c).embed(|e| {
e.thumbnail(m.user.avatar_url().unwrap_or( e.thumbnail(user.avatar_url().unwrap_or(
"https://cdn.discordapp.com/embed/avatars/0.png".to_string(), "https://cdn.discordapp.com/embed/avatars/0.png".to_string(),
)) ))
.title("Member verified via manual") .title("Member verified via manual")
@ -249,7 +256,7 @@ pub(crate) async fn manual_4(
}) })
}) })
}) })
.await? .await?;
} }
Err(e) => { Err(e) => {
eprintln!("Error: {e}"); eprintln!("Error: {e}");
@ -263,7 +270,7 @@ pub(crate) async fn manual_4(
} }
} }
} else { } else {
println!("{} ({}) denied via manual", m.user.name, m.user.id); println!("{} ({}) denied via manual", user.name, user.id);
m.create_interaction_response(&ctx.http, |i| { m.create_interaction_response(&ctx.http, |i| {
i.kind(serenity::InteractionResponseType::UpdateMessage) i.kind(serenity::InteractionResponseType::UpdateMessage)
.interaction_response_data(|d| { .interaction_response_data(|d| {

View file

@ -143,6 +143,12 @@ pub(crate) async fn membership_3(
.await .await
.is_ok() .is_ok()
{ {
println!(
"{} ({}) added via membership{}",
m.user.name,
m.user.id,
if fresher { " (fresher)" } else { "" }
);
let mut mm = m.member.clone().unwrap(); let mut mm = m.member.clone().unwrap();
crate::verify::apply_role(ctx, &mut mm, data.member).await?; crate::verify::apply_role(ctx, &mut mm, data.member).await?;
if fresher { if fresher {
@ -162,12 +168,6 @@ pub(crate) async fn membership_3(
}) })
}) })
.await?; .await?;
println!(
"{} ({}) added via membership{}",
m.user.name,
m.user.id,
if fresher { " (fresher)" } else { "" }
);
data.au_ch_id data.au_ch_id
.send_message(&ctx.http, |cm| { .send_message(&ctx.http, |cm| {
cm.add_embed(|e| { cm.add_embed(|e| {