diff --git a/src/core/botinstance.rs b/src/core/botinstance.rs index 7c6f33b..c5b6dca 100644 --- a/src/core/botinstance.rs +++ b/src/core/botinstance.rs @@ -272,17 +272,7 @@ impl BotInstance { Some(msg), ); - - // /* - // [ ] Here, msg is taken, and message_text is split so we can pull the first argument - // */ - - // let inpt = msg - // .message_text - // .split(' ') - // .next() - // .expect("ERROR during BotCommand"); - + /* [ ] What we should do instead is : 1. Check if the message is related to a Reply (so we know how many arguments we should skip) @@ -295,14 +285,11 @@ impl BotInstance { let arg1 = msgiter.next(); let arg2 = msgiter.next(); - - let reply = if let Some(replyidout) = msg.source.tags.0.get("reply-thread-parent-msg-id") { - if let Some(replyid) = replyidout { - // println!("Detected Reply : {}",replyid); - Some(replyid) - } else { None } + + let reply = if let Some(Some(replyid)) = msg.source.tags.0.get("reply-thread-parent-msg-id") { + Some(replyid) } else { None } - ; + ; let inpt = match reply { diff --git a/src/core/chat.rs b/src/core/chat.rs index 370fcf5..1ba85e7 100644 --- a/src/core/chat.rs +++ b/src/core/chat.rs @@ -95,7 +95,7 @@ impl Chat { let contextratelimiter = rllock // .get_mut() - .get_mut(&Channel(String::from(channel_login.to_lowercase().clone()))) + .get_mut(&Channel(channel_login.to_lowercase().clone())) .expect("ERROR: Issue with Rate limiters"); // Continue to check the limiter and sleep if required if the minimum is not reached @@ -132,7 +132,7 @@ impl Chat { botlog::trace( logstr.as_str(), Some("Chat > send_botmsg".to_string()), - Some(&msg), + Some(msg), ); } else { botlog::trace( diff --git a/src/custom/experimental.rs b/src/custom/experimental.rs index e2aa67e..409abd1 100644 --- a/src/custom/experimental.rs +++ b/src/custom/experimental.rs @@ -5,7 +5,7 @@ use std::sync::Arc; -pub use crate::core::botinstance::BotInstance; +// pub use crate::core::botinstance::BotInstance; pub use crate::core::botmodules::ModulesManager; // [ ] Load submodules diff --git a/src/custom/experimental/experiment002.rs b/src/custom/experimental/experiment002.rs index a00e76b..ff18642 100644 --- a/src/custom/experimental/experiment002.rs +++ b/src/custom/experimental/experiment002.rs @@ -65,41 +65,33 @@ async fn sayout(bot: BotAR, msg: PrivmsgMessage) { */ - - let reply_parent = if let Some(replyout) = msg.source.tags.0.get("reply-parent-msg-body") { - if let Some(replymsg) = replyout { - // println!("Detected Reply : {}",replyid); - Some(replymsg) + let reply_parent = if let Some(Some(reply)) = msg.source.tags.0.get("reply-parent-msg-body") { + Some(reply) } else { None } - } else { None } ; - let reply_parent_usr = if let Some(replyout) = msg.source.tags.0.get("reply-thread-parent-user-login") { - if let Some(replymsgusr) = replyout { - // println!("Detected Reply : {}",replyid); - Some(replymsgusr) + + let reply_parent_usr = if let Some(Some(reply)) = msg.source.tags.0.get("reply-thread-parent-user-login") { + Some(reply) } else { None } - } else { None } ; // [x] Unwraps arguments from message + let argrslt = - if let Some((_,str1)) = msg.message_text.split_once(" ") { + if let Some((_,str1)) = msg.message_text.split_once(' ') { if reply_parent.is_none() { - if let Some((channelstr,msgstr)) = str1.split_once(" ") { + if let Some((channelstr,msgstr)) = str1.split_once(' ') { Some((channelstr,msgstr)) } else { None } - } else { - if let Some((_,str2)) = str1.split_once(" ") { - if let Some((channelstr,msgstr)) = str2.split_once(" ") { - Some((channelstr,msgstr)) - } - else { None } + } else if let Some((_,str2)) = str1.split_once(' ') { + if let Some((channelstr,msgstr)) = str2.split_once(' ') { + Some((channelstr,msgstr)) } else { None } - } + } else { None } } else { None }; @@ -136,7 +128,7 @@ async fn sayout(bot: BotAR, msg: PrivmsgMessage) { botlock .botmgrs .chat - .say_in_reply_to(&msg, format!("Not a Joined Channel : {}",trgchnl.to_string())) + .say_in_reply_to(&msg, format!("Not a Joined Channel : {}",trgchnl)) .await;