comments cleanup
This commit is contained in:
parent
62b6399e69
commit
8adab21761
5 changed files with 10 additions and 112 deletions
|
@ -24,11 +24,10 @@ debug = "Checking bot actions",
|
|||
pub fn trace(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) {
|
||||
let (chnl, chatter) = match in_prvmsg {
|
||||
Some(prvmsg) => {
|
||||
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
|
||||
(
|
||||
Some(prvmsg.channel_login.clone()),
|
||||
Some(prvmsg.sender.name.clone()),
|
||||
) // <-- Clone fine atm while we're just working with Strings
|
||||
)
|
||||
}
|
||||
None => (None, None),
|
||||
};
|
||||
|
@ -45,11 +44,10 @@ pub fn trace(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&Privmsg
|
|||
pub fn debug(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) {
|
||||
let (chnl, chatter) = match in_prvmsg {
|
||||
Some(prvmsg) => {
|
||||
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
|
||||
(
|
||||
Some(prvmsg.channel_login.clone()),
|
||||
Some(prvmsg.sender.name.clone()),
|
||||
) // <-- Clone fine atm while we're just working with Strings
|
||||
)
|
||||
}
|
||||
None => (None, None),
|
||||
};
|
||||
|
@ -66,11 +64,10 @@ pub fn debug(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&Privmsg
|
|||
pub fn info(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) {
|
||||
let (chnl, chatter) = match in_prvmsg {
|
||||
Some(prvmsg) => {
|
||||
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
|
||||
(
|
||||
Some(prvmsg.channel_login.clone()),
|
||||
Some(prvmsg.sender.name.clone()),
|
||||
) // <-- Clone fine atm while we're just working with Strings
|
||||
)
|
||||
}
|
||||
None => (None, None),
|
||||
};
|
||||
|
@ -87,11 +84,10 @@ pub fn info(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgM
|
|||
pub fn notice(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) {
|
||||
let (chnl, chatter) = match in_prvmsg {
|
||||
Some(prvmsg) => {
|
||||
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
|
||||
(
|
||||
Some(prvmsg.channel_login.clone()),
|
||||
Some(prvmsg.sender.name.clone()),
|
||||
) // <-- Clone fine atm while we're just working with Strings
|
||||
)
|
||||
}
|
||||
None => (None, None),
|
||||
};
|
||||
|
@ -108,11 +104,10 @@ pub fn notice(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&Privms
|
|||
pub fn warn(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) {
|
||||
let (chnl, chatter) = match in_prvmsg {
|
||||
Some(prvmsg) => {
|
||||
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
|
||||
(
|
||||
Some(prvmsg.channel_login.clone()),
|
||||
Some(prvmsg.sender.name.clone()),
|
||||
) // <-- Clone fine atm while we're just working with Strings
|
||||
)
|
||||
}
|
||||
None => (None, None),
|
||||
};
|
||||
|
@ -129,11 +124,10 @@ pub fn warn(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgM
|
|||
pub fn error(in_msg: &str, in_module: Option<String>, in_prvmsg: Option<&PrivmsgMessage>) {
|
||||
let (chnl, chatter) = match in_prvmsg {
|
||||
Some(prvmsg) => {
|
||||
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
|
||||
(
|
||||
Some(prvmsg.channel_login.clone()),
|
||||
Some(prvmsg.sender.name.clone()),
|
||||
) // <-- Clone fine atm while we're just working with Strings
|
||||
)
|
||||
}
|
||||
None => (None, None),
|
||||
};
|
||||
|
@ -154,11 +148,10 @@ pub fn fatal<'a>(
|
|||
) -> &'a str {
|
||||
let (chnl, chatter) = match in_prvmsg {
|
||||
Some(prvmsg) => {
|
||||
//Log::trace(&format!("(#{}) {}: {}", prvmsg.channel_login, prvmsg.sender.name, prvmsg.message_text));
|
||||
(
|
||||
Some(prvmsg.channel_login.clone()),
|
||||
Some(prvmsg.sender.name.clone()),
|
||||
) // <-- Clone fine atm while we're just working with Strings
|
||||
)
|
||||
}
|
||||
None => (None, None),
|
||||
};
|
||||
|
|
|
@ -253,7 +253,6 @@ pub async fn init(mgr: Arc<ModulesManager>) {
|
|||
// 2. Add the BotAction to ModulesManager
|
||||
botc1.add_core_to_modmgr(Arc::clone(&mgr)).await;
|
||||
|
||||
// async fn cmd_disable(bot: BotAR, msg: PrivmsgMessage) {
|
||||
async fn cmd_disable(params : ExecBodyParams) {
|
||||
/*
|
||||
There should be additional validation checks
|
||||
|
|
|
@ -34,14 +34,8 @@ pub struct Chat {
|
|||
}
|
||||
|
||||
|
||||
// #[derive(Clone,Debug)] // <-- [ ] 04.03 - was having issues using this
|
||||
#[derive(Clone)]
|
||||
// pub enum BotMsgType<'a> {
|
||||
#[derive(Clone,Debug)]
|
||||
pub enum BotMsgType {
|
||||
// SayInReplyTo(&'a PrivmsgMessage,String),
|
||||
// SayInReplyTo(Arc<Box<dyn ReplyToMessage>>,String),
|
||||
// SayInReplyTo(&'a dyn ReplyToMessage,String), // [ ] 04.03 - Having issues defining it this way?
|
||||
// SayInReplyTo((String,String),String), // ( Destination Channel , Message ID to reply to ) , OutMessage // https://docs.rs/twitch-irc/latest/twitch_irc/client/struct.TwitchIRCClient.html#method.say_in_reply_to
|
||||
SayInReplyTo(Channel,String,String), // ( Destination Channel , Message ID to reply to , OutMessage ) // https://docs.rs/twitch-irc/latest/twitch_irc/client/struct.TwitchIRCClient.html#method.say_in_reply_to
|
||||
Say(String,String),
|
||||
Notif(String), // For Bot Sent Notifications
|
||||
|
@ -65,7 +59,6 @@ impl Chat {
|
|||
}
|
||||
|
||||
#[async_recursion]
|
||||
// pub async fn send_botmsg(&self, msginput: BotMsgType<'async_recursion>, params : ExecBodyParams) {
|
||||
pub async fn send_botmsg(&self, msginput: BotMsgType, params : ExecBodyParams) {
|
||||
|
||||
|
||||
|
@ -79,20 +72,16 @@ impl Chat {
|
|||
|
||||
*/
|
||||
|
||||
/* // [ ] 04.03 - Was having issues withh this
|
||||
botlog::trace(
|
||||
format!("send_bot_msg params : {:?}",msginput).as_str(),
|
||||
Some("chat.rs > send_botmsg ".to_string()),
|
||||
Some(¶ms.msg),
|
||||
);
|
||||
Log::flush();
|
||||
*/
|
||||
|
||||
|
||||
let (channel_login,mut outmsg) = match msginput.clone() {
|
||||
// BotMsgType::SayInReplyTo(msg, outmsg) => {
|
||||
BotMsgType::SayInReplyTo(chnl, _, outmsg) => {
|
||||
// (msg.channel_login.clone(),outmsg)
|
||||
// (msg.clone().channel_login().to_string(),outmsg)
|
||||
(chnl.0.to_lowercase(), // Desintation Channel
|
||||
outmsg)
|
||||
},
|
||||
|
@ -133,7 +122,6 @@ impl Chat {
|
|||
None,
|
||||
);
|
||||
|
||||
// if let BotMsgType::SayInReplyTo(_prvmsg,_outmsg) = msginput {
|
||||
if let BotMsgType::SayInReplyTo(_chnl,_msgid, _outmsg) = msginput {
|
||||
|
||||
self.send_botmsg(BotMsgType::Notif(
|
||||
|
@ -182,7 +170,6 @@ impl Chat {
|
|||
|
||||
match msginput {
|
||||
BotMsgType::Notif(_) => (), // Do nothing with Notif > We'll validate the user later to handle
|
||||
// BotMsgType::SayInReplyTo(_, _) | BotMsgType::Say(_,_) => {
|
||||
BotMsgType::SayInReplyTo(_, _, _) | BotMsgType::Say(_,_) => {
|
||||
|
||||
botlog::trace(
|
||||
|
@ -248,7 +235,7 @@ impl Chat {
|
|||
let botlock = botclone.read().await;
|
||||
let id = botlock.get_identity();
|
||||
let id = Arc::clone(&id);
|
||||
let idlock = id.read().await; // <-- [x] 03.24 - seems to work
|
||||
let idlock = id.read().await;
|
||||
let user_roles = idlock.getspecialuserroles(
|
||||
params.get_sender(),
|
||||
Some(Channel(channel_login.clone()))
|
||||
|
@ -282,7 +269,6 @@ impl Chat {
|
|||
return;
|
||||
}
|
||||
},
|
||||
// BotMsgType::SayInReplyTo(_,_ ) | BotMsgType::Say(_,_) => {
|
||||
BotMsgType::SayInReplyTo(_,_,_ ) | BotMsgType::Say(_,_) => {
|
||||
// If the BotMsg a Say/SayInReplyTo (from Developer or Chatter) , and the Sender does not have Specific Roles in the Source Channel Sent
|
||||
|
||||
|
@ -337,7 +323,6 @@ impl Chat {
|
|||
);
|
||||
|
||||
let contextratelimiter = rllock
|
||||
// .get_mut()
|
||||
.get_mut(&Channel(channel_login.to_lowercase().clone()))
|
||||
.expect("ERROR: Issue with Rate limiters");
|
||||
|
||||
|
@ -356,11 +341,8 @@ impl Chat {
|
|||
}
|
||||
|
||||
match msginput.clone() {
|
||||
// BotMsgType::SayInReplyTo(msg, _) => {
|
||||
// BotMsgType::SayInReplyTo(msg, _, _) => {
|
||||
BotMsgType::SayInReplyTo(chnl,msgid, _) => {
|
||||
|
||||
// dbg!(msg.clone().channel_login(),msg.message_id(),outmsg.clone());
|
||||
dbg!(chnl.clone(),msgid.clone(),outmsg.clone());
|
||||
|
||||
self.client.say_in_reply_to(&(
|
||||
|
@ -373,7 +355,6 @@ impl Chat {
|
|||
}
|
||||
BotMsgType::Notif(outmsg) => {
|
||||
|
||||
// dbg!(chnl.clone(),msgid.clone(),outmsg.clone());
|
||||
dbg!(params.msg.channel_login(),params.msg.message_id());
|
||||
self.client.say_in_reply_to(¶ms.msg, outmsg).await.unwrap();
|
||||
}
|
||||
|
@ -386,12 +367,10 @@ impl Chat {
|
|||
channel_login.clone(), "rate limit counter increase", contextratelimiter
|
||||
);
|
||||
|
||||
// if let BotMsgType::SayInReplyTo(_,_ ) = msginput {
|
||||
if let BotMsgType::SayInReplyTo(_,_,_ ) = msginput {
|
||||
botlog::trace(
|
||||
logstr.as_str(),
|
||||
Some("Chat > send_botmsg".to_string()),
|
||||
// Some(msg),
|
||||
None,
|
||||
);
|
||||
} else {
|
||||
|
@ -433,12 +412,6 @@ impl Chat {
|
|||
|
||||
}
|
||||
|
||||
|
||||
// pub async fn say_in_reply_to(&self, msg: &PrivmsgMessage, outmsg: String) {
|
||||
// #[async_recursion]
|
||||
// pub async fn say_in_reply_to(&self, msg: &PrivmsgMessage, outmsg: String , params : ExecBodyParams) {
|
||||
// pub async fn say_in_reply_to(&self, msg: &PrivmsgMessage, outmsg: String , params : ExecBodyParams) {
|
||||
// pub async fn say_in_reply_to(&self, msg: &impl ReplyToMessage, outmsg: String , params : ExecBodyParams) {
|
||||
pub async fn say_in_reply_to(
|
||||
&self,
|
||||
destination_channel : Channel ,
|
||||
|
@ -447,57 +420,6 @@ impl Chat {
|
|||
params : ExecBodyParams)
|
||||
{
|
||||
|
||||
// let params_clone = params.clone();
|
||||
|
||||
// let botclone = Arc::clone(¶ms_clone.bot);
|
||||
// let botlock = botclone.read().await;
|
||||
// let id = botlock.get_identity();
|
||||
// let id = Arc::clone(&id);
|
||||
|
||||
// // botlog::trace(
|
||||
// // "ACQUIRING WRITE LOCK : ID",
|
||||
// // Some("Chat > send_botmsg".to_string()),
|
||||
// // Some(¶ms.msg),
|
||||
// // );
|
||||
// // Log::flush();
|
||||
|
||||
// botlog::trace(
|
||||
// "ACQUIRING READ LOCK : ID",
|
||||
// Some("Chat > send_botmsg".to_string()),
|
||||
// Some(¶ms.msg),
|
||||
// );
|
||||
// Log::flush();
|
||||
|
||||
|
||||
// // let idlock = id.write().await; // <-- [ ] 03.24 - This is definitely locking it
|
||||
// let idlock = id.read().await; // <-- [ ] 03.24 - seems to work
|
||||
// let a = idlock.getspecialuserroles(params.get_sender(), Some(Channel(msg.channel_login.clone()))).await;
|
||||
// botlog::trace(
|
||||
// format!("GETSPECIALUSERROLES RESULT : {:?}",a).as_str(),
|
||||
// Some("Chat > send_botmsg".to_string()),
|
||||
// Some(¶ms.msg),
|
||||
// );
|
||||
// Log::flush();
|
||||
|
||||
|
||||
|
||||
// // botlog::trace(
|
||||
// // "ACQUIRED WRITE LOCK : ID",
|
||||
// // Some("Chat > send_botmsg".to_string()),
|
||||
// // Some(¶ms.msg),
|
||||
// // );
|
||||
// // Log::flush();
|
||||
|
||||
|
||||
|
||||
// botlog::trace(
|
||||
// "ACQUIRED READ LOCK : ID",
|
||||
// Some("Chat > send_botmsg".to_string()),
|
||||
// Some(¶ms.msg),
|
||||
// );
|
||||
// Log::flush();
|
||||
|
||||
|
||||
self.send_botmsg(BotMsgType::SayInReplyTo(
|
||||
destination_channel,
|
||||
reply_message_id,
|
||||
|
@ -508,7 +430,6 @@ impl Chat {
|
|||
|
||||
|
||||
|
||||
// pub async fn say(&self, channel_login: String, message: String) {
|
||||
pub async fn say(&self, channel_login: String, message: String , params : ExecBodyParams) {
|
||||
// more info https://docs.rs/twitch-irc/latest/twitch_irc/client/struct.TwitchIRCClient.html#method.say
|
||||
|
||||
|
|
|
@ -23,13 +23,10 @@ use std::env;
|
|||
|
||||
fn adminvector() -> Vec<String> {
|
||||
vec![String::from("ModulatingForce")]
|
||||
//vec![]
|
||||
}
|
||||
|
||||
|
||||
pub fn otherbots_vector() -> Vec<String> {
|
||||
// vec![String::from("ModulatingForce")]
|
||||
// //vec![]
|
||||
|
||||
dotenv().ok();
|
||||
let mut other_bots = Vec::new();
|
||||
|
@ -1467,7 +1464,6 @@ impl IdentityManager {
|
|||
return ChangeResult::NoChange("Already does not have VIP role".to_string());
|
||||
}
|
||||
else {
|
||||
// self.affirm_chatter_in_db(trgchatter.clone()).await;
|
||||
|
||||
self.remove_role(trgchatter.clone(), UserRole::VIP(channel.clone())).await;
|
||||
|
||||
|
|
|
@ -251,17 +251,6 @@ async fn babygirl(params : ExecBodyParams) {
|
|||
|
||||
sleep(Duration::from_secs_f64(2.0)).await;
|
||||
|
||||
// botlock
|
||||
// .botmgrs
|
||||
// .chat
|
||||
// .say_in_reply_to(
|
||||
// Channel(params.clone().msg.channel_login().to_string()),
|
||||
// params.clone().msg.message_id().to_string(),
|
||||
// String::from("16:13 notohh: baby girl"),
|
||||
// params.clone()
|
||||
// ).await;
|
||||
|
||||
|
||||
botlock
|
||||
.botmgrs
|
||||
.chat
|
||||
|
|
Loading…
Reference in a new issue