diff --git a/src/racetime/mod.rs b/src/racetime/mod.rs index 28f4a57..5a68c64 100644 --- a/src/racetime/mod.rs +++ b/src/racetime/mod.rs @@ -5,10 +5,12 @@ pub mod race; use race::{Race, Races}; use std::sync::Arc; -use serenity::prelude::*; +use serenity::{prelude::*, model::prelude::ChannelId}; use serde_json::Value; use crate::utils; +const RACE_CHANNEL_ID: u64 = 101735569041666048; + pub async fn poll_races(ctx: Arc) { let race_data = match fetch_race_data().await @@ -47,6 +49,8 @@ pub async fn poll_races(ctx: Arc) // 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; + 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 { @@ -64,6 +68,9 @@ pub async fn poll_races(ctx: Arc) // TEST ANNOUNCEMENT //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; } } }