(init) Identity Module

This commit is contained in:
ModulatingForce 2024-01-29 06:18:27 -05:00
commit 422cd93303
3 changed files with 50 additions and 2 deletions

View file

@ -22,6 +22,8 @@ use crate::core::ratelimiter;
use crate::core::botmodules;
use crate::core::botmodules::ModulesManager;
use crate::core::identity::IdentityManager;
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
pub enum ChType {
@ -137,6 +139,7 @@ pub struct BotInstance
pub botmodules : ModulesManager,
twitch_oauth : String,
pub bot_channels : Vec<ChType>,
pub identity : IdentityManager,
}
@ -203,6 +206,7 @@ impl BotInstance
botmodules : ModulesManager::init(),
twitch_oauth : oauth_token,
bot_channels : botchannels,
identity : IdentityManager::init(),
};
@ -288,19 +292,26 @@ impl BotInstance
// [x] Check if a bot command based on ...
// [x] prefix + command
let mut exec_bot_command = false;
if inpt == self.prefix.to_string() + c.command.as_str() {
c.execute(self.chat.clone(), msg.clone()).await;
exec_bot_command = true;
}
// [x] prefix + alias
for alias in &c.alias {
if inpt == self.prefix.to_string() + alias.as_str() {
c.execute(self.chat.clone(), msg.clone()).await;
exec_bot_command = true;
}
}
if exec_bot_command {
c.execute(self.chat.clone(), msg.clone()).await;
}
},
crate::core::botmodules::BotAction::L(l) => l.execute(self.chat.clone(), msg.clone()).await,
_ => (),
}
}