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

View file

@ -240,7 +240,7 @@ impl BotInstance
// pub fn init() -> BotInstance
// pub fn init() -> Arc<BotInstance>
pub fn init() -> BotInstance
pub async fn init() -> BotInstance
{
dotenv().ok();
@ -295,7 +295,7 @@ impl BotInstance
// ratelimiters : ratelimiters,
// client : client,
// } ,
botmodules : ModulesManager::init(),
botmodules : ModulesManager::init().await,
twitch_oauth : oauth_token,
bot_channels : botchannels,
// identity : IdentityManager::init(),
@ -620,6 +620,7 @@ impl BotInstance
// async fn listener_main_prvmsg(self,msg:&PrivmsgMessage) -> () {
// async fn listener_main_prvmsg(self:Arc<Self>,msg:&PrivmsgMessage) -> () {
pub async fn listener_main_prvmsg(bot:BotAR,msg:&PrivmsgMessage) -> () {
println!(">> Inner listenermain_prvmsg()");
// let a = a;
// println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text);
@ -672,18 +673,25 @@ impl BotInstance
// let hacts = boxed_bot.clone().lock().await.get_botactions();
// let hacts = bot.read().await.get_botactions();
let botlock = bot.read().await;
let hacts = botlock.botmodules.botactions.read().await;
// let hacts = hacts
for (_m,acts) in &(*hacts) {
let hacts = Arc::clone(&botlock.botmodules.botactions);
// let hacts = hacts.read().await;
let a = hacts.read().await;
println!("hacts size : {}",(*a).len());
println!(">> Inner listenermain_prvmsg() >> before for loop of bot actions");
// println!(">> Inner listenermain_prvmsg() >> before for loop of bot actions : {:?}",*hacts);
// let hacts = hacts
// let l = *hacts;
for (_m,acts) in &*hacts.read().await {
println!(">> Inner listenermain_prvmsg() >> checking bot actions");
// let bot = bot;
for a in acts {
println!(">> Inner listenermain_prvmsg() >> checking bot actions >> 2");
let _act = match a {
@ -702,6 +710,8 @@ impl BotInstance
// println!("args : {v}");
// }
println!("Reviewing internal commands");
let inpt = msg.message_text.split("\n").next().expect("ERROR during BotCommand");
let inpt = msg.message_text.split(" ").next().expect("ERROR during BotCommand");
@ -829,7 +839,7 @@ impl BotInstance
let botlock = bot.read().await;
let id = botlock.get_identity();
let id = id.read().await;
let eval= id.can_user_run_PRVMSG(&msg, c.required_roles.clone());
let eval= id.can_user_run_PRVMSG(&msg, c.required_roles.clone()).await;
match eval {
// Ok(Permissible::Allow) => (),
Permissible::Allow => {