Shuffler now Shuffles single Words :D
This commit is contained in:
parent
12da47253d
commit
4c6bc2e84e
1 changed files with 21 additions and 1 deletions
|
@ -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(¶ms.bot);
|
||||
let botlock = bot.read().await;
|
||||
botlock
|
||||
.botmgrs
|
||||
.chat
|
||||
.say_in_reply_to(
|
||||
¶ms.msg,
|
||||
shuffle_word,
|
||||
params.clone()
|
||||
).await;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue