This commit is contained in:
N3XT3R 2026-04-04 17:10:08 +00:00 committed by GitHub
commit 34cf8e765a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View file

@ -21,7 +21,7 @@ def check_signature(token: str, hash: str, **kwargs: Any) -> bool:
check_string.encode("utf-8"), check_string.encode("utf-8"),
digestmod=hashlib.sha256, digestmod=hashlib.sha256,
).hexdigest() ).hexdigest()
return hmac_string == hash return hmac.compare_digest(hmac_string, hash)
def check_integrity(token: str, data: dict[str, Any]) -> bool: def check_integrity(token: str, data: dict[str, Any]) -> bool:

View file

@ -65,7 +65,10 @@ class Backoff:
await asyncio.sleep(next(self)) await asyncio.sleep(next(self))
def _calculate_next(self, value: float) -> float: def _calculate_next(self, value: float) -> float:
return normalvariate(min(value * self.factor, self.max_delay), self.jitter) return max(
self.min_delay,
normalvariate(min(value * self.factor, self.max_delay), self.jitter),
)
def __next__(self) -> float: def __next__(self) -> float:
self._current_delay = self._next_delay self._current_delay = self._next_delay

View file

@ -351,6 +351,10 @@ class MediaGroupBuilder:
:return: List of media objects. :return: List of media objects.
""" """
if not self._media:
msg = "Media group must contain at least one media element"
raise ValueError(msg)
update_first_media: dict[str, Any] = {"caption": self.caption} update_first_media: dict[str, Any] = {"caption": self.caption}
if self.caption_entities is not None: if self.caption_entities is not None:
update_first_media["caption_entities"] = self.caption_entities update_first_media["caption_entities"] = self.caption_entities