extend /commit command: add info about build time
All checks were successful
Build && Deploy / cargo build (push) Successful in 1m7s

This commit is contained in:
Akulij 2025-06-02 17:13:44 +05:00
parent daf1e09176
commit 6c6ded6977
3 changed files with 25 additions and 2 deletions

14
Cargo.lock generated
View File

@ -216,6 +216,19 @@ dependencies = [
"uuid", "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]] [[package]]
name = "bumpalo" name = "bumpalo"
version = "3.17.0" version = "3.17.0"
@ -915,6 +928,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bson", "bson",
"build-time",
"chrono", "chrono",
"chrono-tz", "chrono-tz",
"dotenvy", "dotenvy",

View File

@ -8,6 +8,7 @@ edition = "2021"
[dependencies] [dependencies]
async-trait = "0.1.88" async-trait = "0.1.88"
bson = { version = "2.14.0", features = ["chrono-0_4"] } bson = { version = "2.14.0", features = ["chrono-0_4"] }
build-time = "0.1.3"
chrono = { version = "0.4.40", features = ["serde"] } chrono = { version = "0.4.40", features = ["serde"] }
chrono-tz = "0.10.3" chrono-tz = "0.10.3"
dotenvy = "0.15.7" dotenvy = "0.15.7"

View File

@ -1,3 +1,4 @@
use build_time::{build_time_local, build_time_utc};
use git_const::git_hash; use git_const::git_hash;
use itertools::Itertools; use itertools::Itertools;
use teloxide::{ use teloxide::{
@ -194,7 +195,14 @@ pub async fn admin_command_handler(
} }
AdminCommands::Commit => { AdminCommands::Commit => {
let hash = git_hash!(); let hash = git_hash!();
bot.send_message(msg.chat.id, format!("Commit: {hash}")) 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): <b>{built_utc}</b>\n Local: <b>{built_local}</b>"),
)
.parse_mode(teloxide::types::ParseMode::Html)
.await?; .await?;
Ok(()) Ok(())
} }