drop rand
This commit is contained in:
parent
b161a1a5c5
commit
29ed728fc1
3 changed files with 8 additions and 10 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1461,7 +1461,6 @@ dependencies = [
|
|||
"octocrab",
|
||||
"owo-colors 4.0.0",
|
||||
"poise",
|
||||
"rand",
|
||||
"redis",
|
||||
"regex",
|
||||
"reqwest 0.12.2",
|
||||
|
|
|
@ -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 = [
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue