forcebot_rs/src/modules/experiments.rs
2024-01-29 04:10:16 -05:00

65 lines
No EOL
1.8 KiB
Rust

/*
Submodules -
- should have definitions of BotAction that will be added to a bit
- therefore, will be defined in modules.rs file
- will define one init(&BotInstance) take within the module that will contain :
- BotAction definitions that each call &BotInstance module manager to add itself
*/
// mod crate::modules;
//use crate::modules;
use std::future::Future;
use crate::core::botmodules::{ModulesManager,Listener,BotModule,BotActionTrait, BotCommand};
use crate::core::botmodules::bot_actions::actions_util;
use crate::core::botinstance::{self};
use twitch_irc::message::PrivmsgMessage;
pub fn init(mgr:&mut ModulesManager)
{
BotCommand {
module : BotModule(String::from("experiments 004")),
command : String::from("test"), // command call name
alias : vec![String::from("tester"),String::from("testy")], // String of alternative names
exec_body : actions_util::asyncbox(testy) ,
help : String::from("DUPCMD4 tester"),
}.add_to_modmgr(mgr);
let list1 = Listener {
module : BotModule(String::from("experiments 004")),
name : String::from("GoodGirl Listener"),
exec_body : actions_util::asyncbox(good_girl) ,
help : String::from("")
};
list1.add_to_modmgr(mgr);
}
async fn good_girl(mut chat:botinstance::Chat,msg:PrivmsgMessage)
{
println!("In GoodGirl()");
//println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text);
if msg.sender.name == "ModulatingForce" && msg.message_text.contains("GoodGirl") {
chat.say_in_reply_to(&msg,String::from("GoodGirl")).await;
}
}
async fn testy(mut _chat:botinstance::Chat,_msg:PrivmsgMessage)
{
println!("testy triggered!")
}