Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/discord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,11 @@ fn resolve_mentions(content: &str, bot_id: UserId, mentions: &[User]) -> String
}

fn shorten_thread_name(prompt: &str) -> String {
// Strip @(role) and @(user) placeholders left by resolve_mentions()
let cleaned = prompt.replace("@(role)", "").replace("@(user)", "");
// Shorten GitHub URLs: https://github.com/owner/repo/issues/123 → owner/repo#123
let re = regex::Regex::new(r"https?://github\.com/([^/]+/[^/]+)/(issues|pull)/(\d+)").unwrap();
let shortened = re.replace_all(prompt, "$1#$3");
let shortened = re.replace_all(cleaned.trim(), "$1#$3");
let name: String = shortened.chars().take(40).collect();
if name.len() < shortened.len() {
format!("{name}...")
Expand Down
Loading