This commit is contained in:
ModulatingForce 2023-12-19 22:21:56 -05:00
parent 8160bfe6d3
commit f6ee3aae25
2 changed files with 4 additions and 42 deletions

View file

@ -22,7 +22,9 @@ use crate::core::ratelimiter;
// use crate::core::ratelimiter;
struct Channel(String);
enum Ch {
channel(String),
}
pub struct BotInstance {
@ -133,7 +135,7 @@ impl BotInstance {
match contextratelimiter.check_limiter() {
ratelimiter::LimiterResp::Allow => {
let maxblanks = rand::thread_rng().gen_range(1..=5);
let maxblanks = rand::thread_rng().gen_range(1..=20);
//let mut outmsg = "GotTrolled ".to_owned();
let mut outmsg = "annytfLurk ".to_owned();

View file

@ -1,40 +0,0 @@
use std::time::Instant;
pub struct RateLimiter {
channels_attr: Vec<RlAttributes>,
}
struct RlAttributes {
channel: String,
enabled: bool,
start_time: Instant,
msg_counter: u32,
}
impl RateLimiter {
pub fn new() -> Self {
Self {
channels_attr: vec![],
}
}
pub fn sending_msg_to(&mut self, channelname: String) -> bool {
self.channels_attr.push(RlAttributes {
channel: channelname,
enabled: true,
start_time: Instant::now(),
msg_counter: 0,
});
let chanRateLimiter = self.channels_attr
.into_iter()
.filter(|r| r.channel == "Hello")
.collect();
chanRateLimiter.is_empty()
}
}