|
|
|
@ -11,7 +11,7 @@ use crate::utils;
|
|
|
|
|
|
|
|
|
|
|
|
pub async fn poll_races(ctx: Arc<Context>)
|
|
|
|
pub async fn poll_races(ctx: Arc<Context>)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let race_data = match fetch_race_data(ctx.clone()).await
|
|
|
|
let race_data = match fetch_race_data().await
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Ok(v) => v,
|
|
|
|
Ok(v) => v,
|
|
|
|
Err(why) => { utils::Logger::log_error((*ctx).clone(), &format!("Failed to query racetime.gg: {}", why)).await; return; }
|
|
|
|
Err(why) => { utils::Logger::log_error((*ctx).clone(), &format!("Failed to query racetime.gg: {}", why)).await; return; }
|
|
|
|
@ -73,7 +73,7 @@ pub async fn poll_races(ctx: Arc<Context>)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////////// HELPERS
|
|
|
|
//////////// HELPERS
|
|
|
|
async fn fetch_race_data(ctx: Arc<Context>) -> Result<Value, String>
|
|
|
|
async fn fetch_race_data() -> Result<Value, String>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let result = reqwest::get("https://racetime.gg/races/data").await;
|
|
|
|
let result = reqwest::get("https://racetime.gg/races/data").await;
|
|
|
|
let response = match result
|
|
|
|
let response = match result
|
|
|
|
|