From 4c6bc2e84e73fdf3900f83b2988b4a73a534a1b8 Mon Sep 17 00:00:00 2001 From: haruyuumei Date: Tue, 9 Apr 2024 13:36:21 -0300 Subject: [PATCH] Shuffler now Shuffles single Words :D --- src/custom/text_mods.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/custom/text_mods.rs b/src/custom/text_mods.rs index 62c41ee..d0ec2a4 100644 --- a/src/custom/text_mods.rs +++ b/src/custom/text_mods.rs @@ -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) { } 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::>() + .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; } }