diff --git a/Cargo.lock b/Cargo.lock index 8a2fe0e..be62640 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -216,6 +216,19 @@ dependencies = [ "uuid", ] +[[package]] +name = "build-time" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1219c19fc29b7bfd74b7968b420aff5bc951cf517800176e795d6b2300dd382" +dependencies = [ + "chrono", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -915,6 +928,7 @@ version = "0.1.0" dependencies = [ "async-trait", "bson", + "build-time", "chrono", "chrono-tz", "dotenvy", diff --git a/Cargo.toml b/Cargo.toml index 3cf7c10..97d5367 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ edition = "2021" [dependencies] async-trait = "0.1.88" bson = { version = "2.14.0", features = ["chrono-0_4"] } +build-time = "0.1.3" chrono = { version = "0.4.40", features = ["serde"] } chrono-tz = "0.10.3" dotenvy = "0.15.7" diff --git a/src/admin.rs b/src/admin.rs index 9a87504..0f954f2 100644 --- a/src/admin.rs +++ b/src/admin.rs @@ -1,3 +1,4 @@ +use build_time::{build_time_local, build_time_utc}; use git_const::git_hash; use itertools::Itertools; use teloxide::{ @@ -194,8 +195,15 @@ pub async fn admin_command_handler( } AdminCommands::Commit => { let hash = git_hash!(); - bot.send_message(msg.chat.id, format!("Commit: {hash}")) - .await?; + let built_utc = build_time_utc!("%H:%M %d.%m.%Y"); + let built_local = build_time_local!("%H:%M %d.%m.%Y"); + + bot.send_message( + msg.chat.id, + format!("Commit: {hash}\nBuilt at (UTC): {built_utc}\n Local: {built_local}"), + ) + .parse_mode(teloxide::types::ParseMode::Html) + .await?; Ok(()) } }