mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
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:
parent
924a83966d
commit
fea1b7b0a3
300 changed files with 1003 additions and 3448 deletions
|
|
@ -1,12 +1,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
|
||||
from typing import TYPE_CHECKING, Optional, Union
|
||||
|
||||
from ..types import Message
|
||||
from .base import Request, TelegramMethod
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..client.bot import Bot
|
||||
from ..types.base import UNSET_PROTECT_CONTENT
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class ForwardMessage(TelegramMethod[Message]):
|
||||
|
|
@ -17,6 +15,7 @@ class ForwardMessage(TelegramMethod[Message]):
|
|||
"""
|
||||
|
||||
__returning__ = Message
|
||||
__api_method__ = "forwardMessage"
|
||||
|
||||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
||||
|
|
@ -28,10 +27,5 @@ class ForwardMessage(TelegramMethod[Message]):
|
|||
"""Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
|
||||
protect_content: Optional[bool] = None
|
||||
protect_content: Optional[bool] = UNSET_PROTECT_CONTENT
|
||||
"""Protects the contents of the forwarded message from forwarding and saving"""
|
||||
|
||||
def build_request(self, bot: Bot) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
|
||||
return Request(method="forwardMessage", data=data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue