This commit is contained in:
Elnu 2025-03-25 19:22:24 -07:00
parent 665d5c025b
commit eccd55542d
3 changed files with 1299 additions and 506 deletions

1795
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -7,15 +7,15 @@ edition = "2021"
[dependencies] [dependencies]
dotenv = "0.15" dotenv = "0.15"
rand = "0.8" rand = "0.9"
tracing = "0.1" tracing = "0.1"
tracing-subscriber = "0.3" tracing-subscriber = "0.3"
serde_json = "1.0" serde_json = "1.0"
reqwest = "0.11" reqwest = "0.12"
slug = "0.1" slug = "0.1"
unicode_hfwidth = "0.2" unicode_hfwidth = "0.2"
fs_extra = "1.3" fs_extra = "1.3"
poise = "0.5.5" poise = "0.5.7"
[dependencies.tokio] [dependencies.tokio]
version = "1.32" version = "1.32"

View file

@ -248,7 +248,7 @@ pub async fn send(ctx: Context<'_>, message: &str, ping: bool, pin: bool) -> Res
} }
pub fn random_from_string(string: &str) -> char { pub fn random_from_string(string: &str) -> char {
string.chars().choose(&mut rand::thread_rng()).unwrap() string.chars().choose(&mut rand::rng()).unwrap()
} }
pub fn get_so_diagram(kanji: char) -> String { pub fn get_so_diagram(kanji: char) -> String {
@ -368,7 +368,7 @@ pub async fn random_kanji(
if subcategory == "ALL" { if subcategory == "ALL" {
let subcategory_key = subcategories let subcategory_key = subcategories
.keys() .keys()
.choose(&mut rand::thread_rng()) .choose(&mut rand::rng())
.unwrap(); .unwrap();
let list = subcategories[subcategory_key].as_str().unwrap(); let list = subcategories[subcategory_key].as_str().unwrap();
let kanji = random_from_string(list); let kanji = random_from_string(list);