(init) identity > promote/demote commands
This commit is contained in:
parent
e63133aee6
commit
9fdb974813
2 changed files with 20 additions and 8 deletions
|
@ -199,6 +199,8 @@ impl ModulesManager
|
||||||
botactions : act,
|
botactions : act,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// initialize core modules
|
||||||
|
crate::core::identity::init(&mut mgr);
|
||||||
|
|
||||||
// initialize custom crate modules
|
// initialize custom crate modules
|
||||||
crate::modules::init(&mut mgr);
|
crate::modules::init(&mut mgr);
|
||||||
|
|
|
@ -24,7 +24,12 @@ pub fn init(mgr:&mut ModulesManager)
|
||||||
alias : vec![], // String of alternative names
|
alias : vec![], // String of alternative names
|
||||||
exec_body : actions_util::asyncbox(cmd_promote) ,
|
exec_body : actions_util::asyncbox(cmd_promote) ,
|
||||||
help : String::from("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);
|
}.add_to_modmgr(mgr);
|
||||||
|
|
||||||
async fn cmd_promote(mut _chat:botinstance::Chat,_msg:PrivmsgMessage) {
|
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
|
alias : vec![], // String of alternative names
|
||||||
exec_body : actions_util::asyncbox(cmd_demote) ,
|
exec_body : actions_util::asyncbox(cmd_demote) ,
|
||||||
help : String::from("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);
|
}.add_to_modmgr(mgr);
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,23 +216,23 @@ impl IdentityManager {
|
||||||
|
|
||||||
ChatBadge::Mod => {
|
ChatBadge::Mod => {
|
||||||
|
|
||||||
println!("Mod Chatbadge detected");
|
// println!("Mod Chatbadge detected");
|
||||||
|
|
||||||
println!("debug special roles : {:?}",self.special_roles_users);
|
// println!("debug special roles : {:?}",self.special_roles_users);
|
||||||
println!("debug usr : {}",&usr.to_lowercase());
|
// println!("debug usr : {}",&usr.to_lowercase());
|
||||||
|
|
||||||
// let Some((k,v)) = self.special_roles_users.get_key_value(usr);
|
// let Some((k,v)) = self.special_roles_users.get_key_value(usr);
|
||||||
match self.special_roles_users.get_mut(&usr.to_lowercase()) {
|
match self.special_roles_users.get_mut(&usr.to_lowercase()) {
|
||||||
Some(usrroles) => {
|
Some(usrroles) => {
|
||||||
println!("contains mod : {}", usrroles.contains(&UserRole::Mod(channelname.clone())));
|
// println!("contains mod : {}", usrroles.contains(&UserRole::Mod(channelname.clone())));
|
||||||
println!("contains supmod : {}", usrroles.contains(&UserRole::SupMod(channelname.clone())));
|
// println!("contains supmod : {}", usrroles.contains(&UserRole::SupMod(channelname.clone())));
|
||||||
if usrroles.contains(&UserRole::Mod(channelname.clone())) ||
|
if usrroles.contains(&UserRole::Mod(channelname.clone())) ||
|
||||||
usrroles.contains(&UserRole::SupMod(channelname.clone())) {
|
usrroles.contains(&UserRole::SupMod(channelname.clone())) {
|
||||||
// Do nothing - this is expected
|
// Do nothing - this is expected
|
||||||
} else {
|
} else {
|
||||||
// in this case, they have a ChatBadge::Mod but should have this for the channel
|
// in this case, they have a ChatBadge::Mod but should have this for the channel
|
||||||
usrroles.push(UserRole::Mod(channelname.clone()));
|
usrroles.push(UserRole::Mod(channelname.clone()));
|
||||||
println!("debug special roles : {:?}",self.special_roles_users);
|
// println!("debug special roles : {:?}",self.special_roles_users);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => ()
|
_ => ()
|
||||||
|
|
Loading…
Reference in a new issue