[SMALL] used tuples
This commit is contained in:
parent
8bfc2b9b8f
commit
5ec7210dc6
1 changed files with 6 additions and 4 deletions
10
src/main.rs
10
src/main.rs
|
@ -69,16 +69,18 @@ pub async fn main() {
|
||||||
println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text);
|
println!("(#{}) {}: {}", msg.channel_login, msg.sender.name, msg.message_text);
|
||||||
if !ratelimittimer {
|
if !ratelimittimer {
|
||||||
println!("(#{}) > {}", msg.channel_login, "started rate limit timer");
|
println!("(#{}) > {}", msg.channel_login, "started rate limit timer");
|
||||||
ratelimitstart = Instant::now();
|
// ratelimitstart = Instant::now();
|
||||||
ratelimittimer = true;
|
// ratelimittimer = true;
|
||||||
|
( ratelimittimer , ratelimitstart ) = ( true , Instant::now() );
|
||||||
} else if ratelimittimer && ratelimitstart.elapsed().as_secs() < 30 && ratelimitcounter >= 20 {
|
} else if ratelimittimer && ratelimitstart.elapsed().as_secs() < 30 && ratelimitcounter >= 20 {
|
||||||
// skip iteration if rate limit is being reached
|
// skip iteration if rate limit is being reached
|
||||||
println!("(#{}) > {}", msg.channel_login, "rate limit reached");
|
println!("(#{}) > {}", msg.channel_login, "rate limit reached");
|
||||||
continue;
|
continue;
|
||||||
} else if ratelimitstart.elapsed().as_secs() >= 30 {
|
} else if ratelimitstart.elapsed().as_secs() >= 30 {
|
||||||
println!("(#{}) > {}", msg.channel_login, "rate limit timer reset");
|
println!("(#{}) > {}", msg.channel_login, "rate limit timer reset");
|
||||||
ratelimittimer = false;
|
// ratelimittimer = false;
|
||||||
ratelimitcounter = 0;
|
// ratelimitcounter = 0;
|
||||||
|
( ratelimittimer , ratelimitcounter ) = ( false , 0 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
let maxblanks = rand::thread_rng().gen_range(1..=5);
|
let maxblanks = rand::thread_rng().gen_range(1..=5);
|
||||||
|
|
Loading…
Reference in a new issue