Recognize VIP badge as Special Roles #44

Merged
modulatingforce merged 9 commits from vip-badge into main 2024-03-25 22:38:02 -04:00
Showing only changes of commit e66985814a - Show all commits

View file

@ -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<ChatBadge> = 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(