2024.02.12 - GetRole() Works

This commit is contained in:
ModulatingForce 2024-02-12 02:34:32 -05:00
commit cc11479bf2
4 changed files with 91 additions and 25 deletions
src/core

View file

@ -29,12 +29,14 @@ fn adminvector() -> Vec<String> {
// pub fn init(mgr:&mut ModulesManager)
pub fn init(mgr:Arc<ModulesManager>)
pub async fn init(mgr:Arc<ModulesManager>)
{
let a = actions_util::asyncbox(cmd_promote) ;
println!("Went into Identiy Module init");
BotCommand {
// let a = actions_util::asyncbox(cmd_promote) ;
let tempb = BotCommand {
module : BotModule(String::from("identity")),
command : String::from("promote"), // command call name
alias : vec![], // String of alternative names
@ -46,7 +48,9 @@ pub fn init(mgr:Arc<ModulesManager>)
UserRole::Broadcaster,
UserRole::BotAdmin,
],
}.add_to_modmgr(Arc::clone(&mgr));
};
tempb.add_to_modmgr(Arc::clone(&mgr));
// async fn cmd_promote(mut bot:Arc<Mutex<BotInstance>>,msg:PrivmsgMessage)
// async fn cmd_promote(mut bot:&BotInstance,msg:PrivmsgMessage) -> &BotInstance
@ -246,7 +250,21 @@ pub fn init(mgr:Arc<ModulesManager>)
}
BotCommand {
// BotCommand {
// module : BotModule(String::from("identity")),
// command : String::from("demote"), // command call name
// alias : vec![], // String of alternative names
// exec_body : actions_util::asyncbox(cmd_demote) ,
// help : String::from("demote"),
// required_roles : vec![
// UserRole::Mod(ChType::Channel(String::new())),
// UserRole::SupMod(ChType::Channel(String::new())),
// UserRole::Broadcaster,
// UserRole::BotAdmin,
// ],
// }.add_to_modmgr(Arc::clone(&mgr));
let tempb = BotCommand {
module : BotModule(String::from("identity")),
command : String::from("demote"), // command call name
alias : vec![], // String of alternative names
@ -258,8 +276,9 @@ pub fn init(mgr:Arc<ModulesManager>)
UserRole::Broadcaster,
UserRole::BotAdmin,
],
}.add_to_modmgr(Arc::clone(&mgr));
};
tempb.add_to_modmgr(Arc::clone(&mgr)).await;
// async fn cmd_demote(mut _chat:Arc<Mutex<BotInstance>>,_msg:PrivmsgMessage) {
async fn cmd_demote(mut _chat:BotAR,_msg:PrivmsgMessage) {
@ -268,7 +287,21 @@ pub fn init(mgr:Arc<ModulesManager>)
BotCommand {
// BotCommand {
// module : BotModule(String::from("identity")),
// command : String::from("getroles"), // command call name
// alias : vec![], // String of alternative names
// exec_body : actions_util::asyncbox(getroles) ,
// help : String::from("getroles"),
// required_roles : vec![
// UserRole::Mod(ChType::Channel(String::new())),
// UserRole::SupMod(ChType::Channel(String::new())),
// UserRole::Broadcaster,
// UserRole::BotAdmin,
// ],
// }.add_to_modmgr(Arc::clone(&mgr));
let tempcomm = BotCommand {
module : BotModule(String::from("identity")),
command : String::from("getroles"), // command call name
alias : vec![], // String of alternative names
@ -280,7 +313,9 @@ pub fn init(mgr:Arc<ModulesManager>)
UserRole::Broadcaster,
UserRole::BotAdmin,
],
}.add_to_modmgr(Arc::clone(&mgr));
};
tempcomm.add_to_modmgr(Arc::clone(&mgr)).await;
// async fn getroles(bot:Arc<Mutex<BotInstance>>,msg:PrivmsgMessage) {
@ -401,7 +436,7 @@ pub fn init(mgr:Arc<ModulesManager>)
println!("End of Init MOdule add");
}
@ -467,7 +502,7 @@ impl IdentityManager {
// pub fn can_user_run_PRVMSG(self,msg:&PrivmsgMessage,cmdreqroles:Vec<UserRole>) -> Result<Permissible,Box<dyn Error>>
// pub fn can_user_run_PRVMSG(&self,msg:&PrivmsgMessage,cmdreqroles:Vec<UserRole>) -> Permissible
// pub async fn can_user_run_PRVMSG(self,msg:&PrivmsgMessage,cmdreqroles:Vec<UserRole>) -> Permissible
pub fn can_user_run_PRVMSG(&self,msg:&PrivmsgMessage,cmdreqroles:Vec<UserRole>) -> Permissible
pub async fn can_user_run_PRVMSG(&self,msg:&PrivmsgMessage,cmdreqroles:Vec<UserRole>) -> Permissible
{
// println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text);
@ -513,7 +548,7 @@ impl IdentityManager {
ChType::Channel(msg.channel_login.to_owned()),
sender_badge,
cmdreqroles
) ;
).await ;
}