Added a countdown link

+ timeanddate.com are being used for now
master
Joey Hines 2020-06-12 17:26:14 -05:00
parent fbee8708a2
commit 9179955ff0
1 changed files with 10 additions and 0 deletions

View File

@ -74,6 +74,15 @@ pub fn send_dm_message(http: &Http, user: User, message: &String) {
}
}
/// Create a countdown link for the event
pub fn get_countdown_link(event_name: &String, utc: &DateTime<Utc>) -> String {
let msg = event_name.replace(" ", "+");
let time = utc.format("%G%m%dT%H%M").to_string();
format!("https://www.timeanddate.com/countdown/generic?iso={}&p0=&msg={}&font=sanserif&csz=1", time, msg)
}
/// Sends the event message to the event channel
pub fn send_event_msg(
http: &Http,
@ -104,6 +113,7 @@ pub fn send_event_msg(
.timestamp(utc_time.to_rfc3339())
.field("Location", &event.event_loc, true)
.field("Organizer", &event.organizer, true)
.field("Countdown", get_countdown_link(&event.event_name, &utc_time), false)
})
})?;