functional identity demote,promote,canuserrun
This commit is contained in:
parent
f1155289fa
commit
8d54c4c92c
5 changed files with 827 additions and 55 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -20,3 +20,6 @@ target/
|
||||||
|
|
||||||
# log
|
# log
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
|
# debug
|
||||||
|
.vscode/
|
|
@ -65,6 +65,16 @@ pub mod botlog {
|
||||||
|
|
||||||
// trace, debug, info, notice, warn, error, fatal
|
// 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>) -> ()
|
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))
|
.str("Code_Module",&format!("{:?}",in_module))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn debug(in_msg:&str,in_module:Option<String>,in_prvmsg:Option<&PrivmsgMessage>) -> () {
|
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 twitch_oauth : String,
|
||||||
pub bot_channels : Vec<ChType>,
|
pub bot_channels : Vec<ChType>,
|
||||||
pub botmgrs : BotManagers,
|
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,
|
prefix : prefix,
|
||||||
bot_channel : Channel(login_name) ,
|
bot_channel : Channel(login_name) ,
|
||||||
incoming_messages : Arc::new(RwLock::new(incoming_messages)),
|
incoming_messages : Arc::new(RwLock::new(incoming_messages)),
|
||||||
|
@ -442,10 +466,9 @@ impl BotInstance
|
||||||
twitch_oauth : oauth_token,
|
twitch_oauth : oauth_token,
|
||||||
bot_channels : botchannels,
|
bot_channels : botchannels,
|
||||||
botmgrs : BotManagers::init(ratelimiters,client),
|
botmgrs : BotManagers::init(ratelimiters,client),
|
||||||
};
|
}
|
||||||
|
|
||||||
|
// b
|
||||||
b
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn runner(self) -> () {
|
pub async fn runner(self) -> () {
|
||||||
|
|
|
@ -55,11 +55,12 @@ pub enum ModType {
|
||||||
|
|
||||||
pub use ModType::BotModule;
|
pub use ModType::BotModule;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
// #[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
||||||
pub enum ChType {
|
// pub enum ChType {
|
||||||
Channel(String),
|
// Channel(String),
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
use botinstance::ChType;
|
||||||
|
|
||||||
pub use ChType::Channel;
|
pub use ChType::Channel;
|
||||||
use twitch_irc::message::PrivmsgMessage;
|
use twitch_irc::message::PrivmsgMessage;
|
||||||
|
@ -234,6 +235,20 @@ pub struct ModulesManager
|
||||||
pub botactions: Arc<RwLock<HashMap<ModType,Vec<BotAction>>>>,
|
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
|
impl ModulesManager
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,10 +14,10 @@
|
||||||
|
|
||||||
use std::future::Future;
|
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::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 futures::lock::Mutex;
|
||||||
use twitch_irc::message::PrivmsgMessage;
|
use twitch_irc::message::PrivmsgMessage;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue