Merge pull request 'Recognize VIP badge as Special Roles' (#44) from vip-badge into main
All checks were successful
ci/woodpecker/push/cargo-checks Pipeline was successful
ci/woodpecker/pr/cargo-checks Pipeline was successful

Reviewed-on: #44
This commit is contained in:
modulatingforce 2024-03-25 22:38:02 -04:00
commit b9227cc72b
6 changed files with 1056 additions and 516 deletions

View file

@ -465,12 +465,42 @@ impl BotInstance {
};
botlock.botmgrs.chat.say_in_reply_to(
msg,
outstr,
// c.module.clone(),
params
botlock.botmgrs.chat.send_botmsg(super::chat::BotMsgType::Notif(
outstr.to_string()
),
params.clone(),
).await;
}
if innerstr
.to_lowercase()
.contains(&"Auto Promoted VIP".to_lowercase())
{
botlog::notice(
"Assigning VIP UserRole to VIP",
Some("botinstance > listener_main_prvmsg()".to_string()),
Some(msg),
);
let botlock = bot.read().await;
let outstr =
"❤️ a VIP - love ya!".to_string();
let params = ExecBodyParams {
bot : Arc::clone(&bot),
msg : (*msg).clone(),
parent_act : Arc::clone(&act_clone),
};
botlock.botmgrs.chat.send_botmsg(super::chat::BotMsgType::Notif(
outstr.to_string()
),
params.clone(),
).await;
}
}

View file

@ -19,6 +19,10 @@ Example
*/
const OF_CMD_CHANNEL:Channel = Channel(String::new());
use core::panic;
use std::collections::HashMap;
@ -45,8 +49,6 @@ use super::identity::ChatBadge;
pub async fn init(mgr: Arc<ModulesManager>) {
const OF_CMD_CHANNEL:Channel = Channel(String::new());
// 1. Define the BotAction
let botc1 = BotCommand {
module: BotModule(String::from("core")),
@ -143,6 +145,8 @@ pub async fn init(mgr: Arc<ModulesManager>) {
requestor_badge_mut = Some(ChatBadge::Mod);
} else if b.name == "broadcaster" {
requestor_badge_mut = Some(ChatBadge::Broadcaster);
} else if b.name == "vip" {
requestor_badge_mut = Some(ChatBadge::VIP);
}
}
@ -330,6 +334,8 @@ pub async fn init(mgr: Arc<ModulesManager>) {
requestor_badge_mut = Some(ChatBadge::Mod);
} else if b.name == "broadcaster" {
requestor_badge_mut = Some(ChatBadge::Broadcaster);
} else if b.name == "vip" {
requestor_badge_mut = Some(ChatBadge::VIP);
}
}

View file

@ -249,10 +249,12 @@ impl Chat {
// [x] If user has any of the following target roles, they will be allowed - otherwise, they will not be allowed to send
// - Otherwise if not (checked here) , this will not run
// - NOTE : For now, I've removed BotAdmin just for curiosity - BotAdmins can always elevate themselves if they want
// - Will be adding VIP to this as this should include Channel_Level Roles
if !(user_roles.contains(&identity::UserRole::Mod(Channel(channel_login.clone())))
|| user_roles.contains(&identity::UserRole::SupMod(Channel(channel_login.clone())))
|| user_roles.contains(&identity::UserRole::Broadcaster)
|| user_roles.contains(&identity::UserRole::VIP(Channel(channel_login.clone())))
)
{

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,10 @@
*/
const OF_CMD_CHANNEL:Channel = Channel(String::new());
use rand::Rng;
use std::sync::Arc;
@ -26,8 +30,6 @@ use tokio::time::{sleep, Duration};
pub async fn init(mgr: Arc<ModulesManager>) {
const OF_CMD_CHANNEL:Channel = Channel(String::new());
// 1. Define the BotAction
let botc1 = BotCommand {
module: BotModule(String::from("experiments001")),

View file

@ -10,6 +10,10 @@
*/
const OF_CMD_CHANNEL:Channel = Channel(String::new());
use std::sync::Arc;
use chrono::{TimeZone,Local};
@ -28,8 +32,6 @@ use crate::core::identity::UserRole::*;
pub async fn init(mgr: Arc<ModulesManager>) {
const OF_CMD_CHANNEL:Channel = Channel(String::new());
// 1. Define the BotAction
let botc1 = BotCommand {
@ -42,7 +44,8 @@ pub async fn init(mgr: Arc<ModulesManager>) {
help: String::from("Test Command tester"),
required_roles: vec![
BotAdmin,
Mod(OF_CMD_CHANNEL),
// Mod(OF_CMD_CHANNEL),
VIP(OF_CMD_CHANNEL),
],
};