Add dayTime value to embed
This commit is contained in:
parent
f0a5bcbc5d
commit
236adfe190
@ -26,6 +26,16 @@ pub async fn data(
|
|||||||
let map = server["mapName"].as_str().unwrap();
|
let map = server["mapName"].as_str().unwrap();
|
||||||
let slot_cap = slots["capacity"].as_i64().unwrap();
|
let slot_cap = slots["capacity"].as_i64().unwrap();
|
||||||
let slot_cur = slots["used"].as_i64().unwrap();
|
let slot_cur = slots["used"].as_i64().unwrap();
|
||||||
|
let daytime = server["dayTime"].as_i64().unwrap();
|
||||||
|
// println!("{}", daytime);
|
||||||
|
|
||||||
|
// todo: Add careerSavegame support when passing in DSS url.
|
||||||
|
// So I can get the following values for Autosave, Timescale and Slot usage.
|
||||||
|
|
||||||
|
// Convert dayTime (ms) to a military time format
|
||||||
|
let hour = (daytime / 3600 / 1000) % 24;
|
||||||
|
let minute = (daytime / 60 / 1000) % 60;
|
||||||
|
let time = format!("{:02}:{:02}", hour, minute);
|
||||||
|
|
||||||
ctx.send(|m| m.embed(|e| e.color(crate::COLOR)
|
ctx.send(|m| m.embed(|e| e.color(crate::COLOR)
|
||||||
.author(|a|
|
.author(|a|
|
||||||
@ -36,7 +46,7 @@ pub async fn data(
|
|||||||
.fields(vec![
|
.fields(vec![
|
||||||
("Map", map, true),
|
("Map", map, true),
|
||||||
("Version", ver, true),
|
("Version", ver, true),
|
||||||
("Time", "xx:xx", true),
|
("Time", &time, true),
|
||||||
("Slot usage", "xx/xx", true),
|
("Slot usage", "xx/xx", true),
|
||||||
("Autosave", "xx", true),
|
("Autosave", "xx", true),
|
||||||
("Timescale", "0x", true)
|
("Timescale", "0x", true)
|
||||||
|
Loading…
Reference in New Issue
Block a user