From 7d2c833635a22b2bf45322818748e0523a4be164 Mon Sep 17 00:00:00 2001 From: hikariatama Date: Sat, 4 Mar 2023 12:00:58 +0000 Subject: [PATCH] Whitelist GetChannelDifferenceRequest from api protection --- hikka/modules/api_protection.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hikka/modules/api_protection.py b/hikka/modules/api_protection.py index ce7dade..95fe94e 100644 --- a/hikka/modules/api_protection.py +++ b/hikka/modules/api_protection.py @@ -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()]]