functional identity demote,promote,canuserrun

This commit is contained in:
ModulatingForce 2024-02-18 15:23:58 -05:00
parent f1155289fa
commit 8d54c4c92c
5 changed files with 827 additions and 55 deletions

3
.gitignore vendored
View file

@ -20,3 +20,6 @@ target/
# log
*.log
# debug
.vscode/

View file

@ -65,6 +65,16 @@ pub mod botlog {
// trace, debug, info, notice, warn, error, fatal
/*
in main : Log::debug("Checking bot actions", Some("main()".to_string()), None);
in log :
[blalba@timestmp]
debug = "Checking bot actions",
*/
pub fn trace(in_msg:&str,in_module:Option<String>,in_prvmsg:Option<&PrivmsgMessage>) -> ()
{
@ -86,6 +96,8 @@ pub mod botlog {
.str("Code_Module",&format!("{:?}",in_module))
);
}
pub fn debug(in_msg:&str,in_module:Option<String>,in_prvmsg:Option<&PrivmsgMessage>) -> () {
@ -384,6 +396,8 @@ pub struct BotInstance
pub twitch_oauth : String,
pub bot_channels : Vec<ChType>,
pub botmgrs : BotManagers,
//modesmgr : ModesManager, // Silent/Quiet , uwu , frisky/horny
}
@ -434,7 +448,17 @@ impl BotInstance
let b = BotInstance {
// let b = BotInstance {
// prefix : prefix,
// bot_channel : Channel(login_name) ,
// incoming_messages : Arc::new(RwLock::new(incoming_messages)),
// botmodules : ModulesManager::init().await,
// twitch_oauth : oauth_token,
// bot_channels : botchannels,
// botmgrs : BotManagers::init(ratelimiters,client),
// };
BotInstance {
prefix : prefix,
bot_channel : Channel(login_name) ,
incoming_messages : Arc::new(RwLock::new(incoming_messages)),
@ -442,10 +466,9 @@ impl BotInstance
twitch_oauth : oauth_token,
bot_channels : botchannels,
botmgrs : BotManagers::init(ratelimiters,client),
};
}
b
// b
}
pub async fn runner(self) -> () {

View file

@ -55,11 +55,12 @@ pub enum ModType {
pub use ModType::BotModule;
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
pub enum ChType {
Channel(String),
}
// #[derive(Debug, PartialEq, Eq, Hash, Clone)]
// pub enum ChType {
// Channel(String),
// }
use botinstance::ChType;
pub use ChType::Channel;
use twitch_irc::message::PrivmsgMessage;
@ -234,6 +235,20 @@ pub struct ModulesManager
pub botactions: Arc<RwLock<HashMap<ModType,Vec<BotAction>>>>,
}
/*
statusdb
<HashMap
<ModType, <-- e.g., BotModule(String::from("experiments001"))
Vec<ModStatusType> <-- shows Enabled/Disabled per Status level
botactions
HashMap<
ModType, <-- e.g., BotModule(String::from("experiments001"))
Vec<BotAction>> BotCommand, Listener
*/
impl ModulesManager
{

File diff suppressed because it is too large Load diff

View file

@ -14,10 +14,10 @@
use std::future::Future;
use crate::core::botmodules::{ModulesManager,Listener,BotModule,BotActionTrait, BotCommand,ChType};
use crate::core::botmodules::{ModulesManager,Listener,BotModule,BotActionTrait, BotCommand};
use crate::core::botmodules::bot_actions::actions_util::{self, BotAR};
use crate::core::botinstance::{self,BotInstance};
use crate::core::botinstance::{self,BotInstance,ChType};
use futures::lock::Mutex;
use twitch_irc::message::PrivmsgMessage;