Whitelist GetChannelDifferenceRequest from api protection

pull/1/head
hikariatama 2023-03-04 12:00:58 +00:00
parent 70d57b7cdf
commit 7d2c833635
1 changed files with 8 additions and 3 deletions

View File

@ -12,6 +12,7 @@ import random
import time
from hikkatl.tl import functions
from hikkatl.tl.functions.updates import GetChannelDifferenceRequest
from hikkatl.tl.tlobject import TLRequest
from hikkatl.tl.types import Message
@ -600,9 +601,13 @@ class APIRatelimiterMod(loader.Module):
flood_sleep_threshold: int = None,
):
await asyncio.sleep(random.randint(1, 5) / 100)
if time.perf_counter() > self._suspend_until and not self.get(
"disable_protection",
True,
if (
time.perf_counter() > self._suspend_until
and not self.get(
"disable_protection",
True,
)
and not isinstance(request, GetChannelDifferenceRequest)
):
request_name = type(request).__name__
self._ratelimiter += [[request_name, time.perf_counter()]]