self-invoking identity methods

This commit is contained in:
ModulatingForce 2024-04-09 12:32:02 -04:00
parent 74d938751f
commit 16c6b0eebb

View file

@ -255,16 +255,16 @@ async fn cmd_promote(params : ExecBodyParams) {
params.clone(), params.clone(),
).await; ).await;
sleep(Duration::from_secs_f64(1.0)).await; sleep(Duration::from_secs_f64(2.0)).await;
botlock.botmgrs.chat.send_botmsg(super::chat::BotMsgType::Notif( botlock.botmgrs.chat.send_botmsg(super::chat::BotMsgType::Notif(
"... ".to_string() "... chatter getting cucked ...".to_string()
), ),
params.clone(), params.clone(),
).await; ).await;
sleep(Duration::from_secs_f64(2.0)).await; sleep(Duration::from_secs_f64(1.0)).await;
} }
} }
@ -608,6 +608,8 @@ async fn getroles(params : ExecBodyParams) {
*/ */
let sendername = params.msg.clone().sender.name;
let mut argv = params.msg.message_text.split(' '); let mut argv = params.msg.message_text.split(' ');
@ -615,11 +617,17 @@ async fn getroles(params : ExecBodyParams) {
let arg1 = argv.next(); let arg1 = argv.next();
let targetuser = match arg1 { let mut targetuser = match arg1 {
None => return, // exit if no arguments // None => return, // exit if no arguments
None => sendername.as_str(), // self-invoke in this case
Some(arg) => arg, Some(arg) => arg,
}; };
targetuser = match twitch_irc::validate::validate_login(targetuser.to_lowercase().as_str()) {
Ok(_) => targetuser,
Err(_) => sendername.as_str(), // self-invoke in this case
};
let arg2 = argv.next(); let arg2 = argv.next();
let targetchnl = arg2; let targetchnl = arg2;
@ -703,7 +711,9 @@ async fn getroles(params : ExecBodyParams) {
params.msg.channel_login.to_lowercase(), params.msg.channel_login.to_lowercase(),
))) || sproles.contains(&UserRole::BotAdmin) ))) || sproles.contains(&UserRole::BotAdmin)
{ {
outmsg += format!("Target chatter's user roles are : {:?}", sproles).as_str(); // targetuser
// outmsg += format!("Target chatter's user roles are : {:?}", sproles).as_str();
outmsg += format!("{}'s user roles are : {:?}", targetuser, sproles).as_str();
} }
outmsg outmsg
} else if sproles.contains(&UserRole::Mod(Channel( } else if sproles.contains(&UserRole::Mod(Channel(
@ -712,9 +722,10 @@ async fn getroles(params : ExecBodyParams) {
params.msg.channel_login.to_lowercase(), params.msg.channel_login.to_lowercase(),
))) || sproles.contains(&UserRole::BotAdmin) ))) || sproles.contains(&UserRole::BotAdmin)
{ {
format!("Target chatter's user roles are : {:?}", sproles) // format!("Target chatter's user roles are : {:?}", sproles)
format!("{}'s user roles are : {:?}", targetuser, sproles)
} else { } else {
"Target chatter has no special roles LULE ".to_string() format!("{} has no special roles LULE ",targetuser)
}; };
botlog::debug( botlog::debug(