Commit 90d52e7c authored by alan's avatar alan
Browse files

fixed off by one

parent 9aaf850d
......@@ -54,18 +54,18 @@ def is_rate_limited(cmd="test", short=3, max=10, short_period=timedelta(minutes=
#print(f"have {len(dates)}, short are {len(sh_dates)}")
#print([str(now-x) for x in dates])
if len(dates) > max:
if len(dates) >= max:
error(f"Maximum {cmd} limit ({max}) reached.")
return True
if len(sh_dates) > short:
if len(sh_dates) >= short:
error(f"Maximum {cmd} limit ({short}) in the last {short_period.total_seconds()/60} minutes reached.")
error(f"You can try again in {short_period - (now-dates[0])}.")
return True
if len(sh_dates) > 0:
warn(f"You have already used {len(sh_dates)} of {short} checks in the last {short_period.total_seconds()/60} minutes!")
if len(dates) > max / 2:
if len(dates) >= max / 2:
warn(f"You have already used {len(dates)} of {max} total checks!")
return False
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment