mirror of
https://github.com/supleed2/nanobot.git
synced 2024-12-22 06:05:50 +00:00
Use tracing
macros over (e)println
This commit is contained in:
parent
4fc6a9e59f
commit
f8eee82843
34
Cargo.lock
generated
34
Cargo.lock
generated
|
@ -641,13 +641,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "flume"
|
||||
version = "0.10.14"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577"
|
||||
checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"pin-project",
|
||||
"spin 0.9.8",
|
||||
]
|
||||
|
||||
|
@ -1313,6 +1312,7 @@ dependencies = [
|
|||
"shuttle-shared-db",
|
||||
"sqlx",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"url",
|
||||
]
|
||||
|
||||
|
@ -2542,9 +2542,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e58421b6bc416714d5115a2ca953718f6c621a51b68e4f4922aea5a4391a721"
|
||||
checksum = "0e50c216e3624ec8e7ecd14c6a6a6370aad6ee5d8cfc3ab30b5162eeeef2ed33"
|
||||
dependencies = [
|
||||
"sqlx-core",
|
||||
"sqlx-macros",
|
||||
|
@ -2555,9 +2555,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-core"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53"
|
||||
checksum = "8d6753e460c998bbd4cd8c6f0ed9a64346fcca0723d6e75e52fdc351c5d2169d"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"atoi",
|
||||
|
@ -2596,9 +2596,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-macros"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "208e3165167afd7f3881b16c1ef3f2af69fa75980897aac8874a0696516d12c2"
|
||||
checksum = "9a793bb3ba331ec8359c1853bd39eed32cdd7baaf22c35ccf5c92a7e8d1189ec"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2609,9 +2609,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-macros-core"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a4a8336d278c62231d87f24e8a7a74898156e34c1c18942857be2acb29c7dfc"
|
||||
checksum = "0a4ee1e104e00dedb6aa5ffdd1343107b0a4702e862a84320ee7cc74782d96fc"
|
||||
dependencies = [
|
||||
"dotenvy",
|
||||
"either",
|
||||
|
@ -2635,9 +2635,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-mysql"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ca69bf415b93b60b80dc8fda3cb4ef52b2336614d8da2de5456cc942a110482"
|
||||
checksum = "864b869fdf56263f4c95c45483191ea0af340f9f3e3e7b4d57a61c7c87a970db"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"base64 0.21.4",
|
||||
|
@ -2677,9 +2677,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-postgres"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0db2df1b8731c3651e204629dd55e52adbae0462fa1bdcbed56a2302c18181e"
|
||||
checksum = "eb7ae0e6a97fb3ba33b23ac2671a5ce6e3cabe003f451abd5a56e7951d975624"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"base64 0.21.4",
|
||||
|
@ -2716,9 +2716,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-sqlite"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be4c21bf34c7cae5b283efb3ac1bcc7670df7561124dc2f8bdc0b59be40f79a2"
|
||||
checksum = "d59dc83cf45d89c555a577694534fcd1b55c545a816c816ce51f20bbe56a4f3f"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"flume",
|
||||
|
|
|
@ -20,10 +20,11 @@ serde = { version = "1.0.188", features = ["derive"] }
|
|||
shuttle-runtime = "0.27.0"
|
||||
shuttle-secrets = "0.27.0"
|
||||
shuttle-shared-db = { version = "0.27.0", features = ["postgres"] }
|
||||
sqlx = { version = "0.7.1", features = [
|
||||
sqlx = { version = "0.7.2", features = [
|
||||
"macros",
|
||||
"postgres",
|
||||
"runtime-tokio-native-tls",
|
||||
] }
|
||||
tokio = "1.32.0"
|
||||
tracing = "0.1.37"
|
||||
url = "2.4.1"
|
||||
|
|
154
src/cmds.rs
154
src/cmds.rs
|
@ -3,14 +3,16 @@ use poise::serenity_prelude as serenity;
|
|||
use poise::Modal;
|
||||
|
||||
/// Buttons to (de-)register application commands globally or by guild
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(prefix_command, owners_only)]
|
||||
pub(crate) async fn cmds(ctx: poise::Context<'_, Data, Error>) -> Result<(), Error> {
|
||||
println!("Cmd: ({}) cmds", ctx.author().name);
|
||||
tracing::info!("{}", ctx.author().name);
|
||||
poise::builtins::register_application_commands_buttons(ctx).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Send (customisable) verification introduction message in specified channel
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn setup(
|
||||
ctx: ACtx<'_>,
|
||||
|
@ -35,7 +37,7 @@ pub(crate) async fn setup(
|
|||
text: Option<String>,
|
||||
}
|
||||
|
||||
println!("Cmd: ({}) setup {}", ctx.author().name, channel.name());
|
||||
tracing::info!("{} {}", ctx.author().name, channel.name());
|
||||
|
||||
if let Some(Setup {
|
||||
message,
|
||||
|
@ -73,9 +75,10 @@ pub(crate) async fn setup(
|
|||
}
|
||||
|
||||
/// Get the number of members in the members table
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn count_members(ctx: ACtx<'_>) -> Result<(), Error> {
|
||||
println!("Cmd: ({}) count_members", ctx.author().name);
|
||||
tracing::info!("{}", ctx.author().name);
|
||||
let count = db::count_members(&ctx.data().db).await?;
|
||||
ctx.say(format!("There are {count} entries in the members table"))
|
||||
.await?;
|
||||
|
@ -83,17 +86,14 @@ pub(crate) async fn count_members(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
}
|
||||
|
||||
/// Delete member info by Discord ID
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn delete_member(
|
||||
ctx: ACtx<'_>,
|
||||
id: serenity::Member,
|
||||
remove_roles: Option<bool>,
|
||||
) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) delete_member {}",
|
||||
ctx.author().name,
|
||||
id.user.name,
|
||||
);
|
||||
tracing::info!("{} {}", ctx.author().name, id.user.name,);
|
||||
if db::delete_member_by_id(&ctx.data().db, id.user.id.into()).await? {
|
||||
if remove_roles.unwrap_or(true) {
|
||||
let mut m = id.clone();
|
||||
|
@ -110,6 +110,7 @@ pub(crate) async fn delete_member(
|
|||
}
|
||||
|
||||
/// Print all members in members table
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn get_all_members(ctx: ACtx<'_>) -> Result<(), Error> {
|
||||
#[derive(Modal)]
|
||||
|
@ -119,7 +120,7 @@ pub(crate) async fn get_all_members(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
confirm: String,
|
||||
}
|
||||
|
||||
println!("Cmd: ({}) get_all_members", ctx.author().name);
|
||||
tracing::info!("{}", ctx.author().name);
|
||||
|
||||
if let Some(Confirm { confirm }) = Confirm::execute(ctx).await? {
|
||||
if confirm.to_lowercase().contains("yes") {
|
||||
|
@ -135,7 +136,7 @@ pub(crate) async fn get_all_members(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
.await?;
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Error: {e}");
|
||||
tracing::error!("{e}");
|
||||
ctx.say("Failed to create members db file").await?;
|
||||
}
|
||||
}
|
||||
|
@ -166,13 +167,10 @@ pub(crate) async fn get_member(_ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
}
|
||||
|
||||
/// Get member info by Discord ID
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command, rename = "id")]
|
||||
pub(crate) async fn get_member_by_id(ctx: ACtx<'_>, id: serenity::Member) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) get_member_by_id {}",
|
||||
ctx.author().name,
|
||||
id.user.name,
|
||||
);
|
||||
tracing::info!("{} {}", ctx.author().name, id.user.name,);
|
||||
match db::get_member_by_id(&ctx.data().db, id.user.id.into()).await? {
|
||||
Some(m) => {
|
||||
ctx.say(format!("Member info for {id}:\n```rust\n{m:#?}\n```"))
|
||||
|
@ -184,12 +182,10 @@ pub(crate) async fn get_member_by_id(ctx: ACtx<'_>, id: serenity::Member) -> Res
|
|||
}
|
||||
|
||||
/// Get member info by Shortcode
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command, rename = "shortcode")]
|
||||
pub(crate) async fn get_member_by_shortcode(ctx: ACtx<'_>, shortcode: String) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) get_member_by_shortcode {shortcode}",
|
||||
ctx.author().name
|
||||
);
|
||||
tracing::info!("{} {shortcode}", ctx.author().name);
|
||||
match db::get_member_by_shortcode(&ctx.data().db, &shortcode).await? {
|
||||
Some(m) => {
|
||||
ctx.say(format!(
|
||||
|
@ -206,12 +202,10 @@ pub(crate) async fn get_member_by_shortcode(ctx: ACtx<'_>, shortcode: String) ->
|
|||
}
|
||||
|
||||
/// Get member info by Nickname
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command, rename = "nick")]
|
||||
pub(crate) async fn get_member_by_nickname(ctx: ACtx<'_>, nickname: String) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) get_member_by_nickname {nickname}",
|
||||
ctx.author().name
|
||||
);
|
||||
tracing::info!("{} {nickname}", ctx.author().name);
|
||||
match db::get_member_by_nickname(&ctx.data().db, &nickname).await? {
|
||||
Some(m) => {
|
||||
ctx.say(format!(
|
||||
|
@ -228,12 +222,10 @@ pub(crate) async fn get_member_by_nickname(ctx: ACtx<'_>, nickname: String) -> R
|
|||
}
|
||||
|
||||
/// Get member info by Real Name
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command, rename = "name")]
|
||||
pub(crate) async fn get_member_by_realname(ctx: ACtx<'_>, realname: String) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) get_member_by_realname {realname}",
|
||||
ctx.author().name
|
||||
);
|
||||
tracing::info!("{} {realname}", ctx.author().name);
|
||||
match db::get_member_by_realname(&ctx.data().db, &realname).await? {
|
||||
Some(m) => {
|
||||
ctx.say(format!(
|
||||
|
@ -250,6 +242,7 @@ pub(crate) async fn get_member_by_realname(ctx: ACtx<'_>, realname: String) -> R
|
|||
}
|
||||
|
||||
/// Add a member to the members table
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn add_member(
|
||||
ctx: ACtx<'_>,
|
||||
|
@ -259,8 +252,8 @@ pub(crate) async fn add_member(
|
|||
realname: String,
|
||||
fresher: bool,
|
||||
) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) add_member {}, {shortcode}, {realname}, {nickname}",
|
||||
tracing::info!(
|
||||
"{} {}, {shortcode}, {realname}, {nickname}",
|
||||
ctx.author().name,
|
||||
id.user.name,
|
||||
);
|
||||
|
@ -285,6 +278,7 @@ pub(crate) async fn add_member(
|
|||
}
|
||||
|
||||
/// Manually add member to members table from pending table
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn insert_member_from_pending(
|
||||
ctx: ACtx<'_>,
|
||||
|
@ -292,11 +286,7 @@ pub(crate) async fn insert_member_from_pending(
|
|||
nickname: String,
|
||||
fresher: bool,
|
||||
) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) insert_member_from_pending {}",
|
||||
ctx.author().name,
|
||||
id.user.name,
|
||||
);
|
||||
tracing::info!("{} {}", ctx.author().name, id.user.name,);
|
||||
match db::insert_member_from_pending(&ctx.data().db, id.user.id.into(), &nickname, fresher)
|
||||
.await
|
||||
{
|
||||
|
@ -310,16 +300,13 @@ pub(crate) async fn insert_member_from_pending(
|
|||
}
|
||||
|
||||
/// Manually add member to members table from manual table
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn insert_member_from_manual(
|
||||
ctx: ACtx<'_>,
|
||||
id: serenity::Member,
|
||||
) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) insert_member_from_manual {}",
|
||||
ctx.author().name,
|
||||
id.user.name,
|
||||
);
|
||||
tracing::info!("{} {}", ctx.author().name, id.user.name,);
|
||||
match db::insert_member_from_manual(&ctx.data().db, id.user.id.into()).await {
|
||||
Ok(()) => {
|
||||
ctx.say(format!("Member moved from manual to members table: {id}"))
|
||||
|
@ -345,16 +332,14 @@ pub(crate) async fn edit_member(_ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
}
|
||||
|
||||
/// Edit member Shortcode
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command, rename = "shortcode")]
|
||||
pub(crate) async fn edit_member_shortcode(
|
||||
ctx: ACtx<'_>,
|
||||
id: serenity::Member,
|
||||
shortcode: String,
|
||||
) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) edit_member_shortcode {shortcode}",
|
||||
ctx.author().name
|
||||
);
|
||||
tracing::info!("{} {shortcode}", ctx.author().name);
|
||||
if db::edit_member_shortcode(&ctx.data().db, id.user.id.into(), &shortcode).await? {
|
||||
ctx.say(format!("{id} Shortcode updated to {shortcode}"))
|
||||
.await?;
|
||||
|
@ -366,16 +351,14 @@ pub(crate) async fn edit_member_shortcode(
|
|||
}
|
||||
|
||||
/// Edit member Nickname
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command, rename = "nick")]
|
||||
pub(crate) async fn edit_member_nickname(
|
||||
ctx: ACtx<'_>,
|
||||
id: serenity::Member,
|
||||
nickname: String,
|
||||
) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) edit_member_nickname {nickname}",
|
||||
ctx.author().name
|
||||
);
|
||||
tracing::info!("{} {nickname}", ctx.author().name);
|
||||
if db::edit_member_nickname(&ctx.data().db, id.user.id.into(), &nickname).await? {
|
||||
ctx.say(format!("{id} Nick updated to {nickname}")).await?;
|
||||
} else {
|
||||
|
@ -385,16 +368,14 @@ pub(crate) async fn edit_member_nickname(
|
|||
}
|
||||
|
||||
/// Edit member Real Name
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command, rename = "name")]
|
||||
pub(crate) async fn edit_member_realname(
|
||||
ctx: ACtx<'_>,
|
||||
id: serenity::Member,
|
||||
realname: String,
|
||||
) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) edit_member_realname {realname}",
|
||||
ctx.author().name
|
||||
);
|
||||
tracing::info!("{} {realname}", ctx.author().name);
|
||||
if db::edit_member_realname(&ctx.data().db, id.user.id.into(), &realname).await? {
|
||||
ctx.say(format!("{id} Name updated to {realname}")).await?;
|
||||
} else {
|
||||
|
@ -404,17 +385,14 @@ pub(crate) async fn edit_member_realname(
|
|||
}
|
||||
|
||||
/// Edit member fresher status
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command, rename = "fresher")]
|
||||
pub(crate) async fn edit_member_fresher(
|
||||
ctx: ACtx<'_>,
|
||||
id: serenity::Member,
|
||||
fresher: bool,
|
||||
) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) edit_member_fresher {} {fresher}",
|
||||
ctx.author().name,
|
||||
id.user.name,
|
||||
);
|
||||
tracing::info!("{} {} {fresher}", ctx.author().name, id.user.name,);
|
||||
if db::edit_member_fresher(&ctx.data().db, id.user.id.into(), fresher).await? {
|
||||
ctx.say(format!("{id} Fresher status updated to {fresher}"))
|
||||
.await?;
|
||||
|
@ -426,9 +404,10 @@ pub(crate) async fn edit_member_fresher(
|
|||
}
|
||||
|
||||
/// Set all members to non-freshers
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn set_members_non_fresher(ctx: ACtx<'_>) -> Result<(), Error> {
|
||||
println!("Cmd: ({}) set_members_non_fresher", ctx.author().name);
|
||||
tracing::info!("{}", ctx.author().name);
|
||||
let updated = db::set_members_non_fresher(&ctx.data().db).await?;
|
||||
ctx.say(format!("{updated} updated to non-fresher, removing roles"))
|
||||
.await?;
|
||||
|
@ -440,9 +419,10 @@ pub(crate) async fn set_members_non_fresher(ctx: ACtx<'_>) -> Result<(), Error>
|
|||
}
|
||||
|
||||
/// Get the number of pending members in the pending table
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn count_pending(ctx: ACtx<'_>) -> Result<(), Error> {
|
||||
println!("Cmd: ({}) count_pending", ctx.author().name);
|
||||
tracing::info!("{}", ctx.author().name);
|
||||
let count = db::count_pending(&ctx.data().db).await?;
|
||||
ctx.say(format!("There are {count} entries in the pending table"))
|
||||
.await?;
|
||||
|
@ -450,13 +430,10 @@ pub(crate) async fn count_pending(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
}
|
||||
|
||||
/// Delete pending member info by Discord ID
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn delete_pending(ctx: ACtx<'_>, id: serenity::Member) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) delete_pending {}",
|
||||
ctx.author().name,
|
||||
id.user.name,
|
||||
);
|
||||
tracing::info!("{} {}", ctx.author().name, id.user.name,);
|
||||
if db::delete_pending_by_id(&ctx.data().db, id.user.id.into()).await? {
|
||||
ctx.say(format!("Successfully deleted pending member info for {id}"))
|
||||
.await?
|
||||
|
@ -468,6 +445,7 @@ pub(crate) async fn delete_pending(ctx: ACtx<'_>, id: serenity::Member) -> Resul
|
|||
}
|
||||
|
||||
/// Print all pending members in pending table
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn get_all_pending(ctx: ACtx<'_>) -> Result<(), Error> {
|
||||
#[derive(Modal)]
|
||||
|
@ -477,7 +455,7 @@ pub(crate) async fn get_all_pending(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
confirm: String,
|
||||
}
|
||||
|
||||
println!("Cmd: ({}) get_all_pending", ctx.author().name);
|
||||
tracing::info!("{}", ctx.author().name);
|
||||
|
||||
if let Some(ConfirmPending { confirm }) = ConfirmPending::execute(ctx).await? {
|
||||
if confirm.to_lowercase().contains("yes") {
|
||||
|
@ -493,7 +471,7 @@ pub(crate) async fn get_all_pending(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
.await?;
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Error: {e}");
|
||||
tracing::error!("{e}");
|
||||
ctx.say("Failed to create pending db file").await?;
|
||||
}
|
||||
}
|
||||
|
@ -510,9 +488,10 @@ pub(crate) async fn get_all_pending(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
}
|
||||
|
||||
/// Get pending member info by Discord ID
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn get_pending(ctx: ACtx<'_>, id: serenity::Member) -> Result<(), Error> {
|
||||
println!("Cmd: ({}) get_pending {}", ctx.author().name, id.user.name);
|
||||
tracing::info!("{} {}", ctx.author().name, id.user.name);
|
||||
match db::get_pending_by_id(&ctx.data().db, id.user.id.into()).await? {
|
||||
Some(p) => {
|
||||
ctx.say(format!("Pending info for {id}:\n```rust\n{p:#?}\n```"))
|
||||
|
@ -524,6 +503,7 @@ pub(crate) async fn get_pending(ctx: ACtx<'_>, id: serenity::Member) -> Result<(
|
|||
}
|
||||
|
||||
/// Manually add pending member to pending table
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn add_pending(
|
||||
ctx: ACtx<'_>,
|
||||
|
@ -531,8 +511,8 @@ pub(crate) async fn add_pending(
|
|||
shortcode: String,
|
||||
realname: String,
|
||||
) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) add_pending {}, {shortcode}, {realname}",
|
||||
tracing::info!(
|
||||
"{} {}, {shortcode}, {realname}",
|
||||
ctx.author().name,
|
||||
id.user.name,
|
||||
);
|
||||
|
@ -550,6 +530,7 @@ pub(crate) async fn add_pending(
|
|||
}
|
||||
|
||||
/// Delete all pending members in pending table
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn delete_all_pending(ctx: ACtx<'_>) -> Result<(), Error> {
|
||||
#[derive(Modal)]
|
||||
|
@ -559,7 +540,7 @@ pub(crate) async fn delete_all_pending(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
confirm: String,
|
||||
}
|
||||
|
||||
println!("Cmd: ({}) delete_all_pending", ctx.author().name);
|
||||
tracing::info!("{}", ctx.author().name);
|
||||
|
||||
if let Some(ConfirmPurgePending { confirm }) = ConfirmPurgePending::execute(ctx).await? {
|
||||
if confirm.to_lowercase().contains("yes") {
|
||||
|
@ -578,9 +559,10 @@ pub(crate) async fn delete_all_pending(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
}
|
||||
|
||||
/// Get the number of manual members in the manual table
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn count_manual(ctx: ACtx<'_>) -> Result<(), Error> {
|
||||
println!("Cmd: ({}) count_manual", ctx.author().name);
|
||||
tracing::info!("{}", ctx.author().name);
|
||||
let count = db::count_manual(&ctx.data().db).await?;
|
||||
ctx.say(format!("There are {count} entries in the manual table"))
|
||||
.await?;
|
||||
|
@ -588,13 +570,10 @@ pub(crate) async fn count_manual(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
}
|
||||
|
||||
/// Delete manual member info by Discord ID
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn delete_manual(ctx: ACtx<'_>, id: serenity::Member) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) delete_manual {}",
|
||||
ctx.author().name,
|
||||
id.user.name,
|
||||
);
|
||||
tracing::info!("{} {}", ctx.author().name, id.user.name,);
|
||||
if db::delete_manual_by_id(&ctx.data().db, id.user.id.into()).await? {
|
||||
ctx.say(format!("Successfully deleted manual member info for {id}"))
|
||||
.await?
|
||||
|
@ -606,6 +585,7 @@ pub(crate) async fn delete_manual(ctx: ACtx<'_>, id: serenity::Member) -> Result
|
|||
}
|
||||
|
||||
/// Print all manual members in manual table
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn get_all_manual(ctx: ACtx<'_>) -> Result<(), Error> {
|
||||
#[derive(Modal)]
|
||||
|
@ -615,7 +595,7 @@ pub(crate) async fn get_all_manual(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
confirm: String,
|
||||
}
|
||||
|
||||
println!("Cmd: ({}) get_all_manual", ctx.author().name);
|
||||
tracing::info!("{}", ctx.author().name);
|
||||
|
||||
if let Some(ConfirmManual { confirm }) = ConfirmManual::execute(ctx).await? {
|
||||
if confirm.to_lowercase().contains("yes") {
|
||||
|
@ -631,7 +611,7 @@ pub(crate) async fn get_all_manual(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
.await?;
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Error: {e}");
|
||||
tracing::error!("{e}");
|
||||
ctx.say("Failed to create manual db file").await?;
|
||||
}
|
||||
}
|
||||
|
@ -648,9 +628,10 @@ pub(crate) async fn get_all_manual(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
}
|
||||
|
||||
/// Get manual member info by Discord ID
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn get_manual(ctx: ACtx<'_>, id: serenity::Member) -> Result<(), Error> {
|
||||
println!("Cmd: ({}) get_manual {}", ctx.author().name, id.user.name);
|
||||
tracing::info!("{} {}", ctx.author().name, id.user.name);
|
||||
match db::get_manual_by_id(&ctx.data().db, id.user.id.into()).await? {
|
||||
Some(m) => {
|
||||
ctx.say(format!("Manual info for {id}:\n```rust\n{m:#?}\n```"))
|
||||
|
@ -662,6 +643,7 @@ pub(crate) async fn get_manual(ctx: ACtx<'_>, id: serenity::Member) -> Result<()
|
|||
}
|
||||
|
||||
/// Manually add manual member to manual table
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn add_manual(
|
||||
ctx: ACtx<'_>,
|
||||
|
@ -671,8 +653,8 @@ pub(crate) async fn add_manual(
|
|||
realname: String,
|
||||
fresher: bool,
|
||||
) -> Result<(), Error> {
|
||||
println!(
|
||||
"Cmd: ({}) add_manual {}, {shortcode}, {realname}, {nickname}",
|
||||
tracing::info!(
|
||||
"{} {}, {shortcode}, {realname}, {nickname}",
|
||||
ctx.author().name,
|
||||
id.user.name,
|
||||
);
|
||||
|
@ -692,6 +674,7 @@ pub(crate) async fn add_manual(
|
|||
}
|
||||
|
||||
/// Delete all manual members in manual table
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command)]
|
||||
pub(crate) async fn delete_all_manual(ctx: ACtx<'_>) -> Result<(), Error> {
|
||||
#[derive(Modal)]
|
||||
|
@ -701,7 +684,7 @@ pub(crate) async fn delete_all_manual(ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
confirm: String,
|
||||
}
|
||||
|
||||
println!("Cmd: ({}) delete_all_manual", ctx.author().name);
|
||||
tracing::info!("{}", ctx.author().name);
|
||||
|
||||
if let Some(ConfirmPurgeManual { confirm }) = ConfirmPurgeManual::execute(ctx).await? {
|
||||
if confirm.to_lowercase().contains("yes") {
|
||||
|
@ -729,9 +712,10 @@ pub(crate) async fn whois(_ctx: ACtx<'_>) -> Result<(), Error> {
|
|||
}
|
||||
|
||||
/// (Public) Get member info by Discord ID
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command, rename = "id")]
|
||||
pub(crate) async fn whois_by_id(ctx: ACtx<'_>, id: serenity::Member) -> Result<(), Error> {
|
||||
println!("Cmd: ({}) whois_by_id {}", ctx.author().name, id.user.name);
|
||||
tracing::info!("{} {}", ctx.author().name, id.user.name);
|
||||
match db::get_member_by_id(&ctx.data().db, id.user.id.into()).await? {
|
||||
Some(m) => {
|
||||
ctx.send(|c| c.content(format!("{id}: {}", m.nickname)).ephemeral(true))
|
||||
|
@ -749,9 +733,10 @@ pub(crate) async fn whois_by_id(ctx: ACtx<'_>, id: serenity::Member) -> Result<(
|
|||
}
|
||||
|
||||
/// (Public) Get member info by Nickname (Exact)
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command, rename = "nick")]
|
||||
pub(crate) async fn whois_by_nickname(ctx: ACtx<'_>, nickname: String) -> Result<(), Error> {
|
||||
println!("Cmd: ({}) whois_by_nickname {nickname}", ctx.author().name);
|
||||
tracing::info!("{} {nickname}", ctx.author().name);
|
||||
if let Some(m) = db::get_member_by_nickname(&ctx.data().db, &nickname).await? {
|
||||
ctx.send(|c| {
|
||||
c.content(format!("{nickname}: <@{}>", m.discord_id))
|
||||
|
@ -783,9 +768,10 @@ pub(crate) async fn whois_by_nickname(ctx: ACtx<'_>, nickname: String) -> Result
|
|||
}
|
||||
|
||||
/// (Public) Get member info by Real Name (Exact)
|
||||
#[tracing::instrument(skip_all)]
|
||||
#[poise::command(slash_command, rename = "name")]
|
||||
pub(crate) async fn whois_by_realname(ctx: ACtx<'_>, realname: String) -> Result<(), Error> {
|
||||
println!("Cmd: ({}) whois_by_realname {realname}", ctx.author().name);
|
||||
tracing::info!("{} {realname}", ctx.author().name);
|
||||
if let Some(m) = db::get_member_by_realname(&ctx.data().db, &realname).await? {
|
||||
ctx.send(|c| {
|
||||
c.content(format!("{realname}: <@{}>", m.discord_id))
|
||||
|
|
|
@ -7,6 +7,7 @@ pub struct Member {
|
|||
pub order_no: usize,
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn get_members_list(
|
||||
api_key: &str,
|
||||
url: &str,
|
||||
|
|
|
@ -101,6 +101,7 @@ async fn poise(
|
|||
.parse::<u64>()
|
||||
.expect("SERVER_ID not valid u64")
|
||||
.into();
|
||||
tracing::info!("Secrets loaded");
|
||||
|
||||
// Build Axum Router
|
||||
let router = axum::Router::new().route(
|
||||
|
@ -178,12 +179,12 @@ async fn event_handler(
|
|||
) -> Result<(), Error> {
|
||||
match event {
|
||||
poise::Event::GuildMemberAddition { new_member } => {
|
||||
println!("Member joined:\n{new_member:#?}");
|
||||
tracing::info!("Member joined: {}", new_member.user.name);
|
||||
}
|
||||
poise::Event::InteractionCreate {
|
||||
interaction: serenity::Interaction::MessageComponent(m),
|
||||
} => {
|
||||
println!("Interaction: {} by \"{}\"", m.data.custom_id, m.user.name);
|
||||
tracing::info!("Interaction: {} by {}", m.data.custom_id, m.user.name);
|
||||
match m.data.custom_id.as_str() {
|
||||
"register.global" | "unregister.global" | "register.guild" | "unregister.guild" => {
|
||||
}
|
||||
|
@ -205,7 +206,7 @@ async fn event_handler(
|
|||
"manual_2n" => verify::manual_2(ctx, m, data, false).await?,
|
||||
id if id.starts_with("verify-") => verify::manual_4(ctx, m, data, id).await?,
|
||||
_ => {
|
||||
println!("Unknown interaction, printing:\n{m:#?}");
|
||||
tracing::info!("Unknown interaction, printing:\n{m:#?}");
|
||||
verify::unknown(ctx, m).await?;
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +214,7 @@ async fn event_handler(
|
|||
poise::Event::InteractionCreate {
|
||||
interaction: serenity::Interaction::ModalSubmit(m),
|
||||
} => {
|
||||
println!("Modal submit: {} by \"{}\"", m.data.custom_id, m.user.name);
|
||||
tracing::info!("Modal submit: {} by {}", m.data.custom_id, m.user.name);
|
||||
match m.data.custom_id.as_str() {
|
||||
"login_6f" => verify::login_6(ctx, m, data, true).await?,
|
||||
"login_6n" => verify::login_6(ctx, m, data, false).await?,
|
||||
|
|
|
@ -9,6 +9,7 @@ pub(crate) struct Verify {
|
|||
key: String,
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn verify(
|
||||
pool: sqlx::PgPool,
|
||||
payload: Option<Json<Verify>>,
|
||||
|
@ -36,7 +37,12 @@ pub(crate) async fn verify(
|
|||
.await
|
||||
{
|
||||
Ok(_) => {
|
||||
println!("ID {} added: {}, {}", id, verify.shortcode, verify.fullname);
|
||||
tracing::info!(
|
||||
"ID {} added: {}, {}",
|
||||
id,
|
||||
verify.shortcode,
|
||||
verify.fullname
|
||||
);
|
||||
(StatusCode::OK, "Member added to `pending` database").into_response()
|
||||
}
|
||||
Err(e) => (StatusCode::INTERNAL_SERVER_ERROR, format!("{e}")).into_response(),
|
||||
|
|
|
@ -11,6 +11,7 @@ const LOGIN_INTRO: &str = indoc::indoc! {"
|
|||
You can then complete the remaining details in the next step!
|
||||
"};
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn login_1(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::MessageComponentInteraction,
|
||||
|
@ -51,6 +52,7 @@ const LOGIN_FORM: &str = indoc::indoc! {"
|
|||
The last step is a short form with some extra details
|
||||
"};
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn login_2(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::MessageComponentInteraction,
|
||||
|
@ -58,7 +60,7 @@ pub(crate) async fn login_2(
|
|||
) -> Result<(), Error> {
|
||||
match crate::db::get_pending_by_id(&data.db, m.user.id.into()).await {
|
||||
Err(e) => {
|
||||
eprintln!("Error in login_2: {e}");
|
||||
tracing::error!("{e}");
|
||||
m.create_interaction_response(&ctx.http, |i| {
|
||||
i.kind(serenity::InteractionResponseType::ChannelMessageWithSource)
|
||||
.interaction_response_data(|d| {
|
||||
|
@ -105,6 +107,7 @@ pub(crate) async fn login_2(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn login_3(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::MessageComponentInteraction,
|
||||
|
@ -139,6 +142,7 @@ pub(crate) async fn login_3(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn login_4(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::MessageComponentInteraction,
|
||||
|
@ -177,6 +181,7 @@ struct Nickname {
|
|||
nickname: String,
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn login_5(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::MessageComponentInteraction,
|
||||
|
@ -197,6 +202,7 @@ pub(crate) async fn login_5(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn login_6(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::ModalSubmitInteraction,
|
||||
|
@ -217,7 +223,7 @@ pub(crate) async fn login_6(
|
|||
.await
|
||||
{
|
||||
Ok(()) => {
|
||||
println!(
|
||||
tracing::info!(
|
||||
"{} ({}) added via login{}",
|
||||
m.user.name,
|
||||
m.user.id,
|
||||
|
@ -261,7 +267,7 @@ pub(crate) async fn login_6(
|
|||
}
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Error: {e}");
|
||||
tracing::error!("Error: {e}");
|
||||
m.create_interaction_response(&ctx.http, |i| {
|
||||
i.kind(serenity::InteractionResponseType::ChannelMessageWithSource)
|
||||
.interaction_response_data(|d| {
|
||||
|
@ -274,7 +280,7 @@ pub(crate) async fn login_6(
|
|||
}
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Error: {e}");
|
||||
tracing::error!("{e}");
|
||||
}
|
||||
};
|
||||
Ok(())
|
||||
|
|
|
@ -16,6 +16,7 @@ const MANUAL_INTRO: &str = indoc::indoc! {"
|
|||
First, are you a fresher?
|
||||
"};
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn manual_1(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::MessageComponentInteraction,
|
||||
|
@ -68,6 +69,7 @@ struct Manual {
|
|||
nickname: String,
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn manual_2(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::MessageComponentInteraction,
|
||||
|
@ -92,6 +94,7 @@ pub(crate) async fn manual_2(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn manual_3(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::ModalSubmitInteraction,
|
||||
|
@ -185,7 +188,7 @@ pub(crate) async fn manual_3(
|
|||
.await?;
|
||||
return Ok(());
|
||||
}
|
||||
Err(e) => eprintln!("Error: {e}"),
|
||||
Err(e) => tracing::error!("{e}"),
|
||||
};
|
||||
m.create_interaction_response(&ctx.http, |i| {
|
||||
i.kind(serenity::InteractionResponseType::ChannelMessageWithSource)
|
||||
|
@ -198,6 +201,7 @@ pub(crate) async fn manual_3(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn manual_4(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::MessageComponentInteraction,
|
||||
|
@ -225,7 +229,7 @@ pub(crate) async fn manual_4(
|
|||
.await?
|
||||
.unwrap()
|
||||
.fresher;
|
||||
println!(
|
||||
tracing::info!(
|
||||
"{} ({}) added via manual{}",
|
||||
user.name,
|
||||
user.id,
|
||||
|
@ -253,7 +257,7 @@ pub(crate) async fn manual_4(
|
|||
}
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Error: {e}");
|
||||
tracing::error!("{e}");
|
||||
m.create_interaction_response(&ctx.http, |i| {
|
||||
i.kind(serenity::InteractionResponseType::ChannelMessageWithSource)
|
||||
.interaction_response_data(|d| {
|
||||
|
@ -265,7 +269,7 @@ pub(crate) async fn manual_4(
|
|||
}
|
||||
} else {
|
||||
crate::db::delete_manual_by_id(&data.db, user.id.into()).await?;
|
||||
println!("{} ({}) denied via manual", user.name, user.id);
|
||||
tracing::info!("{} ({}) denied via manual", user.name, user.id);
|
||||
m.create_interaction_response(&ctx.http, |i| {
|
||||
i.kind(serenity::InteractionResponseType::UpdateMessage)
|
||||
.interaction_response_data(|d| {
|
||||
|
|
|
@ -12,6 +12,7 @@ const MEMBERSHIP_INTRO: &str = indoc::indoc! {"
|
|||
First, are you a fresher?
|
||||
"};
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn membership_1(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::MessageComponentInteraction,
|
||||
|
@ -60,6 +61,7 @@ struct Membership {
|
|||
nickname: String,
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn membership_2(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::MessageComponentInteraction,
|
||||
|
@ -87,6 +89,7 @@ pub(crate) async fn membership_2(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn membership_3(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::ModalSubmitInteraction,
|
||||
|
@ -102,7 +105,7 @@ pub(crate) async fn membership_3(
|
|||
let members = match crate::ea::get_members_list(&data.ea_key, &data.ea_url).await {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
eprintln!("Error: {e}");
|
||||
tracing::error!("{e}");
|
||||
m.create_interaction_response(&ctx.http, |i| {
|
||||
i.kind(serenity::InteractionResponseType::ChannelMessageWithSource)
|
||||
.interaction_response_data(|d| {
|
||||
|
@ -140,7 +143,7 @@ pub(crate) async fn membership_3(
|
|||
.await
|
||||
.is_ok()
|
||||
{
|
||||
println!(
|
||||
tracing::info!(
|
||||
"{} ({}) added via membership{}",
|
||||
m.user.name,
|
||||
m.user.id,
|
||||
|
@ -183,7 +186,7 @@ pub(crate) async fn membership_3(
|
|||
return Ok(());
|
||||
}
|
||||
}
|
||||
Err(e) => eprintln!("Error: {e}"),
|
||||
Err(e) => tracing::error!("{e}"),
|
||||
};
|
||||
m.create_interaction_response(&ctx.http, |i| {
|
||||
i.kind(serenity::InteractionResponseType::ChannelMessageWithSource)
|
||||
|
|
|
@ -20,6 +20,7 @@ const INFO_MSG: &str = indoc::indoc! {"
|
|||
If you have any questions, feel free to ping or message <@99217900254035968>
|
||||
"};
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn info(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::MessageComponentInteraction,
|
||||
|
@ -32,6 +33,7 @@ pub(crate) async fn info(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn unknown(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::MessageComponentInteraction,
|
||||
|
@ -54,6 +56,7 @@ const START_MSG: &str = indoc::indoc! {"
|
|||
- 🚗 Manual verification, eg. using College ID Card or Acceptance Letter
|
||||
"};
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn start(
|
||||
ctx: &serenity::Context,
|
||||
m: &serenity::MessageComponentInteraction,
|
||||
|
@ -112,6 +115,7 @@ pub(crate) async fn start(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn apply_role(
|
||||
ctx: &serenity::Context,
|
||||
member: &mut serenity::Member,
|
||||
|
@ -120,6 +124,7 @@ pub(crate) async fn apply_role(
|
|||
Ok(member.add_role(&ctx.http, role).await?)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn remove_role(
|
||||
ctx: &serenity::Context,
|
||||
member: &mut serenity::Member,
|
||||
|
@ -128,6 +133,7 @@ pub(crate) async fn remove_role(
|
|||
Ok(member.remove_role(&ctx.http, role).await?)
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub(crate) async fn welcome_user(
|
||||
http: impl AsRef<serenity::http::Http>,
|
||||
channel: &serenity::ChannelId,
|
||||
|
|
Loading…
Reference in a new issue