diff --git a/src/main.rs b/src/main.rs index da5cc43..6a4ad07 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,6 +13,7 @@ const ANON_USER: &str = "Anonymous User"; pub struct TodayEntry { pub name: Option, pub score: i32, + pub rank: i32, pub star1: Option, pub star2: Option, } @@ -38,13 +39,12 @@ fn truncate(s: &str, max_chars: usize) -> &str { } async fn get_leaderboard_data() -> AochData { - let response_data = reqwest::get("https://aoch.wisv.ch/data") + reqwest::get("https://aoch.wisv.ch/data") .await .unwrap() .json() .await - .unwrap(); - response_data + .unwrap() } /// Displays the overall leaderboard of this year @@ -99,7 +99,7 @@ async fn leaderboard_total(ctx: Context<'_>) -> Result<(), Error> { ); let mut stylized_answer = table_rows[0..cmp::min(row_count, table_rows.len())].join("\n"); - stylized_answer = format!("```\n{}```", truncate(&*stylized_answer, 1990)); + stylized_answer = format!("```\n{}```", truncate(&stylized_answer, 1990)); ctx.say(stylized_answer).await?; Ok(()) @@ -156,7 +156,7 @@ async fn leaderboard_today(ctx: Context<'_>) -> Result<(), Error> { ); let mut stylized_answer = table_rows[0..cmp::min(row_count, table_rows.len())].join("\n"); - stylized_answer = format!("```\n{}```", truncate(&*stylized_answer, 1990)); + stylized_answer = format!("```\n{}```", truncate(&stylized_answer, 1990)); println!("{}", stylized_answer); ctx.say(stylized_answer).await?; Ok(())