Merge pull request 'Recognize VIP badge as Special Roles' (#44) from vip-badge into main
Reviewed-on: #44
This commit is contained in:
commit
b9227cc72b
6 changed files with 1056 additions and 516 deletions
|
@ -465,12 +465,42 @@ impl BotInstance {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
botlock.botmgrs.chat.say_in_reply_to(
|
botlock.botmgrs.chat.send_botmsg(super::chat::BotMsgType::Notif(
|
||||||
msg,
|
outstr.to_string()
|
||||||
outstr,
|
),
|
||||||
// c.module.clone(),
|
params.clone(),
|
||||||
params
|
|
||||||
).await;
|
).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;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,10 @@ Example
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
const OF_CMD_CHANNEL:Channel = Channel(String::new());
|
||||||
|
|
||||||
|
|
||||||
use core::panic;
|
use core::panic;
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
@ -45,8 +49,6 @@ use super::identity::ChatBadge;
|
||||||
|
|
||||||
pub async fn init(mgr: Arc<ModulesManager>) {
|
pub async fn init(mgr: Arc<ModulesManager>) {
|
||||||
|
|
||||||
const OF_CMD_CHANNEL:Channel = Channel(String::new());
|
|
||||||
|
|
||||||
// 1. Define the BotAction
|
// 1. Define the BotAction
|
||||||
let botc1 = BotCommand {
|
let botc1 = BotCommand {
|
||||||
module: BotModule(String::from("core")),
|
module: BotModule(String::from("core")),
|
||||||
|
@ -143,6 +145,8 @@ pub async fn init(mgr: Arc<ModulesManager>) {
|
||||||
requestor_badge_mut = Some(ChatBadge::Mod);
|
requestor_badge_mut = Some(ChatBadge::Mod);
|
||||||
} else if b.name == "broadcaster" {
|
} else if b.name == "broadcaster" {
|
||||||
requestor_badge_mut = Some(ChatBadge::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);
|
requestor_badge_mut = Some(ChatBadge::Mod);
|
||||||
} else if b.name == "broadcaster" {
|
} else if b.name == "broadcaster" {
|
||||||
requestor_badge_mut = Some(ChatBadge::Broadcaster);
|
requestor_badge_mut = Some(ChatBadge::Broadcaster);
|
||||||
|
} else if b.name == "vip" {
|
||||||
|
requestor_badge_mut = Some(ChatBadge::VIP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
// [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
|
// - 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
|
// - 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())))
|
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::SupMod(Channel(channel_login.clone())))
|
||||||
|| user_roles.contains(&identity::UserRole::Broadcaster)
|
|| user_roles.contains(&identity::UserRole::Broadcaster)
|
||||||
|
|| user_roles.contains(&identity::UserRole::VIP(Channel(channel_login.clone())))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
1505
src/core/identity.rs
1505
src/core/identity.rs
File diff suppressed because it is too large
Load diff
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
const OF_CMD_CHANNEL:Channel = Channel(String::new());
|
||||||
|
|
||||||
|
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
@ -26,8 +30,6 @@ use tokio::time::{sleep, Duration};
|
||||||
|
|
||||||
pub async fn init(mgr: Arc<ModulesManager>) {
|
pub async fn init(mgr: Arc<ModulesManager>) {
|
||||||
|
|
||||||
const OF_CMD_CHANNEL:Channel = Channel(String::new());
|
|
||||||
|
|
||||||
// 1. Define the BotAction
|
// 1. Define the BotAction
|
||||||
let botc1 = BotCommand {
|
let botc1 = BotCommand {
|
||||||
module: BotModule(String::from("experiments001")),
|
module: BotModule(String::from("experiments001")),
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
const OF_CMD_CHANNEL:Channel = Channel(String::new());
|
||||||
|
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use chrono::{TimeZone,Local};
|
use chrono::{TimeZone,Local};
|
||||||
|
@ -28,8 +32,6 @@ use crate::core::identity::UserRole::*;
|
||||||
|
|
||||||
pub async fn init(mgr: Arc<ModulesManager>) {
|
pub async fn init(mgr: Arc<ModulesManager>) {
|
||||||
|
|
||||||
const OF_CMD_CHANNEL:Channel = Channel(String::new());
|
|
||||||
|
|
||||||
|
|
||||||
// 1. Define the BotAction
|
// 1. Define the BotAction
|
||||||
let botc1 = BotCommand {
|
let botc1 = BotCommand {
|
||||||
|
@ -42,7 +44,8 @@ pub async fn init(mgr: Arc<ModulesManager>) {
|
||||||
help: String::from("Test Command tester"),
|
help: String::from("Test Command tester"),
|
||||||
required_roles: vec![
|
required_roles: vec![
|
||||||
BotAdmin,
|
BotAdmin,
|
||||||
Mod(OF_CMD_CHANNEL),
|
// Mod(OF_CMD_CHANNEL),
|
||||||
|
VIP(OF_CMD_CHANNEL),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue