Bump deps, fix errors. Still need to fix warnings

This commit is contained in:
joeyahines committed 2025-03-15 12:23:59 -06:00
1 parent 59e33a32a9
commit 8175444a0d
12 files changed
+1972 -980

No files matched your search

+3 -3
View File
@@ -2,8 +2,8 @@ use crate::error::Error;
use base64::{engine::general_purpose, Engine as _};
use j_db::database::Database;
use j_db::model::JdbModel;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use rand::distr::Alphanumeric;
use rand::{rng, Rng};
use serde::{Deserialize, Serialize};
use serenity::model::id::UserId;
use sha3::digest::FixedOutput;
@@ -33,7 +33,7 @@ impl JdbModel for Apikey {
impl Apikey {
pub fn new(name: &str, user_id: Option<UserId>) -> (Self, String) {
let secret: String = thread_rng()
let secret: String = rng()
.sample_iter(&Alphanumeric)
.take(64)
.map(char::from)
+4 -3
View File
@@ -1,8 +1,9 @@
use crate::error::Error;
use j_db::database::Database;
use j_db::model::JdbModel;
use rand::prelude::IndexedRandom;
use rand::rng;
use rand::seq::SliceRandom;
use rand::thread_rng;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use tera::{Context, Tera};
@@ -27,7 +28,7 @@ impl RandomResponseTemplate {
context.insert("target", target);
for (key, words) in &self.word_bank {
context.insert(key, &words.choose(&mut thread_rng()).unwrap());
context.insert(key, &words.choose(&mut rng()).unwrap());
}
Ok(Tera::one_off(&self.template, &context, false)?)
@@ -50,7 +51,7 @@ impl RandomResponseTemplate {
target: &str,
) -> Result<Option<String>, Error> {
let templates = Self::get_all_responses_for_type(db, resp_type)?;
let template = templates.choose(&mut thread_rng());
let template = templates.choose(&mut rng());
if let Some(template) = template {
Ok(Some(template.render(target)?))
+7 -7
View File
@@ -2,8 +2,8 @@ use crate::config::GlobalData;
use crate::error::Error;
use j_db::database::Database;
use j_db::model::JdbModel;
use rand::distributions::{Distribution, Standard};
use rand::{thread_rng, Rng};
use rand::distr::{Distribution, StandardUniform};
use rand::{rng, Rng};
use serde::{Deserialize, Serialize};
use serenity::model::guild::Emoji;
use serenity::model::id::{EmojiId, GuildId};
@@ -190,7 +190,7 @@ pub enum LilFrenState {
PhasedIntoYourReality,
}
impl Distribution<LilFrenState> for Standard {
impl Distribution<LilFrenState> for StandardUniform {
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> LilFrenState {
match rng.gen_range(0..10) {
0 => LilFrenState::Standing,
@@ -251,8 +251,8 @@ impl LilFren {
thirst: 1.0,
entertainment: 1.0,
state: LilFrenState::Standing,
smarts: thread_rng().gen_range(0.0..0.5),
metabolism: thread_rng().gen_range(0.2..0.75),
smarts: rng().gen_range(0.0..0.5),
metabolism: rng().gen_range(0.2..0.75),
}
}
@@ -296,9 +296,9 @@ impl LilFren {
lil_fren.thirst =
(lil_fren.entertainment + entertainment_diff * self.smarts).clamp(-1.0, 1.0);
if thread_rng().gen_bool(0.75) {
if rng().gen_bool(0.75) {
println!("fren is now {:?}", self.state);
lil_fren.state = thread_rng().gen();
lil_fren.state = rng().random();
}
db.insert(lil_fren)?;
+3 -5
View File
@@ -4,8 +4,8 @@ use crate::models::random::RandomConfig;
use j_db::database::Database;
use j_db::error::JDbError;
use j_db::model::JdbModel;
use rand::prelude::SliceRandom;
use rand::thread_rng;
use rand::prelude::IndexedRandom;
use rand::rng;
use serde::{Deserialize, Serialize};
use std::fmt::Debug;
@@ -90,9 +90,7 @@ impl MotivationConfig {
}
}
let image = images
.choose(&mut thread_rng())
.ok_or(Error::NoAlbumFound)?;
let image = images.choose(&mut rng()).ok_or(Error::NoAlbumFound)?;
let actions = RandomConfig::get_random(db, ACTION_RANDOM_GROUP)?.unwrap_or_default();
let goals = RandomConfig::get_random(db, GOAL_RANDOM_GROUP)?.unwrap_or_default();
+1 -1
View File
@@ -1,7 +1,7 @@
use crate::error::Error;
use j_db::database::Database;
use j_db::model::JdbModel;
use rand::distributions::WeightedIndex;
use rand::distr::weighted::WeightedIndex;
use rand::prelude::Distribution;
use rand::thread_rng;
use serde::{Deserialize, Serialize};