feat: add human readable output to the API

This commit is contained in:
Jet 2026-03-23 13:44:56 -07:00
parent f57ecd19aa
commit 183b2c2c88
No known key found for this signature in database
6 changed files with 221 additions and 20 deletions

View file

@ -106,25 +106,11 @@ async fn handle_status(
let embed = match resp {
Ok(resp) if resp.status().is_success() => match resp.json::<CacheStatusResponse>().await {
Ok(data) => {
let mut embed = build_embed(
data.status,
data.since.unwrap_or(unix_now()),
&state.image_base_url,
);
let mut fields = Vec::new();
if let Some(ts) = data.since {
fields.push(("Since", format_timestamp(ts), true));
}
if let Some(ts) = data.last_checked {
fields.push(("Last Checked", format_timestamp(ts), true));
}
if !fields.is_empty() {
embed = embed.fields(fields);
}
embed
}
Ok(data) => build_embed(
data.status,
data.since.unwrap_or(unix_now()),
&state.image_base_url,
),
Err(e) => {
error!(error = %e, "failed to parse status response");
CreateEmbed::new()