Merge pull request 'extend /commit command: add info about build time' (#19) from dev into main
All checks were successful
Build && Deploy / cargo build (push) Successful in 1m9s

Reviewed-on: #19
This commit is contained in:
akulij 2025-06-02 12:14:34 +00:00
commit 1211e78b22
3 changed files with 25 additions and 2 deletions

14
Cargo.lock generated
View File

@ -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",

View File

@ -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"

View File

@ -1,3 +1,4 @@
use build_time::{build_time_local, build_time_utc};
use git_const::git_hash;
use itertools::Itertools;
use teloxide::{
@ -194,7 +195,14 @@ pub async fn admin_command_handler(
}
AdminCommands::Commit => {
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?;
Ok(())
}