mirror of
https://github.com/dsec-hub/dsec-discord-bot.git
synced 2026-09-22 07:44:26 +00:00
COL-BOT-03: make /member_info expiry reply ephemeral and drop dead query
Restructure the membership lookup to `let Some(user_data) = ... else { ... }`
so the "Couldn't find info" branch now sends `.ephemeral(true)` like the other
two replies; whether a member's membership has lapsed is no longer announced to
the whole channel. Delete the commented-out `student_data` query that duplicated
member_data(). No embed fields or wording changed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017XrE7F9ZuBWdQnS8CZvYDE
This commit is contained in:
parent
345f4ec513
commit
fb867a2efa
1 changed files with 29 additions and 33 deletions
|
|
@ -66,7 +66,20 @@ pub async fn member_info(ctx: ApplicationContext<'_>) -> Result<(), Error> {
|
|||
|
||||
let user_data_option = member_data(&database, &student_id).await?;
|
||||
|
||||
if let Some(user_data) = user_data_option {
|
||||
let Some(user_data) = user_data_option else {
|
||||
ctx.send(
|
||||
CreateReply::default()
|
||||
.embed(CreateEmbed::new().title("Couldn't find info").description(
|
||||
"Your membership may have expired. Contact a club executive to be sure.",
|
||||
))
|
||||
// Ephemeral like the other two replies: whether someone's
|
||||
// membership has lapsed is their business, not the channel's.
|
||||
.ephemeral(true),
|
||||
)
|
||||
.await?;
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
let member_name = user_data.full_name;
|
||||
let member_campus = user_data.campus;
|
||||
let membership_status = user_data.membership_status;
|
||||
|
|
@ -89,23 +102,6 @@ pub async fn member_info(ctx: ApplicationContext<'_>) -> Result<(), Error> {
|
|||
.ephemeral(true),
|
||||
)
|
||||
.await?;
|
||||
} else {
|
||||
ctx.send(CreateReply::default().embed(
|
||||
CreateEmbed::new().title("Couldn't find info").description(
|
||||
"Your membership may have expired. Contact a club executive to be sure.",
|
||||
),
|
||||
))
|
||||
.await?;
|
||||
}
|
||||
|
||||
// let student_data = state
|
||||
// .supabase
|
||||
// .database()
|
||||
// .from("active_members")
|
||||
// .select("full_name, student_id")
|
||||
// .eq("student_id", &student_id)
|
||||
// .execute()
|
||||
// .await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue