diff --git a/Cargo.lock b/Cargo.lock index 1285bc2..6238db1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1461,7 +1461,6 @@ dependencies = [ "octocrab", "owo-colors 4.0.0", "poise", - "rand", "redis", "regex", "reqwest 0.12.2", diff --git a/Cargo.toml b/Cargo.toml index b47c5fd..dd9eed8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,6 @@ log = "0.4.20" poise = "0.6.1" octocrab = "0.37.0" owo-colors = "4.0.0" -rand = "0.8.5" redis = { version = "0.25.2", features = ["tokio-comp", "tokio-rustls-comp"] } regex = "1.10.3" reqwest = { version = "0.12.2", default-features = false, features = [ diff --git a/src/handlers/event/eta.rs b/src/handlers/event/eta.rs index f4219f1..02bb24e 100644 --- a/src/handlers/event/eta.rs +++ b/src/handlers/event/eta.rs @@ -1,9 +1,8 @@ -use std::sync::OnceLock; +use std::{sync::OnceLock, time::SystemTime}; use eyre::Result; use log::trace; use poise::serenity_prelude::{Context, Message}; -use rand::seq::SliceRandom; use regex::Regex; fn regex() -> &'static Regex { @@ -39,13 +38,14 @@ pub async fn handle(ctx: &Context, message: &Message) -> Result<()> { return Ok(()); } - let response = format!( - "{} <:pofat:1031701005559144458>", - MESSAGES - .choose(&mut rand::thread_rng()) - .unwrap_or(&"sometime") - ); + // no, this isn't actually random. we don't need it to be, though -getchoo + let current_time = SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH)? + .as_millis(); + let random_pos = (current_time % MESSAGES.len() as u128) as usize; + let response = format!("{} <:pofat:1031701005559144458>", MESSAGES[random_pos]); message.reply(ctx, response).await?; + Ok(()) }