|
|
|
@ -5,10 +5,12 @@ pub mod race;
|
|
|
|
use race::{Race, Races};
|
|
|
|
use race::{Race, Races};
|
|
|
|
|
|
|
|
|
|
|
|
use std::sync::Arc;
|
|
|
|
use std::sync::Arc;
|
|
|
|
use serenity::prelude::*;
|
|
|
|
use serenity::{prelude::*, model::prelude::ChannelId};
|
|
|
|
use serde_json::Value;
|
|
|
|
use serde_json::Value;
|
|
|
|
use crate::utils;
|
|
|
|
use crate::utils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const RACE_CHANNEL_ID: u64 = 101735569041666048;
|
|
|
|
|
|
|
|
|
|
|
|
pub async fn poll_races(ctx: Arc<Context>)
|
|
|
|
pub async fn poll_races(ctx: Arc<Context>)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let race_data = match fetch_race_data().await
|
|
|
|
let race_data = match fetch_race_data().await
|
|
|
|
@ -47,6 +49,8 @@ pub async fn poll_races(ctx: Arc<Context>)
|
|
|
|
|
|
|
|
|
|
|
|
// TEST ANNOUNCEMENT
|
|
|
|
// TEST ANNOUNCEMENT
|
|
|
|
// utils::Logger::log_message((*ctx).clone(), &format!("New race started for: {} - **goal:** {} - **url:** {}", races[&key].game, races[&key].goal, races[&key].url)).await;
|
|
|
|
// utils::Logger::log_message((*ctx).clone(), &format!("New race started for: {} - **goal:** {} - **url:** {}", races[&key].game, races[&key].goal, races[&key].url)).await;
|
|
|
|
|
|
|
|
let msg = format!("New race started for: {} - **goal:** {} - **url:** {}", races[&key].game, races[&key].goal, races[&key].url);
|
|
|
|
|
|
|
|
utils::send_msg((*ctx).clone(), ChannelId(RACE_CHANNEL_ID), &msg).await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -64,6 +68,9 @@ pub async fn poll_races(ctx: Arc<Context>)
|
|
|
|
|
|
|
|
|
|
|
|
// TEST ANNOUNCEMENT
|
|
|
|
// TEST ANNOUNCEMENT
|
|
|
|
//utils::Logger::log_message((*ctx).clone(), &format!("Goal set: {} for: {}", races[&key].goal, races[&key].url)).await;
|
|
|
|
//utils::Logger::log_message((*ctx).clone(), &format!("Goal set: {} for: {}", races[&key].goal, races[&key].url)).await;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let msg = format!("Goal set: {} for: {}", races[&key].goal, races[&key].url);
|
|
|
|
|
|
|
|
utils::send_msg((*ctx).clone(), ChannelId(RACE_CHANNEL_ID), &msg).await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|