comments cleanup

This commit is contained in:
ModulatingForce 2023-12-20 20:27:01 -05:00
parent 0df3a0e648
commit f0028f6751

View file

@ -27,16 +27,6 @@ pub enum ChType {
Channel(String), Channel(String),
} }
// impl PartialEq for ChType {
// fn eq(&self, other:&Self) -> bool {
// let Channel(chnlstr1) = self;
// let Channel(chnlstr2) = other;
// chnlstr1 == chnlstr2
// }
// }
// impl Eq for ChType {}
pub use ChType::Channel; pub use ChType::Channel;
@ -63,7 +53,6 @@ impl BotInstance {
pub fn init() -> BotInstance { pub fn init() -> BotInstance {
dotenv().ok(); dotenv().ok();
// let login_name = "modulatingforcebot".to_owned();
let login_name = env::var("login_name").unwrap().to_owned(); let login_name = env::var("login_name").unwrap().to_owned();
let oauth_token = env::var("access_token").unwrap().to_owned(); let oauth_token = env::var("access_token").unwrap().to_owned();
let prefix = env::var("prefix").unwrap().to_owned().chars().next().expect("ERROR : when defining prefix"); let prefix = env::var("prefix").unwrap().to_owned().chars().next().expect("ERROR : when defining prefix");
@ -72,15 +61,8 @@ impl BotInstance {
Vector of channels to join Vector of channels to join
*/ */
// let chnl = Channel(String::from("modulatingforcebot"));
let mut botchannels = Vec::new(); let mut botchannels = Vec::new();
// for chnl in env::var("bot_channels").unwrap().split(',') {
// // println!("(Env Var # {})",chnl);
// botchannels.push(String::from(chnl));
// }
for chnl in env::var("bot_channels").unwrap().split(',') { for chnl in env::var("bot_channels").unwrap().split(',') {
// println!("(Env Var # {})",chnl); // println!("(Env Var # {})",chnl);
botchannels.push(Channel(String::from(chnl))); botchannels.push(Channel(String::from(chnl)));
@ -101,6 +83,7 @@ impl BotInstance {
client.join(chnl.to_owned()).unwrap(); client.join(chnl.to_owned()).unwrap();
// ratelimiters are a hashmap of channel and a corresponding rate limiter
let n = RateLimiter::new(); let n = RateLimiter::new();
ratelimiters.insert(Channel(String::from(chnl)),n); ratelimiters.insert(Channel(String::from(chnl)),n);
} }
@ -108,10 +91,8 @@ impl BotInstance {
let b = BotInstance { let b = BotInstance {
//prefix : '>',
prefix : prefix, prefix : prefix,
bot_channel : Channel(login_name) , bot_channel : Channel(login_name) ,
// tclient : TwitchClient { incoming_messages , client },
incoming_messages : incoming_messages, incoming_messages : incoming_messages,
client : client, client : client,
ratelimiters : ratelimiters, // used to limit messages sent per channel ratelimiters : ratelimiters, // used to limit messages sent per channel
@ -125,14 +106,6 @@ impl BotInstance {
// identity : identitymodule, // identity : identitymodule,
}; };
// ratelimiters are a hashmap of channel and a corresponding rate limiter
// let mut ratelimiters:HashMap<String,RateLimiter> = HashMap::new();
// for chnl in &b.bot_channels {
// let n = RateLimiter::new();
// // b.ratelimiters.insert(chnl.to_owned(),n);
// b.ratelimiters.insert(chnl,n);
// }
println!("{:?}",b.ratelimiters); println!("{:?}",b.ratelimiters);