use std::collections::HashMap; use crate::core::botmodules::{ModulesManager,Listener,BotModule,BotActionTrait, BotCommand}; use crate::core::botmodules::bot_actions::actions_util; use crate::core::botinstance::{self}; use twitch_irc::message::PrivmsgMessage; fn adminvector() -> Vec { vec![String::from("ModulatingForce")] } pub fn init(mgr:&mut ModulesManager) { BotCommand { module : BotModule(String::from("identity")), command : String::from("promote"), // command call name alias : vec![], // String of alternative names exec_body : actions_util::asyncbox(cmd_promote) , help : String::from("promote"), required_roles : vec![], }.add_to_modmgr(mgr); async fn cmd_promote(mut _chat:botinstance::Chat,_msg:PrivmsgMessage) { //println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text); } 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![], }.add_to_modmgr(mgr); async fn cmd_demote(mut _chat:botinstance::Chat,_msg:PrivmsgMessage) { } } pub enum UserRole { Chatter, Mod(String), // String specifies Channel SupMod(String), // String specifies Channel Broadcaster, BotAdmin, } pub struct IdentityManager { special_roles_users : HashMap>, } impl IdentityManager { pub fn init() -> IdentityManager { let mut a = HashMap::new(); for admn in adminvector() { a.insert(admn.to_lowercase(),vec![UserRole::BotAdmin]); }; IdentityManager { special_roles_users : a, } } }