Skip to content

Commit c946d64

Browse files
committed
Add logtime of the day
1 parent dba0dbb commit c946d64

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/RP42.cr

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,21 @@ module RP42
1717

1818
coa = JSON.parse(http_client.get("/v2/users/#{username}/coalitions").body).as_a.last["name"].to_s
1919
lvl = JSON.parse(http_client.get("/v2/users/#{username}").body)["cursus_users"][0]["level"].to_s
20+
log = JSON.parse(http_client.get("/v2/users/#{username}/locations").body)[0]
2021

2122
rich_client = RichCrystal::Client.new(531103976029028367_u64)
22-
rich_client.login
23-
rich_client.activity({
24-
"details" => "Level: #{lvl}",
25-
"state" => "Location: #{hostname[0]}",
23+
rich_client.login
24+
rich_client.activity({
25+
"details" => "Level: #{lvl}",
26+
"state" => "Location: #{hostname[0]}",
2627
"assets" => {
2728
"large_image" => "logo",
2829
"large_text" => username,
2930
"small_image" => coa.tr(" ", "-").downcase,
3031
"small_text" => coa,
32+
},
33+
"timestamps" => {
34+
"start" => Time.parse_iso8601(log["begin_at"].to_s).to_unix
3135
}
3236
})
3337

0 commit comments

Comments
 (0)