diff --git a/src/custom/experimental/experiment001.rs b/src/custom/experimental/experiment001.rs index dd3cba4..65bae8b 100644 --- a/src/custom/experimental/experiment001.rs +++ b/src/custom/experimental/experiment001.rs @@ -95,8 +95,65 @@ pub async fn init(mgr: Arc) { // 2. Add the BotAction to ModulesManager botc1.add_to_modmgr(Arc::clone(&mgr)).await; + let bc1 = BotCommand { + module: BotModule(String::from("experiments001")), + command: String::from("rp1"), // command call name + alias: vec![ + String::from("rp2"), + String::from("rp3")], // String of alternative names + exec_body: actions_util::asyncbox(rp), + help: String::from("Test Command tester"), + required_roles: vec![ + BotAdmin, + Mod(OF_CMD_CHANNEL), + ], + }; + bc1.add_core_to_modmgr(Arc::clone(&mgr)).await; } +async fn rp(params : ExecBodyParams) +{ + //triggers if the message is a reply + if params.get_parent_reply().is_some(){ + + //getting the channel id where the message was sent + let channel_id = params.get_parent_reply().unwrap().channel_login; + + //getting the first message id that was sent + let message_id = params.get_parent_reply().unwrap().message_id; + + //just for testing purposes + //print!("{} , {}",channel_id, message_id); + + //creating a tuple with the channel id and message id + let answear = + ( + channel_id.clone(), + message_id.clone() + ); + + 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( + //using the tuple as param to the message being replied + &answear, + String::from("hey there"), + params.clone() + ).await; + } + + else + { + println!("no reply") + } +} + + + async fn good_girl(params : ExecBodyParams) { // [ ] Uses gen_ratio() to output bool based on a ratio probability .