dev into main #15

Merged
modulatingforce merged 40 commits from dev into main 2024-02-25 11:31:11 -05:00
2 changed files with 20 additions and 8 deletions
Showing only changes of commit b2dc82ee90 - Show all commits

View file

@ -199,6 +199,8 @@ impl ModulesManager
botactions : act,
};
// initialize core modules
crate::core::identity::init(&mut mgr);
// initialize custom crate modules
crate::modules::init(&mut mgr);

View file

@ -24,7 +24,12 @@ pub fn init(mgr:&mut ModulesManager)
alias : vec![], // String of alternative names
exec_body : actions_util::asyncbox(cmd_promote) ,
help : String::from("promote"),
required_roles : vec![],
required_roles : vec![
UserRole::Mod(ChType::Channel(String::new())),
UserRole::SupMod(ChType::Channel(String::new())),
UserRole::Broadcaster,
UserRole::BotAdmin,
],
}.add_to_modmgr(mgr);
async fn cmd_promote(mut _chat:botinstance::Chat,_msg:PrivmsgMessage) {
@ -39,7 +44,12 @@ pub fn init(mgr:&mut ModulesManager)
alias : vec![], // String of alternative names
exec_body : actions_util::asyncbox(cmd_demote) ,
help : String::from("demote"),
required_roles : vec![],
required_roles : vec![
UserRole::Mod(ChType::Channel(String::new())),
UserRole::SupMod(ChType::Channel(String::new())),
UserRole::Broadcaster,
UserRole::BotAdmin,
],
}.add_to_modmgr(mgr);
@ -206,23 +216,23 @@ impl IdentityManager {
ChatBadge::Mod => {
println!("Mod Chatbadge detected");
// println!("Mod Chatbadge detected");
println!("debug special roles : {:?}",self.special_roles_users);
println!("debug usr : {}",&usr.to_lowercase());
// println!("debug special roles : {:?}",self.special_roles_users);
// println!("debug usr : {}",&usr.to_lowercase());
// let Some((k,v)) = self.special_roles_users.get_key_value(usr);
match self.special_roles_users.get_mut(&usr.to_lowercase()) {
Some(usrroles) => {
println!("contains mod : {}", usrroles.contains(&UserRole::Mod(channelname.clone())));
println!("contains supmod : {}", usrroles.contains(&UserRole::SupMod(channelname.clone())));
// println!("contains mod : {}", usrroles.contains(&UserRole::Mod(channelname.clone())));
// println!("contains supmod : {}", usrroles.contains(&UserRole::SupMod(channelname.clone())));
if usrroles.contains(&UserRole::Mod(channelname.clone())) ||
usrroles.contains(&UserRole::SupMod(channelname.clone())) {
// Do nothing - this is expected
} else {
// in this case, they have a ChatBadge::Mod but should have this for the channel
usrroles.push(UserRole::Mod(channelname.clone()));
println!("debug special roles : {:?}",self.special_roles_users);
// println!("debug special roles : {:?}",self.special_roles_users);
}
},
_ => ()