Skip to content

Commit

Permalink
Only mention staff for incoming thread
Browse files Browse the repository at this point in the history
TheKodeToad committed Dec 31, 2024
1 parent abc2e8e commit 4bb0fc0
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/commands/contact.rs
Original file line number Diff line number Diff line change
@@ -27,6 +27,11 @@ pub async fn contact(
return Ok(());
}

if context.author().id == user.id {
context.say("❌ Opening a thread for yourself is not supported.").await?;
return Ok(());
}

if let Some(thread) = get_thread_by_user(&context.data().pg, user.id.get()).await? {
match serenity::ChannelId::new(thread.id)
.to_channel(&context.http())
7 changes: 5 additions & 2 deletions src/formatting/thread_info.rs
Original file line number Diff line number Diff line change
@@ -19,8 +19,11 @@ pub fn create(config: &Config, options: Options) -> String {

let mut result = String::new();

if let Some(role) = config.forum_channel.mention_role_id {
writeln!(&mut result, "{}\n", role.mention()).unwrap();
// only mention for incoming thread
if options.user_id == options.opened.0 {
if let Some(role) = config.forum_channel.mention_role_id {
writeln!(&mut result, "{}\n", role.mention()).unwrap();
}
}

if options.user_id == options.opened.0 {

0 comments on commit 4bb0fc0

Please sign in to comment.