diff --git a/src/core/identity.rs b/src/core/identity.rs index 35a2c07..1252693 100644 --- a/src/core/identity.rs +++ b/src/core/identity.rs @@ -732,6 +732,13 @@ async fn cmd_promote(params : ExecBodyParams) { */ + + + let botlock = params.bot.read().await; + let id = botlock.get_identity(); + let idlock = id.read().await; + + // [x] 1. Get trgusr (regardless of -admin flag) // let targetusr = if arg1 == Some("-admin") { arg2 } else { arg1 }; @@ -742,16 +749,22 @@ async fn cmd_promote(params : ExecBodyParams) { || arg1 == Some("-m") || arg1 == Some("-mod") { arg2 } + else if let Some(a) = arg1 { + if a.starts_with("-") { + botlock.botmgrs.chat.send_botmsg( + super::chat::BotMsgType::Notif( + "Invalid Argument Flag".to_string() + ), + params.clone(), + ).await; + return + } else { arg1 } + } else { arg1 }; // [x] 2. promote trguser // [x] Get a required lock first - - let botlock = params.bot.read().await; - let id = botlock.get_identity(); - let idlock = id.read().await; - let rslt = match targetusr { Some(targetusr) => { botlog::debug( @@ -934,6 +947,15 @@ async fn cmd_demote(params : ExecBodyParams) { */ + + + // [x] Get a required lock first + + let botlock = params.bot.read().await; + let id = botlock.get_identity(); + let idlock = id.read().await; + + let sendername = params.msg.clone().sender.name; let mut sender_badge_mut: Option = None; @@ -961,6 +983,17 @@ async fn cmd_demote(params : ExecBodyParams) { || arg1 == Some("-m") || arg1 == Some("-mod") { arg2 } + else if let Some(a) = arg1 { + if a.starts_with("-") { + botlock.botmgrs.chat.send_botmsg( + super::chat::BotMsgType::Notif( + "Invalid Argument Flag".to_string() + ), + params.clone(), + ).await; + return + } else { arg1 } + } else { arg1 }; // Note : At the moment, no handling of -admin @@ -983,12 +1016,6 @@ async fn cmd_demote(params : ExecBodyParams) { */ - // [x] Get a required lock first - - let botlock = params.bot.read().await; - let id = botlock.get_identity(); - let idlock = id.read().await; - let rslt = match targetusr { Some(targetusr) => { botlog::debug(