From 95a9962721c53c4a199434333f22b279cec87766 Mon Sep 17 00:00:00 2001 From: haruyuumei Date: Thu, 28 Mar 2024 15:38:49 -0300 Subject: [PATCH 1/9] new module test trying to add a new module --- src/custom/experimental/experiment001.rs | 4 -- src/lib.rs | 1 + src/modules.rs | 10 ++++ src/modules/test.rs | 17 ++++++ src/modules/thisguy.rs | 68 ++++++++++++++++++++++++ 5 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 src/modules.rs create mode 100644 src/modules/test.rs create mode 100644 src/modules/thisguy.rs diff --git a/src/custom/experimental/experiment001.rs b/src/custom/experimental/experiment001.rs index dd3cba4..28d499b 100644 --- a/src/custom/experimental/experiment001.rs +++ b/src/custom/experimental/experiment001.rs @@ -122,8 +122,6 @@ async fn good_girl(params : ExecBodyParams) { ); let bot = Arc::clone(¶ms.bot); - - let botlock = bot.read().await; // uses chat.say_in_reply_to() for the bot controls for messages @@ -135,8 +133,6 @@ async fn good_girl(params : ExecBodyParams) { String::from("GoodGirl xdd "), params.clone() ).await; - - } } } diff --git a/src/lib.rs b/src/lib.rs index c5ba775..f01fd10 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,2 +1,3 @@ pub mod core; pub mod custom; +pub mod modules; \ No newline at end of file diff --git a/src/modules.rs b/src/modules.rs new file mode 100644 index 0000000..d0b1c6e --- /dev/null +++ b/src/modules.rs @@ -0,0 +1,10 @@ +use std::sync::Arc; +pub use crate::core::botinstance::BotInstance; +pub use crate::core::botmodules::ModulesManager; + + +mod thisguy; + +pub async fn init(mgr:&Arc){ + thisguy::init(mgr).await; +} \ No newline at end of file diff --git a/src/modules/test.rs b/src/modules/test.rs new file mode 100644 index 0000000..ba7d68d --- /dev/null +++ b/src/modules/test.rs @@ -0,0 +1,17 @@ +use std::sync::Arc; + +// pub use crate::core::botinstance::BotInstance; +pub use crate::core::botmodules::ModulesManager; + +// [ ] Load submodules + +mod thisguy; + +// [ ] init() function that accepts bot instance - this is passed to init() on submodules + +pub async fn init(mgr: Arc) { + // Modules initializer loads modules into the bot + // this is achieved by calling submodules that also have fn init() defined + + thisguy::init(Arc::clone(&mgr)).await; +} diff --git a/src/modules/thisguy.rs b/src/modules/thisguy.rs new file mode 100644 index 0000000..339d4c4 --- /dev/null +++ b/src/modules/thisguy.rs @@ -0,0 +1,68 @@ +use crate::core::botmodules::{ BotActionTrait, BotCommand, BotModule, Listener, ModulesManager}; +use crate::core::identity::UserRole::*; +use crate::core::bot_actions::*; +use crate::core::botlog; +use std::sync::Arc; +use tokio::time::{sleep, Duration}; + + +async fn tsg(params: ExecBodyParams){ + + + + if params.msg.sender.name.to_lowercase() == "haruyuumei".to_lowercase() + //|| params.msg.sender.name.to_lowercase() == "ModulatingForce".to_lowercase() + { + botlog::debug( + "Oh god I love anime Girls!!", + Some("modules > thisguy()".to_string()), + Some(¶ms.msg), + ); + let bot = Arc::clone(¶ms.bot); + let botlock = bot.read().await; + + // uses chat.say_in_reply_to() for the bot controls for messages + botlock + .botmgrs + .chat + .say_in_reply_to( + ¶ms.msg, + String::from("Oh god I love anime Girls!!"), + params.clone() + ).await; + sleep(Duration::from_secs_f64(0.5)).await; + } + +} + +pub async fn init(mgr:&Arc){ + + BotCommand{ + module:BotModule(String::from("thisguy")), + command: String::from("this"), + alias: vec![String::from("tsg")], + exec_body: actions_util::asyncbox(tesst), + help: String::from("test"), + required_roles: vec![ + BotAdmin, + ], + }.add_to_modmgr(Arc::clone(&mgr)).await; + + + + Listener { + module: BotModule(String::from("thisguy")), + name: String::from("This Guy Listener"), + exec_body: actions_util::asyncbox(tsg), + help: String::from(""), + }.add_to_modmgr(Arc::clone(&mgr)).await; +} + +async fn tesst(params : ExecBodyParams) { + println!("tesst triggered!"); // NOTE : This test function intends to print (e.g., to stdout) at fn call + botlog::debug( + "tesst triggered!", + Some("modules > tesst()".to_string()), + Some(¶ms.msg), + ); +} From f8de595290c5bfabb1e591373964e0edc85755d5 Mon Sep 17 00:00:00 2001 From: haruyuumei Date: Thu, 28 Mar 2024 18:50:28 -0300 Subject: [PATCH 2/9] custom module update --- src/custom.rs | 4 +++- src/custom/experimental/experiment001.rs | 1 + src/{modules => custom}/thisguy.rs | 28 +++++++++++++++--------- src/lib.rs | 3 +-- src/modules.rs | 10 --------- src/modules/test.rs | 17 -------------- 6 files changed, 23 insertions(+), 40 deletions(-) rename src/{modules => custom}/thisguy.rs (73%) delete mode 100644 src/modules.rs delete mode 100644 src/modules/test.rs diff --git a/src/custom.rs b/src/custom.rs index 6107797..56c6257 100644 --- a/src/custom.rs +++ b/src/custom.rs @@ -13,6 +13,7 @@ pub use crate::core::botmodules::ModulesManager; // mod experiments; mod experimental; +mod thisguy; // [ ] init() function that accepts bot instance - this is passed to init() on submodules @@ -21,5 +22,6 @@ pub async fn init(mgr: Arc) { // this is achieved by calling submodules that also have fn init() defined // experiments::init(mgr).await - experimental::init(mgr).await; + experimental::init(mgr.clone()).await; + thisguy::init(&mgr).await; } diff --git a/src/custom/experimental/experiment001.rs b/src/custom/experimental/experiment001.rs index 28d499b..92af44d 100644 --- a/src/custom/experimental/experiment001.rs +++ b/src/custom/experimental/experiment001.rs @@ -105,6 +105,7 @@ async fn good_girl(params : ExecBodyParams) { if params.msg.sender.name.to_lowercase() == "ModulatingForce".to_lowercase() || params.msg.sender.name.to_lowercase() == "mzNToRi".to_lowercase() + || params.msg.sender.name.to_lowercase() == "haruyuumei".to_lowercase() { botlog::debug( "Good Girl Detected > Pausechamp", diff --git a/src/modules/thisguy.rs b/src/custom/thisguy.rs similarity index 73% rename from src/modules/thisguy.rs rename to src/custom/thisguy.rs index 339d4c4..b5e895f 100644 --- a/src/modules/thisguy.rs +++ b/src/custom/thisguy.rs @@ -3,16 +3,26 @@ use crate::core::identity::UserRole::*; use crate::core::bot_actions::*; use crate::core::botlog; use std::sync::Arc; +use rand::Rng; use tokio::time::{sleep, Duration}; - +//use rand::Rng; async fn tsg(params: ExecBodyParams){ - - if params.msg.sender.name.to_lowercase() == "haruyuumei".to_lowercase() - //|| params.msg.sender.name.to_lowercase() == "ModulatingForce".to_lowercase() + || params.msg.sender.name.to_lowercase() == "ModulatingForce".to_lowercase() { + let phrases: [String;5] = [ + "Aware Weebs...".to_string(), + "AYAYA I love anime Girls!!".to_string(), + "I love 2d Girls ILOST".to_string(), + "UOOHHHHH!!! Anime Girlssss".to_string(), + "Anime girls u say? peepoShy".to_string(), + ]; + + let r = rand::thread_rng().gen_range(0..=4); + let a = phrases[r].clone(); + botlog::debug( "Oh god I love anime Girls!!", Some("modules > thisguy()".to_string()), @@ -26,8 +36,8 @@ async fn tsg(params: ExecBodyParams){ .botmgrs .chat .say_in_reply_to( - ¶ms.msg, - String::from("Oh god I love anime Girls!!"), + ¶ms.msg, + a, params.clone() ).await; sleep(Duration::from_secs_f64(0.5)).await; @@ -39,16 +49,14 @@ pub async fn init(mgr:&Arc){ BotCommand{ module:BotModule(String::from("thisguy")), - command: String::from("this"), - alias: vec![String::from("tsg")], + command: String::from("anime"), + alias: vec![String::from("Anime")], exec_body: actions_util::asyncbox(tesst), help: String::from("test"), required_roles: vec![ BotAdmin, ], }.add_to_modmgr(Arc::clone(&mgr)).await; - - Listener { module: BotModule(String::from("thisguy")), diff --git a/src/lib.rs b/src/lib.rs index f01fd10..667ce02 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,2 @@ pub mod core; -pub mod custom; -pub mod modules; \ No newline at end of file +pub mod custom; \ No newline at end of file diff --git a/src/modules.rs b/src/modules.rs deleted file mode 100644 index d0b1c6e..0000000 --- a/src/modules.rs +++ /dev/null @@ -1,10 +0,0 @@ -use std::sync::Arc; -pub use crate::core::botinstance::BotInstance; -pub use crate::core::botmodules::ModulesManager; - - -mod thisguy; - -pub async fn init(mgr:&Arc){ - thisguy::init(mgr).await; -} \ No newline at end of file diff --git a/src/modules/test.rs b/src/modules/test.rs deleted file mode 100644 index ba7d68d..0000000 --- a/src/modules/test.rs +++ /dev/null @@ -1,17 +0,0 @@ -use std::sync::Arc; - -// pub use crate::core::botinstance::BotInstance; -pub use crate::core::botmodules::ModulesManager; - -// [ ] Load submodules - -mod thisguy; - -// [ ] init() function that accepts bot instance - this is passed to init() on submodules - -pub async fn init(mgr: Arc) { - // Modules initializer loads modules into the bot - // this is achieved by calling submodules that also have fn init() defined - - thisguy::init(Arc::clone(&mgr)).await; -} From fda7afb1918c8b59c542577d480d1149884b8e81 Mon Sep 17 00:00:00 2001 From: haruyuumei Date: Thu, 28 Mar 2024 19:33:06 -0300 Subject: [PATCH 3/9] custom module working --- src/custom/thisguy.rs | 63 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/src/custom/thisguy.rs b/src/custom/thisguy.rs index b5e895f..cf31b34 100644 --- a/src/custom/thisguy.rs +++ b/src/custom/thisguy.rs @@ -1,25 +1,25 @@ -use crate::core::botmodules::{ BotActionTrait, BotCommand, BotModule, Listener, ModulesManager}; -use crate::core::identity::UserRole::*; use crate::core::bot_actions::*; use crate::core::botlog; -use std::sync::Arc; +use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, Listener, ModulesManager}; +use crate::core::identity::UserRole::*; use rand::Rng; +use std::sync::Arc; use tokio::time::{sleep, Duration}; + //use rand::Rng; -async fn tsg(params: ExecBodyParams){ - - if params.msg.sender.name.to_lowercase() == "haruyuumei".to_lowercase() - || params.msg.sender.name.to_lowercase() == "ModulatingForce".to_lowercase() +async fn tsg(params: ExecBodyParams) { + if params.msg.message_text == String::from("anime") + || params.msg.message_text == String::from("Anime") { - let phrases: [String;5] = [ - "Aware Weebs...".to_string(), - "AYAYA I love anime Girls!!".to_string(), - "I love 2d Girls ILOST".to_string(), - "UOOHHHHH!!! Anime Girlssss".to_string(), - "Anime girls u say? peepoShy".to_string(), + let phrases: [String; 5] = [ + "Aware oh no! Weebs...".to_string(), + "AYAYA I love anime Girls!!".to_string(), + "I love 2d Girls ILOST ".to_string(), + "UOOHHHHH!!! Anime Girlssss".to_string(), + "Anime girls u say? peepoShy ".to_string(), ]; - + let r = rand::thread_rng().gen_range(0..=4); let a = phrases[r].clone(); @@ -33,40 +33,39 @@ async fn tsg(params: ExecBodyParams){ // uses chat.say_in_reply_to() for the bot controls for messages botlock - .botmgrs - .chat - .say_in_reply_to( - ¶ms.msg, - a, - params.clone() - ).await; + .botmgrs + .chat + .say_in_reply_to(¶ms.msg, a, params.clone()) + .await; sleep(Duration::from_secs_f64(0.5)).await; + }else { + } - } -pub async fn init(mgr:&Arc){ - - BotCommand{ - module:BotModule(String::from("thisguy")), +pub async fn init(mgr: &Arc) { + BotCommand { + module: BotModule(String::from("thisguy")), command: String::from("anime"), alias: vec![String::from("Anime")], exec_body: actions_util::asyncbox(tesst), help: String::from("test"), - required_roles: vec![ - BotAdmin, - ], - }.add_to_modmgr(Arc::clone(&mgr)).await; + required_roles: vec![BotAdmin], + } + .add_to_modmgr(Arc::clone(&mgr)) + .await; Listener { module: BotModule(String::from("thisguy")), name: String::from("This Guy Listener"), exec_body: actions_util::asyncbox(tsg), help: String::from(""), - }.add_to_modmgr(Arc::clone(&mgr)).await; + } + .add_to_modmgr(Arc::clone(&mgr)) + .await; } -async fn tesst(params : ExecBodyParams) { +async fn tesst(params: ExecBodyParams) { println!("tesst triggered!"); // NOTE : This test function intends to print (e.g., to stdout) at fn call botlog::debug( "tesst triggered!", From 72d4cf6d70924d9d2908f9aa69332a7f3b48d6e8 Mon Sep 17 00:00:00 2001 From: haruyuumei Date: Sun, 31 Mar 2024 14:37:50 -0300 Subject: [PATCH 4/9] Small changes on thisguy.rs --- src/custom/thisguy.rs | 86 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 17 deletions(-) diff --git a/src/custom/thisguy.rs b/src/custom/thisguy.rs index cf31b34..2a8e445 100644 --- a/src/custom/thisguy.rs +++ b/src/custom/thisguy.rs @@ -6,25 +6,42 @@ use rand::Rng; use std::sync::Arc; use tokio::time::{sleep, Duration}; -//use rand::Rng; +//using the env file to get bot prefix +use std::env; +use dotenv::dotenv; + +//bot function async fn tsg(params: ExecBodyParams) { - if params.msg.message_text == String::from("anime") - || params.msg.message_text == String::from("Anime") + + //Defining a var prefix to the prefix on the env file + dotenv().ok(); + let prefix = env::var("prefix").unwrap(); + /* + defining a text with the prefix + the command name (idk how to get the command) + so for now i'm typing the command + */ + let text = String::from(&prefix) + "This"; + let text2 = String::from(&prefix) + "this"; + + //comparing the text sent with the text (prefix + command name) + if params.msg.message_text == text + || params.msg.message_text == text2 { - let phrases: [String; 5] = [ - "Aware oh no! Weebs...".to_string(), - "AYAYA I love anime Girls!!".to_string(), - "I love 2d Girls ILOST ".to_string(), - "UOOHHHHH!!! Anime Girlssss".to_string(), - "Anime girls u say? peepoShy ".to_string(), + let phrases: [String; 6] = [ + "Clueless".to_string(), + "ICANT This guy....".to_string(), + "He is right tho".to_string(), + "KEKW true!".to_string(), + "OMEGALUL wth man...".to_string(), + "PepeLaugh El no sabe".to_string(), ]; let r = rand::thread_rng().gen_range(0..=4); let a = phrases[r].clone(); botlog::debug( - "Oh god I love anime Girls!!", + "This guy works!", Some("modules > thisguy()".to_string()), Some(¶ms.msg), ); @@ -39,16 +56,16 @@ async fn tsg(params: ExecBodyParams) { .await; sleep(Duration::from_secs_f64(0.5)).await; }else { - + println!("didn't type the proper command"); } } pub async fn init(mgr: &Arc) { BotCommand { module: BotModule(String::from("thisguy")), - command: String::from("anime"), - alias: vec![String::from("Anime")], - exec_body: actions_util::asyncbox(tesst), + command: String::from("thisguy"), + alias: vec![String::from("Thisguy")], + exec_body: actions_util::asyncbox(test), help: String::from("test"), required_roles: vec![BotAdmin], } @@ -65,11 +82,46 @@ pub async fn init(mgr: &Arc) { .await; } -async fn tesst(params: ExecBodyParams) { - println!("tesst triggered!"); // NOTE : This test function intends to print (e.g., to stdout) at fn call + +async fn test(params: ExecBodyParams) { + println!("Test triggered!"); // NOTE : This test function intends to print (e.g., to stdout) at fn call botlog::debug( - "tesst triggered!", + "test triggered!", Some("modules > tesst()".to_string()), Some(¶ms.msg), ); } + + +// just testing this area, not working atm +async fn replyer(params: ExecBodyParams) +{ + /* + check if the command message was a reply + get reply message parent + reply to the parent + */ + + //let reply_parent_message; + let reply_message: &String = ¶ms.msg.message_text; + let my_reply:String = String::from("test"); + + //println!("{:?}",reply_parent_message); + println!("{}",reply_message); + + botlog::debug( + "Oh god I love anime Girls!!", + Some("modules > thisguy()".to_string()), + Some(¶ms.msg), + ); + let bot = Arc::clone(¶ms.bot); + let botlock = bot.read().await; + + // uses chat.say_in_reply_to() for the bot controls for messages + botlock + .botmgrs + .chat + .say_in_reply_to(¶ms.msg, my_reply, params.clone()) + .await; + sleep(Duration::from_secs_f64(0.5)).await; +} \ No newline at end of file From d972eb77266dedf9cdfae2189dd586699e4ca080 Mon Sep 17 00:00:00 2001 From: haruyuumei Date: Tue, 2 Apr 2024 20:11:01 -0300 Subject: [PATCH 5/9] Thisguy working partially not fully implemented reply to the reply --- src/custom/thisguy.rs | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/src/custom/thisguy.rs b/src/custom/thisguy.rs index 2a8e445..b539b3e 100644 --- a/src/custom/thisguy.rs +++ b/src/custom/thisguy.rs @@ -6,12 +6,12 @@ use rand::Rng; use std::sync::Arc; use tokio::time::{sleep, Duration}; - //using the env file to get bot prefix use std::env; use dotenv::dotenv; //bot function + async fn tsg(params: ExecBodyParams) { //Defining a var prefix to the prefix on the env file @@ -56,7 +56,7 @@ async fn tsg(params: ExecBodyParams) { .await; sleep(Duration::from_secs_f64(0.5)).await; }else { - println!("didn't type the proper command"); + //println!("didn't type the proper command"); } } @@ -91,37 +91,3 @@ async fn test(params: ExecBodyParams) { Some(¶ms.msg), ); } - - -// just testing this area, not working atm -async fn replyer(params: ExecBodyParams) -{ - /* - check if the command message was a reply - get reply message parent - reply to the parent - */ - - //let reply_parent_message; - let reply_message: &String = ¶ms.msg.message_text; - let my_reply:String = String::from("test"); - - //println!("{:?}",reply_parent_message); - println!("{}",reply_message); - - botlog::debug( - "Oh god I love anime Girls!!", - Some("modules > thisguy()".to_string()), - Some(¶ms.msg), - ); - let bot = Arc::clone(¶ms.bot); - let botlock = bot.read().await; - - // uses chat.say_in_reply_to() for the bot controls for messages - botlock - .botmgrs - .chat - .say_in_reply_to(¶ms.msg, my_reply, params.clone()) - .await; - sleep(Duration::from_secs_f64(0.5)).await; -} \ No newline at end of file From 7e04699b67c4191b7b4ca8107057f3b6c6b109ce Mon Sep 17 00:00:00 2001 From: haruyuumei Date: Wed, 3 Apr 2024 10:25:24 -0300 Subject: [PATCH 6/9] making changes --- src/custom/thisguy.rs | 104 ++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 69 deletions(-) diff --git a/src/custom/thisguy.rs b/src/custom/thisguy.rs index b539b3e..0ca6de8 100644 --- a/src/custom/thisguy.rs +++ b/src/custom/thisguy.rs @@ -1,63 +1,44 @@ use crate::core::bot_actions::*; +use crate::core::botinstance::Channel; use crate::core::botlog; -use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, Listener, ModulesManager}; +use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager}; use crate::core::identity::UserRole::*; use rand::Rng; use std::sync::Arc; use tokio::time::{sleep, Duration}; - -//using the env file to get bot prefix -use std::env; -use dotenv::dotenv; - -//bot function +const OF_CMD_CHANNEL:Channel = Channel(String::new()); async fn tsg(params: ExecBodyParams) { - //Defining a var prefix to the prefix on the env file - dotenv().ok(); - let prefix = env::var("prefix").unwrap(); - /* - defining a text with the prefix + the command name (idk how to get the command) - so for now i'm typing the command - */ - let text = String::from(&prefix) + "This"; - let text2 = String::from(&prefix) + "this"; + let phrases: [String; 6] = [ + "Clueless ".to_string(), + "ICANT This guy....".to_string(), + "He is right tho".to_string(), + "KEKW true!".to_string(), + "OMEGALUL wth man...".to_string(), + "PepeLaugh El no sabe".to_string(), + ]; - //comparing the text sent with the text (prefix + command name) - if params.msg.message_text == text - || params.msg.message_text == text2 - { - let phrases: [String; 6] = [ - "Clueless".to_string(), - "ICANT This guy....".to_string(), - "He is right tho".to_string(), - "KEKW true!".to_string(), - "OMEGALUL wth man...".to_string(), - "PepeLaugh El no sabe".to_string(), - ]; + let r = rand::thread_rng().gen_range(0..=4); + let a = phrases[r].clone(); - let r = rand::thread_rng().gen_range(0..=4); - let a = phrases[r].clone(); + let test = params.get_parent_module(); - botlog::debug( - "This guy works!", - Some("modules > thisguy()".to_string()), - Some(¶ms.msg), - ); - let bot = Arc::clone(¶ms.bot); - let botlock = bot.read().await; + botlog::debug( + "This guy works!", + Some("modules > thisguy()".to_string()), + Some(¶ms.msg), + ); + let bot = Arc::clone(¶ms.bot); + let botlock = bot.read().await; - // uses chat.say_in_reply_to() for the bot controls for messages - botlock - .botmgrs - .chat - .say_in_reply_to(¶ms.msg, a, params.clone()) - .await; - sleep(Duration::from_secs_f64(0.5)).await; - }else { - //println!("didn't type the proper command"); - } + // uses chat.say_in_reply_to() for the bot controls for messages + botlock + .botmgrs + .chat + .say_in_reply_to(¶ms.msg, a, params.clone()) + .await; + sleep(Duration::from_secs_f64(0.5)).await; } pub async fn init(mgr: &Arc) { @@ -65,29 +46,14 @@ pub async fn init(mgr: &Arc) { module: BotModule(String::from("thisguy")), command: String::from("thisguy"), alias: vec![String::from("Thisguy")], - exec_body: actions_util::asyncbox(test), - help: String::from("test"), - required_roles: vec![BotAdmin], - } - .add_to_modmgr(Arc::clone(&mgr)) - .await; - - Listener { - module: BotModule(String::from("thisguy")), - name: String::from("This Guy Listener"), exec_body: actions_util::asyncbox(tsg), - help: String::from(""), + help: String::from("test"), + required_roles: vec![ + BotAdmin, + Mod(OF_CMD_CHANNEL), + Broadcaster + ], } .add_to_modmgr(Arc::clone(&mgr)) .await; -} - - -async fn test(params: ExecBodyParams) { - println!("Test triggered!"); // NOTE : This test function intends to print (e.g., to stdout) at fn call - botlog::debug( - "test triggered!", - Some("modules > tesst()".to_string()), - Some(¶ms.msg), - ); -} +} \ No newline at end of file From b43d6f8159cf9e107f44f8f648e2673dcc593dba Mon Sep 17 00:00:00 2001 From: haruyuumei Date: Wed, 3 Apr 2024 10:26:14 -0300 Subject: [PATCH 7/9] Rewriten the code working with command instead listener --- src/custom/thisguy.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/custom/thisguy.rs b/src/custom/thisguy.rs index 0ca6de8..052f601 100644 --- a/src/custom/thisguy.rs +++ b/src/custom/thisguy.rs @@ -22,8 +22,6 @@ async fn tsg(params: ExecBodyParams) { let r = rand::thread_rng().gen_range(0..=4); let a = phrases[r].clone(); - let test = params.get_parent_module(); - botlog::debug( "This guy works!", Some("modules > thisguy()".to_string()), From 55aeaa7fc15c124ec2d0923aa5a547125bda0452 Mon Sep 17 00:00:00 2001 From: haruyuumei Date: Tue, 9 Apr 2024 16:22:11 -0300 Subject: [PATCH 8/9] changed reply message on thisguy --- src/custom/thisguy.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/custom/thisguy.rs b/src/custom/thisguy.rs index 052f601..8616580 100644 --- a/src/custom/thisguy.rs +++ b/src/custom/thisguy.rs @@ -4,6 +4,7 @@ use crate::core::botlog; use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager}; use crate::core::identity::UserRole::*; use rand::Rng; +use twitch_irc::message::ReplyToMessage; use std::sync::Arc; use tokio::time::{sleep, Duration}; const OF_CMD_CHANNEL:Channel = Channel(String::new()); @@ -34,7 +35,11 @@ async fn tsg(params: ExecBodyParams) { botlock .botmgrs .chat - .say_in_reply_to(¶ms.msg, a, params.clone()) + .say_in_reply( + Channel(params.clone().msg.channel_login().to_string()), + a, + params.clone() + ) .await; sleep(Duration::from_secs_f64(0.5)).await; } From e41f7b0524c19ebf321bc3455125cddd333e7214 Mon Sep 17 00:00:00 2001 From: haruyuumei Date: Tue, 9 Apr 2024 16:44:58 -0300 Subject: [PATCH 9/9] warning changed --- src/custom/thisguy.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/custom/thisguy.rs b/src/custom/thisguy.rs index 8616580..cc53129 100644 --- a/src/custom/thisguy.rs +++ b/src/custom/thisguy.rs @@ -57,6 +57,6 @@ pub async fn init(mgr: &Arc) { Broadcaster ], } - .add_to_modmgr(Arc::clone(&mgr)) + .add_to_modmgr(Arc::clone(mgr)) .await; } \ No newline at end of file