From 27f5fa50d0072e84d9b68b77cf409f3256629c25 Mon Sep 17 00:00:00 2001 From: Ethan Ruszanowski Date: Thu, 13 Jul 2023 15:12:13 -0400 Subject: [PATCH] Add more detail to player profiles --- src/commands/api.rs | 8 ++++++++ src/commands/profile.rs | 19 +++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/commands/api.rs b/src/commands/api.rs index 5918127..e66c826 100644 --- a/src/commands/api.rs +++ b/src/commands/api.rs @@ -33,6 +33,14 @@ pub struct Profile { pub losses: i32, #[serde(rename = "Wins")] pub wins: i32, + #[serde(rename = "Team_Name")] + pub clan: Option, + #[serde(rename = "Level")] + pub level: i32, + #[serde(rename = "Platform")] + pub platform: Option, + #[serde(rename = "Leaves")] + pub leaves: i32, pub ret_msg: Option, } diff --git a/src/commands/profile.rs b/src/commands/profile.rs index 02ac873..16a430d 100644 --- a/src/commands/profile.rs +++ b/src/commands/profile.rs @@ -22,8 +22,7 @@ pub async fn profile( return Ok(()); } - let winrate = - (profile.wins as f32 / (profile.wins as f32 + profile.losses as f32)) * 100 as f32; + let winrate = (profile.wins as f32 / (profile.wins as f32 + profile.losses as f32)) * 100f32; ctx.send(|f| { f.embed(|f| { f.title(format!("{}", profile.name.as_ref().unwrap())) @@ -32,11 +31,23 @@ pub async fn profile( profile.hz_player_name.as_ref().unwrap() )) .field( - "Status", + "Clan Name", + format!("{}", profile.clan.as_ref().unwrap_or(&String::from(""))), + true, + ) + .field( + "Status Message", format!("{}", profile.personal_status_message.as_ref().unwrap()), false, ) - .field("Hours played", format!("{}", profile.hours_played), false) + .field("Level", format!("{}", profile.level), true) + .field("Hours Played", format!("{}", profile.hours_played), true) + .field("Leaves", format!("{}", profile.leaves), true) + .field( + "Platform", + format!("{}", profile.platform.as_ref().unwrap()), + false, + ) .field("Wins", format!("{}", profile.wins), true) .field("Losses", format!("{}", profile.losses), true) .field("Winrate", format!("{:.2}%", winrate), true)