promote/demote checks invalid arg flag
All checks were successful
ci/woodpecker/pr/cargo-checks Pipeline was successful
All checks were successful
ci/woodpecker/pr/cargo-checks Pipeline was successful
This commit is contained in:
parent
df6fe8ccb7
commit
e66985814a
1 changed files with 38 additions and 11 deletions
|
@ -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)
|
// [x] 1. Get trgusr (regardless of -admin flag)
|
||||||
|
|
||||||
// let targetusr = if arg1 == Some("-admin") { arg2 } else { arg1 };
|
// let targetusr = if arg1 == Some("-admin") { arg2 } else { arg1 };
|
||||||
|
@ -742,16 +749,22 @@ async fn cmd_promote(params : ExecBodyParams) {
|
||||||
|| arg1 == Some("-m")
|
|| arg1 == Some("-m")
|
||||||
|| arg1 == Some("-mod")
|
|| arg1 == Some("-mod")
|
||||||
{ arg2 }
|
{ 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 };
|
else { arg1 };
|
||||||
|
|
||||||
// [x] 2. promote trguser
|
// [x] 2. promote trguser
|
||||||
|
|
||||||
// [x] Get a required lock first
|
// [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 {
|
let rslt = match targetusr {
|
||||||
Some(targetusr) => {
|
Some(targetusr) => {
|
||||||
botlog::debug(
|
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 sendername = params.msg.clone().sender.name;
|
||||||
|
|
||||||
let mut sender_badge_mut: Option<ChatBadge> = None;
|
let mut sender_badge_mut: Option<ChatBadge> = None;
|
||||||
|
@ -961,6 +983,17 @@ async fn cmd_demote(params : ExecBodyParams) {
|
||||||
|| arg1 == Some("-m")
|
|| arg1 == Some("-m")
|
||||||
|| arg1 == Some("-mod")
|
|| arg1 == Some("-mod")
|
||||||
{ arg2 }
|
{ 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 };
|
else { arg1 };
|
||||||
|
|
||||||
// Note : At the moment, no handling of -admin
|
// 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 {
|
let rslt = match targetusr {
|
||||||
Some(targetusr) => {
|
Some(targetusr) => {
|
||||||
botlog::debug(
|
botlog::debug(
|
||||||
|
|
Loading…
Reference in a new issue