mirror of
https://github.com/supleed2/nanobot.git
synced 2024-11-10 04:35:48 +00:00
Add messages in AU_CH for autoverification
And logging when verified
This commit is contained in:
parent
3005c26096
commit
d501512ff2
|
@ -235,7 +235,26 @@ pub(crate) async fn login_6(
|
||||||
.components(|c| c)
|
.components(|c| c)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.await?
|
.await?;
|
||||||
|
println!(
|
||||||
|
"{} ({}) added via login{}",
|
||||||
|
m.user.name,
|
||||||
|
m.user.id,
|
||||||
|
if fresher { " (fresher)" } else { "" }
|
||||||
|
);
|
||||||
|
data.au_ch_id
|
||||||
|
.send_message(&ctx.http, |cm| {
|
||||||
|
cm.add_embed(|e| {
|
||||||
|
e.thumbnail(m.user.avatar_url().unwrap_or(
|
||||||
|
"https://cdn.discordapp.com/embed/avatars/0.png".to_string(),
|
||||||
|
))
|
||||||
|
.title("Member verified via login")
|
||||||
|
.description(&m.user)
|
||||||
|
.field("Fresher", fresher, true)
|
||||||
|
.timestamp(serenity::Timestamp::now())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.await?;
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("Error: {e}");
|
eprintln!("Error: {e}");
|
||||||
|
|
|
@ -223,6 +223,7 @@ pub(crate) async fn manual_4(
|
||||||
.await
|
.await
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
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(()) => {
|
||||||
let fresher = crate::db::get_member_by_id(&data.db, user.id.0 as i64)
|
let fresher = crate::db::get_member_by_id(&data.db, user.id.0 as i64)
|
||||||
|
@ -238,12 +239,12 @@ pub(crate) async fn manual_4(
|
||||||
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.title(format!(
|
e.thumbnail(m.user.avatar_url().unwrap_or(
|
||||||
"Verification {} for",
|
"https://cdn.discordapp.com/embed/avatars/0.png".to_string(),
|
||||||
if verify { "accepted" } else { "denied" },
|
|
||||||
))
|
))
|
||||||
|
.title("Member verified via manual")
|
||||||
.description(&user)
|
.description(&user)
|
||||||
.thumbnail(user.avatar_url().unwrap_or_default())
|
.field("Fresher", fresher, true)
|
||||||
.timestamp(serenity::Timestamp::now())
|
.timestamp(serenity::Timestamp::now())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -261,6 +262,23 @@ pub(crate) async fn manual_4(
|
||||||
.await?
|
.await?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
println!("{} ({}) denied via manual", m.user.name, m.user.id);
|
||||||
|
m.create_interaction_response(&ctx.http, |i| {
|
||||||
|
i.kind(serenity::InteractionResponseType::UpdateMessage)
|
||||||
|
.interaction_response_data(|d| {
|
||||||
|
d.components(|c| c).embed(|e| {
|
||||||
|
e.title("Member denied via manual")
|
||||||
|
.description(&user)
|
||||||
|
.thumbnail(user.avatar_url().unwrap_or(
|
||||||
|
"https://cdn.discordapp.com/embed/avatars/0.png".to_string(),
|
||||||
|
))
|
||||||
|
.timestamp(serenity::Timestamp::now())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.await?
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,6 +162,25 @@ 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
|
||||||
|
.send_message(&ctx.http, |cm| {
|
||||||
|
cm.add_embed(|e| {
|
||||||
|
e.thumbnail(m.user.avatar_url().unwrap_or(
|
||||||
|
"https://cdn.discordapp.com/embed/avatars/0.png".to_string(),
|
||||||
|
))
|
||||||
|
.title("Member verified via membership")
|
||||||
|
.description(&m.user)
|
||||||
|
.field("Fresher", fresher, true)
|
||||||
|
.timestamp(serenity::Timestamp::now())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.await?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue