Shuffler now Shuffles single Words :D

This commit is contained in:
haruyuumei 2024-04-09 13:36:21 -03:00
parent 12da47253d
commit 4c6bc2e84e

View file

@ -1,6 +1,8 @@
//! A module about editing and messing around with user text
//!
use std::collections::HashMap;
use std::os::windows::thread;
use std::string;
use std::sync::Arc;
use rand::{thread_rng, Rng};
use rand::seq::SliceRandom;
@ -117,7 +119,25 @@ pub async fn init(mgr: Arc<ModulesManager>) {
}
else {
//if it only has one word, shuffle its chars (exclude the n word monkaLaugh)
//if it only has one word, shuffle its chars
let word = usermessage.get(&1).unwrap();
let shuffle_word: String =
word.chars()
.collect::<Vec<char>>()
.choose_multiple(&mut thread_rng(), word.len())
.collect();
let bot = Arc::clone(&params.bot);
let botlock = bot.read().await;
botlock
.botmgrs
.chat
.say_in_reply_to(
&params.msg,
shuffle_word,
params.clone()
).await;
}
}