use once_cell::sync::Lazy; use tokenservice_client::TokenServiceApi; pub static EMBED_COLOR: i32 = 0xf1d63c; pub static BOT_VERSION: Lazy = Lazy::new(|| { let cargo_version = cargo_toml::Manifest::from_path("./Cargo.toml") .unwrap() .package .unwrap() .version .unwrap(); format!("v{}", cargo_version) }); pub async fn token_path() -> TokenServiceApi { let client = super::tsclient::TSClient::new().get().await.unwrap(); client } pub fn concat_message(messages: Vec) -> String { messages.join("\n") } pub fn format_duration(secs: u64) -> String { let days = secs / 86400; let hours = (secs % 86400) / 3600; let minutes = (secs % 3600) / 60; let seconds = secs % 60; let mut formatted_string = String::new(); if days > 0 { formatted_string.push_str(&format!("{}d, ", days)); } if hours > 0 || days > 0 { formatted_string.push_str(&format!("{}h, ", hours)); } if minutes > 0 || hours > 0 { formatted_string.push_str(&format!("{}m, ", minutes)); } formatted_string.push_str(&format!("{}s", seconds)); formatted_string } /* pub fn format_memory(bytes: u64) -> String { let kb = 1024; let mb = 1024 * 1024; let gb = 1024 * 1024 * 1024; match bytes { b if b >= gb => format!("{:.0} GB", (b as f64 / (1024.0 * 1024.0 * 1024.0)).ceil()), b if b >= mb => format!("{:.0} MB", (b as f64 / (1024.0 * 1024.0)).ceil()), b if b >= kb => format!("{:.0} KB", (b as f64 / 1024.0).ceil()), _ => format!("{:.0} B", bytes), } } */