added tag checking

This commit is contained in:
liyunze 2026-02-05 12:21:52 +11:00
parent a8798ff83d
commit 6f62695350

View file

@ -57,25 +57,42 @@ pub async fn on_thread_create(
}
// check if there's more than one tag
if thread.applied_tags.len() <= 1 {
if thread.applied_tags.len() <= 1 && thread.applied_tags[0].to_string() != "1405563738672730192"
{
return Ok(());
}
} else if thread.applied_tags[0].to_string() == "1405563738672730192" {
// WRONG TAG
let thread_post = thread.id;
let thread_owner = thread
.owner_id
.expect("Failed to get thread owner ID")
.to_string();
// go into the channel and ping the user to only use one tag
let thread_post = thread.id;
let thread_owner = thread
.owner_id
.expect("Failed to get thread owner ID")
.to_string();
let message_builder = CreateMessage::new().content(format!(
"<@{}> Do not use \"DON'T PICK BOTH TAGS\" tag, select either career-oriented or personal-only\n\nYou can edit your post's tags under Post Settings -> Edit Tags",
thread_owner
));
let message_builder = CreateMessage::new().content(format!(
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
thread_post.send_message(ctx, message_builder).await?;
} else {
// go into the channel and ping the user to only use one tag
let thread_post = thread.id;
let thread_owner = thread
.owner_id
.expect("Failed to get thread owner ID")
.to_string();
let message_builder = CreateMessage::new().content(format!(
"<@{}> Please select only ONE (1) tag (personal-only or career-oriented)\n\nYou can edit your post's tags under Post Settings -> Edit Tags",
thread_owner
));
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
thread_post.send_message(ctx, message_builder).await?;
thread_post.send_message(ctx, message_builder).await?;
}
Ok(())
}