Skip to content

Commit

Permalink
feat: Use emoji to signal bot or human user
Browse files Browse the repository at this point in the history
Following on from #36, this change keeps the message structure more uniform.
This should mean the messages are slightly easier to visually parse.
  • Loading branch information
akash1810 committed Oct 23, 2024
1 parent ffc4f08 commit d038baa
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,8 @@ async fn main() -> Result<(), Error> {
}

fn make_message(pull_request: GithubPullRequest, show_pr_age: bool) -> String {
let prefix = if pull_request.user.login.contains("[bot]") {
"🤖🤖🤖 ".to_string()
} else {
"".to_string()
};

let message = format!(
"{}<{}|{}#{}> - {}",
prefix,
"<{}|{}#{}> - {}",
pull_request.html_url.replace("https://", ""),
pull_request.head.repo.name,
pull_request.number,
Expand All @@ -226,10 +219,17 @@ fn make_message(pull_request: GithubPullRequest, show_pr_age: bool) -> String {
"".to_string()
};

format!(
"{}{} \n\nby {}\n",
message, age_output, pull_request.user.login
)
let user = format!(
"{} {}",
if pull_request.user.login.contains("[bot]") {
"🤖"
} else {
"👤"
},
pull_request.user.login
);

format!("{}{} \n\n{}\n", message, age_output, user)
}

fn get_age(d1: DateTime<Utc>, d2: DateTime<Utc>) -> String {
Expand Down

0 comments on commit d038baa

Please sign in to comment.