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",
|
"octocrab",
|
||||||
"owo-colors 4.0.0",
|
"owo-colors 4.0.0",
|
||||||
"poise",
|
"poise",
|
||||||
"rand",
|
|
||||||
"redis",
|
"redis",
|
||||||
"regex",
|
"regex",
|
||||||
"reqwest 0.12.2",
|
"reqwest 0.12.2",
|
||||||
|
|
|
@ -24,7 +24,6 @@ log = "0.4.20"
|
||||||
poise = "0.6.1"
|
poise = "0.6.1"
|
||||||
octocrab = "0.37.0"
|
octocrab = "0.37.0"
|
||||||
owo-colors = "4.0.0"
|
owo-colors = "4.0.0"
|
||||||
rand = "0.8.5"
|
|
||||||
redis = { version = "0.25.2", features = ["tokio-comp", "tokio-rustls-comp"] }
|
redis = { version = "0.25.2", features = ["tokio-comp", "tokio-rustls-comp"] }
|
||||||
regex = "1.10.3"
|
regex = "1.10.3"
|
||||||
reqwest = { version = "0.12.2", default-features = false, features = [
|
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 eyre::Result;
|
||||||
use log::trace;
|
use log::trace;
|
||||||
use poise::serenity_prelude::{Context, Message};
|
use poise::serenity_prelude::{Context, Message};
|
||||||
use rand::seq::SliceRandom;
|
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
||||||
fn regex() -> &'static Regex {
|
fn regex() -> &'static Regex {
|
||||||
|
@ -39,13 +38,14 @@ pub async fn handle(ctx: &Context, message: &Message) -> Result<()> {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let response = format!(
|
// no, this isn't actually random. we don't need it to be, though -getchoo
|
||||||
"{} <:pofat:1031701005559144458>",
|
let current_time = SystemTime::now()
|
||||||
MESSAGES
|
.duration_since(SystemTime::UNIX_EPOCH)?
|
||||||
.choose(&mut rand::thread_rng())
|
.as_millis();
|
||||||
.unwrap_or(&"sometime")
|
let random_pos = (current_time % MESSAGES.len() as u128) as usize;
|
||||||
);
|
|
||||||
|
|
||||||
|
let response = format!("{} <:pofat:1031701005559144458>", MESSAGES[random_pos]);
|
||||||
message.reply(ctx, response).await?;
|
message.reply(ctx, response).await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue