Reworked request builder (#1142)

* Reworked request builder

* Added more default values

* Update tests

* Fixed timestamp

* Fixed Py3.8 support

* Describe changes
This commit is contained in:
Alex Root Junior 2023-03-11 20:46:36 +02:00 committed by GitHub
parent 924a83966d
commit fea1b7b0a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
300 changed files with 1003 additions and 3448 deletions

View file

@ -1,11 +1,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional
from typing import TYPE_CHECKING, Optional
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
from .base import TelegramMethod
class AnswerCallbackQuery(TelegramMethod[bool]):
@ -18,6 +15,7 @@ class AnswerCallbackQuery(TelegramMethod[bool]):
"""
__returning__ = bool
__api_method__ = "answerCallbackQuery"
callback_query_id: str
"""Unique identifier for the query to be answered"""
@ -29,8 +27,3 @@ class AnswerCallbackQuery(TelegramMethod[bool]):
"""URL that will be opened by the user's client. If you have created a :class:`aiogram.types.game.Game` and accepted the conditions via `@BotFather <https://t.me/botfather>`_, specify the URL that opens your game - note that this will only work if the query comes from a `https://core.telegram.org/bots/api#inlinekeyboardbutton <https://core.telegram.org/bots/api#inlinekeyboardbutton>`_ *callback_game* button."""
cache_time: Optional[int] = None
"""The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0."""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="answerCallbackQuery", data=data)