added tag checking
This commit is contained in:
parent
a8798ff83d
commit
6f62695350
1 changed files with 28 additions and 11 deletions
|
|
@ -57,10 +57,26 @@ pub async fn on_thread_create(
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if there's more than one tag
|
// 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(());
|
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();
|
||||||
|
|
||||||
|
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
|
||||||
|
));
|
||||||
|
|
||||||
|
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
|
// go into the channel and ping the user to only use one tag
|
||||||
let thread_post = thread.id;
|
let thread_post = thread.id;
|
||||||
let thread_owner = thread
|
let thread_owner = thread
|
||||||
|
|
@ -76,6 +92,7 @@ pub async fn on_thread_create(
|
||||||
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue