Make PTB Specific Keyword-Only Arguments for PTB Specific in Bot methods (#3035)

* Introduce keyword-only arguments in Bot methods

* partial code review fix

* tests, code rev changes

* flake8

* tests, code rev, more shortcut methods

* One more iteration on `check_shortcut_signature`

* Update tests/conftest.py

Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>

Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
This commit is contained in:
tal66 2022-05-18 18:18:44 +03:00 committed by GitHub
parent c1041655f6
commit 076955d04d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 1079 additions and 619 deletions

File diff suppressed because it is too large Load diff

View file

@ -152,6 +152,7 @@ class CallbackQuery(TelegramObject):
show_alert: bool = None,
url: str = None,
cache_time: int = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -188,12 +189,13 @@ class CallbackQuery(TelegramObject):
parse_mode: ODVInput[str] = DEFAULT_NONE,
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
reply_markup: "InlineKeyboardMarkup" = None,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
) -> Union[Message, bool]:
"""Shortcut for either::
@ -245,13 +247,14 @@ class CallbackQuery(TelegramObject):
self,
caption: str = None,
reply_markup: "InlineKeyboardMarkup" = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
) -> Union[Message, bool]:
"""Shortcut for either::
@ -301,6 +304,7 @@ class CallbackQuery(TelegramObject):
async def edit_message_reply_markup(
self,
reply_markup: Optional["InlineKeyboardMarkup"] = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -358,6 +362,7 @@ class CallbackQuery(TelegramObject):
self,
media: "InputMedia",
reply_markup: "InlineKeyboardMarkup" = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -408,16 +413,17 @@ class CallbackQuery(TelegramObject):
self,
latitude: float = None,
longitude: float = None,
location: Location = None,
reply_markup: "InlineKeyboardMarkup" = None,
horizontal_accuracy: float = None,
heading: int = None,
proximity_alert_radius: int = None,
*,
location: Location = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
horizontal_accuracy: float = None,
heading: int = None,
proximity_alert_radius: int = None,
) -> Union[Message, bool]:
"""Shortcut for either::
@ -475,6 +481,7 @@ class CallbackQuery(TelegramObject):
async def stop_message_live_location(
self,
reply_markup: "InlineKeyboardMarkup" = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -528,6 +535,7 @@ class CallbackQuery(TelegramObject):
score: int,
force: bool = None,
disable_edit_message: bool = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -581,6 +589,7 @@ class CallbackQuery(TelegramObject):
async def get_game_high_scores(
self,
user_id: Union[int, str],
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -627,6 +636,7 @@ class CallbackQuery(TelegramObject):
async def delete_message(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -655,6 +665,7 @@ class CallbackQuery(TelegramObject):
async def pin_message(
self,
disable_notification: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -683,6 +694,7 @@ class CallbackQuery(TelegramObject):
async def unpin_message(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -718,12 +730,13 @@ class CallbackQuery(TelegramObject):
reply_to_message_id: int = None,
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
reply_markup: ReplyMarkup = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "MessageId":
"""Shortcut for::

View file

@ -66,7 +66,12 @@ class Chat(TelegramObject):
considered equal, if their :attr:`id` is equal.
.. versionchanged:: 20.0
Removed the deprecated methods ``kick_member`` and ``get_members_count``.
* Removed the deprecated methods ``kick_member`` and ``get_members_count``.
* The following are now keyword-only arguments in Bot methods:
``location``, ``filename``, ``contact``, ``{read, write, connect, pool}_timeout``,
``api_kwargs``. Use a named argument for those,
and notice that some positional arguments changed position as a result.
Args:
id (:obj:`int`): Unique identifier for this chat. This number may be greater than 32 bits
@ -305,6 +310,7 @@ class Chat(TelegramObject):
async def leave(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -332,6 +338,7 @@ class Chat(TelegramObject):
async def get_administrators(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -363,6 +370,7 @@ class Chat(TelegramObject):
async def get_member_count(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -391,6 +399,7 @@ class Chat(TelegramObject):
async def get_member(
self,
user_id: Union[str, int],
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -420,13 +429,14 @@ class Chat(TelegramObject):
async def ban_member(
self,
user_id: Union[str, int],
revoke_messages: bool = None,
until_date: Union[int, datetime] = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
until_date: Union[int, datetime] = None,
api_kwargs: JSONDict = None,
revoke_messages: bool = None,
) -> bool:
"""Shortcut for::
@ -453,6 +463,7 @@ class Chat(TelegramObject):
async def ban_sender_chat(
self,
sender_chat_id: int,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -485,6 +496,7 @@ class Chat(TelegramObject):
async def ban_chat(
self,
chat_id: Union[str, int],
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -519,6 +531,7 @@ class Chat(TelegramObject):
async def unban_sender_chat(
self,
sender_chat_id: int,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -551,6 +564,7 @@ class Chat(TelegramObject):
async def unban_chat(
self,
chat_id: Union[str, int],
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -585,12 +599,13 @@ class Chat(TelegramObject):
async def unban_member(
self,
user_id: Union[str, int],
only_if_banned: bool = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
only_if_banned: bool = None,
) -> bool:
"""Shortcut for::
@ -624,14 +639,15 @@ class Chat(TelegramObject):
can_restrict_members: bool = None,
can_pin_messages: bool = None,
can_promote_members: bool = None,
is_anonymous: bool = None,
can_manage_chat: bool = None,
can_manage_video_chats: bool = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
is_anonymous: bool = None,
can_manage_chat: bool = None,
can_manage_video_chats: bool = None,
) -> bool:
"""Shortcut for::
@ -676,6 +692,7 @@ class Chat(TelegramObject):
user_id: Union[str, int],
permissions: ChatPermissions,
until_date: Union[int, datetime] = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -710,6 +727,7 @@ class Chat(TelegramObject):
async def set_permissions(
self,
permissions: ChatPermissions,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -741,6 +759,7 @@ class Chat(TelegramObject):
self,
user_id: Union[int, str],
custom_title: str,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -775,6 +794,7 @@ class Chat(TelegramObject):
self,
message_id: int,
disable_notification: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -805,12 +825,13 @@ class Chat(TelegramObject):
async def unpin_message(
self,
message_id: int = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
message_id: int = None,
) -> bool:
"""Shortcut for::
@ -835,6 +856,7 @@ class Chat(TelegramObject):
async def unpin_all_messages(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -869,14 +891,15 @@ class Chat(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -896,14 +919,14 @@ class Chat(TelegramObject):
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
entities=entities,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
entities=entities,
protect_content=protect_content,
)
async def send_media_group(
@ -913,13 +936,14 @@ class Chat(TelegramObject):
],
disable_notification: ODVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> List["Message"]:
"""Shortcut for::
@ -948,6 +972,7 @@ class Chat(TelegramObject):
async def send_chat_action(
self,
action: str,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -984,16 +1009,17 @@ class Chat(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1012,16 +1038,16 @@ class Chat(TelegramObject):
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
parse_mode=parse_mode,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
caption_entities=caption_entities,
filename=filename,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
)
async def send_contact(
@ -1032,15 +1058,16 @@ class Chat(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
vcard: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
contact: "Contact" = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
contact: "Contact" = None,
vcard: str = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1081,17 +1108,18 @@ class Chat(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
thumb: FileInput = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
thumb: FileInput = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1113,38 +1141,39 @@ class Chat(TelegramObject):
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
parse_mode=parse_mode,
thumb=thumb,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
caption_entities=caption_entities,
filename=filename,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
)
async def send_document(
self,
document: Union[FileInput, "Document"],
filename: str = None,
caption: str = None,
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
thumb: FileInput = None,
api_kwargs: JSONDict = None,
disable_content_type_detection: bool = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> "Message":
"""Shortcut for::
@ -1182,14 +1211,15 @@ class Chat(TelegramObject):
disable_notification: ODVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
emoji: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
emoji: str = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1222,13 +1252,14 @@ class Chat(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: "InlineKeyboardMarkup" = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1279,15 +1310,16 @@ class Chat(TelegramObject):
provider_data: Union[str, object] = None,
send_phone_number_to_provider: bool = None,
send_email_to_provider: bool = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
max_tip_amount: int = None,
suggested_tip_amounts: List[int] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
max_tip_amount: int = None,
suggested_tip_amounts: List[int] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1351,18 +1383,19 @@ class Chat(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
location: "Location" = None,
live_period: int = None,
api_kwargs: JSONDict = None,
horizontal_accuracy: float = None,
heading: int = None,
proximity_alert_radius: int = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
location: "Location" = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> "Message":
"""Shortcut for::
@ -1407,15 +1440,16 @@ class Chat(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1456,13 +1490,14 @@ class Chat(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1499,17 +1534,18 @@ class Chat(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
venue: "Venue" = None,
foursquare_type: str = None,
api_kwargs: JSONDict = None,
google_place_id: str = None,
google_place_type: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
venue: "Venue" = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> "Message":
"""Shortcut for::
@ -1552,20 +1588,21 @@ class Chat(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
width: int = None,
height: int = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
supports_streaming: bool = None,
thumb: FileInput = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> "Message":
"""Shortcut for::
@ -1609,15 +1646,16 @@ class Chat(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
thumb: FileInput = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
thumb: FileInput = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
filename: str = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1656,16 +1694,17 @@ class Chat(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1709,18 +1748,19 @@ class Chat(TelegramObject):
disable_notification: ODVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
explanation: str = None,
explanation_parse_mode: ODVInput[str] = DEFAULT_NONE,
open_period: int = None,
close_date: Union[int, datetime] = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
explanation_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> "Message":
"""Shortcut for::
@ -1769,12 +1809,13 @@ class Chat(TelegramObject):
reply_to_message_id: int = None,
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
reply_markup: ReplyMarkup = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "MessageId":
"""Shortcut for::
@ -1816,12 +1857,13 @@ class Chat(TelegramObject):
reply_to_message_id: int = None,
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
reply_markup: ReplyMarkup = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "MessageId":
"""Shortcut for::
@ -1854,6 +1896,7 @@ class Chat(TelegramObject):
async def export_invite_link(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -1886,13 +1929,14 @@ class Chat(TelegramObject):
self,
expire_date: Union[int, datetime] = None,
member_limit: int = None,
name: str = None,
creates_join_request: bool = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
name: str = None,
creates_join_request: bool = None,
) -> "ChatInviteLink":
"""Shortcut for::
@ -1929,13 +1973,14 @@ class Chat(TelegramObject):
invite_link: Union[str, "ChatInviteLink"],
expire_date: Union[int, datetime] = None,
member_limit: int = None,
name: str = None,
creates_join_request: bool = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
name: str = None,
creates_join_request: bool = None,
) -> "ChatInviteLink":
"""Shortcut for::
@ -1970,6 +2015,7 @@ class Chat(TelegramObject):
async def revoke_invite_link(
self,
invite_link: Union[str, "ChatInviteLink"],
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -2002,6 +2048,7 @@ class Chat(TelegramObject):
async def approve_join_request(
self,
user_id: int,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -2034,6 +2081,7 @@ class Chat(TelegramObject):
async def decline_join_request(
self,
user_id: int,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -2066,6 +2114,7 @@ class Chat(TelegramObject):
async def set_menu_button(
self,
menu_button: MenuButton = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -2101,6 +2150,7 @@ class Chat(TelegramObject):
async def get_menu_button(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,

View file

@ -114,6 +114,7 @@ class ChatJoinRequest(TelegramObject):
async def approve(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -145,6 +146,7 @@ class ChatJoinRequest(TelegramObject):
async def decline(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,

View file

@ -67,6 +67,7 @@ class _BaseMedium(TelegramObject):
async def get_file(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,

View file

@ -95,6 +95,7 @@ class ChatPhoto(TelegramObject):
async def get_small_file(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -124,6 +125,7 @@ class ChatPhoto(TelegramObject):
async def get_big_file(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,

View file

@ -43,6 +43,13 @@ class InlineQuery(TelegramObject):
Note:
In Python :keyword:`from` is a reserved word use :paramref:`from_user` instead.
.. versionchanged:: 20.0
* The following are now keyword-only arguments in Bot methods:
``{read, write, connect, pool}_timeout``, :paramref:`answer.api_kwargs`,
``auto_pagination``. Use a named argument for those,
and notice that some positional arguments changed position as a result.
Args:
id (:obj:`str`): Unique identifier for this query.
from_user (:class:`telegram.User`): Sender.
@ -123,13 +130,14 @@ class InlineQuery(TelegramObject):
next_offset: str = None,
switch_pm_text: str = None,
switch_pm_parameter: str = None,
*,
current_offset: str = None,
auto_pagination: bool = False,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
current_offset: str = None,
api_kwargs: JSONDict = None,
auto_pagination: bool = False,
) -> bool:
"""Shortcut for::
@ -146,7 +154,7 @@ class InlineQuery(TelegramObject):
.. versionchanged:: 20.0
Raises :class:`ValueError` instead of :class:`TypeError`.
Args:
Keyword Args:
auto_pagination (:obj:`bool`, optional): If set to :obj:`True`, :attr:`offset` will be
passed as
:paramref:`current_offset <telegram.Bot.answer_inline_query.current_offset>` to

View file

@ -85,13 +85,18 @@ class Message(TelegramObject):
In Python :keyword:`from` is a reserved word use :paramref:`from_user` instead.
.. versionchanged:: 20.0
The arguments and attributes ``voice_chat_scheduled``, ``voice_chat_started`` and
``voice_chat_ended``, ``voice_chat_participants_invited`` were renamed to
:paramref:`video_chat_scheduled`/:attr:`video_chat_scheduled`,
:paramref:`video_chat_started`/:attr:`video_chat_started`,
:paramref:`video_chat_ended`/:attr:`video_chat_ended` and
:paramref:`video_chat_participants_invited`/:attr:`video_chat_participants_invited`,
respectively, in accordance to Bot API 6.0.
* The arguments and attributes ``voice_chat_scheduled``, ``voice_chat_started`` and
``voice_chat_ended``, ``voice_chat_participants_invited`` were renamed to
:paramref:`video_chat_scheduled`/:attr:`video_chat_scheduled`,
:paramref:`video_chat_started`/:attr:`video_chat_started`,
:paramref:`video_chat_ended`/:attr:`video_chat_ended` and
:paramref:`video_chat_participants_invited`/:attr:`video_chat_participants_invited`,
respectively, in accordance to Bot API 6.0.
* The following are now keyword-only arguments in Bot methods:
``{read, write, connect, pool}_timeout``, ``api_kwargs``, ``contact``, ``quote``,
``filename``, ``loaction``, ``venue``. Use a named argument for those,
and notice that some positional arguments changed position as a result.
Args:
message_id (:obj:`int`): Unique message identifier inside this chat.
@ -754,15 +759,16 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -770,7 +776,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_message`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the message is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in
@ -789,14 +795,14 @@ class Message(TelegramObject):
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
entities=entities,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
entities=entities,
protect_content=protect_content,
)
async def reply_markdown(
@ -806,15 +812,16 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -833,7 +840,7 @@ class Message(TelegramObject):
:tg-const:`telegram.constants.ParseMode.MARKDOWN` is a legacy mode, retained by
Telegram for backward compatibility. You should use :meth:`reply_markdown_v2` instead.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the message is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in
@ -851,14 +858,14 @@ class Message(TelegramObject):
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
entities=entities,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
entities=entities,
protect_content=protect_content,
)
async def reply_markdown_v2(
@ -868,15 +875,16 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -891,7 +899,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_message`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the message is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in
@ -909,14 +917,14 @@ class Message(TelegramObject):
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
entities=entities,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
entities=entities,
protect_content=protect_content,
)
async def reply_html(
@ -926,15 +934,16 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -949,7 +958,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_message`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the message is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in
@ -967,14 +976,14 @@ class Message(TelegramObject):
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
entities=entities,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
entities=entities,
protect_content=protect_content,
)
async def reply_media_group(
@ -984,14 +993,15 @@ class Message(TelegramObject):
],
disable_notification: ODVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> List["Message"]:
"""Shortcut for::
@ -999,7 +1009,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_media_group`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the media group is sent as an
actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``,
this parameter will be ignored. Default: :obj:`True` in group chats and
@ -1033,17 +1043,18 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1051,7 +1062,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_photo`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the photo is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``,
this parameter will be ignored. Default: :obj:`True` in group chats and
@ -1069,16 +1080,16 @@ class Message(TelegramObject):
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
parse_mode=parse_mode,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
caption_entities=caption_entities,
filename=filename,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
)
async def reply_audio(
@ -1091,18 +1102,19 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
thumb: FileInput = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
thumb: FileInput = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1110,7 +1122,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_audio`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the audio is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``,
this parameter will be ignored. Default: :obj:`True` in group chats and
@ -1131,39 +1143,40 @@ class Message(TelegramObject):
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
parse_mode=parse_mode,
thumb=thumb,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
caption_entities=caption_entities,
filename=filename,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
)
async def reply_document(
self,
document: Union[FileInput, "Document"],
filename: str = None,
caption: str = None,
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
thumb: FileInput = None,
disable_content_type_detection: bool = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
thumb: FileInput = None,
api_kwargs: JSONDict = None,
disable_content_type_detection: bool = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1171,7 +1184,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_document`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the document is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in
@ -1215,16 +1228,17 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1232,7 +1246,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_animation`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the animation is sent as an
actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``,
this parameter will be ignored. Default: :obj:`True` in group chats and
@ -1272,14 +1286,15 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1287,7 +1302,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_sticker`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the sticker is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in
@ -1321,21 +1336,22 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
width: int = None,
height: int = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
supports_streaming: bool = None,
thumb: FileInput = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> "Message":
"""Shortcut for::
@ -1343,7 +1359,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_video`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the video is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in
@ -1386,16 +1402,17 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
thumb: FileInput = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
thumb: FileInput = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
filename: str = None,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1403,7 +1420,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_video_note`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the video note is sent as an
actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``,
this parameter will be ignored. Default: :obj:`True` in group chats and
@ -1441,17 +1458,18 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1459,7 +1477,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_voice`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the voice note is sent as an
actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``,
this parameter will be ignored. Default: :obj:`True` in group chats and
@ -1497,19 +1515,20 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
location: Location = None,
live_period: int = None,
api_kwargs: JSONDict = None,
horizontal_accuracy: float = None,
heading: int = None,
proximity_alert_radius: int = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
location: Location = None,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> "Message":
"""Shortcut for::
@ -1517,7 +1536,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_location`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the location is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in
@ -1559,18 +1578,19 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
foursquare_type: str = None,
google_place_id: str = None,
google_place_type: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
venue: Venue = None,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
venue: Venue = None,
foursquare_type: str = None,
api_kwargs: JSONDict = None,
google_place_id: str = None,
google_place_type: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1578,7 +1598,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_venue`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the venue is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in
@ -1620,16 +1640,17 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
vcard: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
contact: Contact = None,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
contact: Contact = None,
vcard: str = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1637,7 +1658,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_contact`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the contact is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in
@ -1679,19 +1700,20 @@ class Message(TelegramObject):
disable_notification: ODVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
explanation: str = None,
explanation_parse_mode: ODVInput[str] = DEFAULT_NONE,
open_period: int = None,
close_date: Union[int, datetime.datetime] = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
explanation_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> "Message":
"""Shortcut for::
@ -1699,7 +1721,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_poll`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the poll is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``,
this parameter will be ignored. Default: :obj:`True` in group chats and
@ -1741,15 +1763,16 @@ class Message(TelegramObject):
disable_notification: ODVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
emoji: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
emoji: str = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1757,7 +1780,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_dice`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the dice is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False`
@ -1786,6 +1809,7 @@ class Message(TelegramObject):
async def reply_chat_action(
self,
action: str,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -1820,14 +1844,15 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: "InlineKeyboardMarkup" = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1835,7 +1860,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.send_game`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the game is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False`
@ -1887,16 +1912,17 @@ class Message(TelegramObject):
provider_data: Union[str, object] = None,
send_phone_number_to_provider: bool = None,
send_email_to_provider: bool = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
max_tip_amount: int = None,
suggested_tip_amounts: List[int] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None,
max_tip_amount: int = None,
suggested_tip_amounts: List[int] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1916,7 +1942,7 @@ class Message(TelegramObject):
As of Bot API 5.2, the parameter
:paramref:`start_parameter <telegram.Bot.send_invoice.start_parameter>` is optional.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the invoice is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False`
@ -1966,12 +1992,13 @@ class Message(TelegramObject):
self,
chat_id: Union[int, str],
disable_notification: DVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -2002,12 +2029,12 @@ class Message(TelegramObject):
from_chat_id=self.chat_id,
message_id=self.message_id,
disable_notification=disable_notification,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
protect_content=protect_content,
)
async def copy(
@ -2020,12 +2047,13 @@ class Message(TelegramObject):
reply_to_message_id: int = None,
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
reply_markup: ReplyMarkup = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "MessageId":
"""Shortcut for::
@ -2073,13 +2101,14 @@ class Message(TelegramObject):
reply_to_message_id: int = None,
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
reply_markup: ReplyMarkup = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
quote: bool = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
quote: bool = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "MessageId":
"""Shortcut for::
@ -2093,7 +2122,7 @@ class Message(TelegramObject):
For the documentation of the arguments, please see :meth:`telegram.Bot.copy_message`.
Args:
Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the copy is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``,
this parameter will be ignored. Default: :obj:`True` in group chats and
@ -2131,12 +2160,13 @@ class Message(TelegramObject):
parse_mode: ODVInput[str] = DEFAULT_NONE,
disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE,
reply_markup: InlineKeyboardMarkup = None,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
) -> Union["Message", bool]:
"""Shortcut for::
@ -2176,13 +2206,14 @@ class Message(TelegramObject):
self,
caption: str = None,
reply_markup: InlineKeyboardMarkup = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
) -> Union["Message", bool]:
"""Shortcut for::
@ -2222,6 +2253,7 @@ class Message(TelegramObject):
self,
media: "InputMedia",
reply_markup: InlineKeyboardMarkup = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -2263,6 +2295,7 @@ class Message(TelegramObject):
async def edit_reply_markup(
self,
reply_markup: Optional["InlineKeyboardMarkup"] = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -2303,16 +2336,17 @@ class Message(TelegramObject):
self,
latitude: float = None,
longitude: float = None,
location: Location = None,
reply_markup: InlineKeyboardMarkup = None,
horizontal_accuracy: float = None,
heading: int = None,
proximity_alert_radius: int = None,
*,
location: Location = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
horizontal_accuracy: float = None,
heading: int = None,
proximity_alert_radius: int = None,
) -> Union["Message", bool]:
"""Shortcut for::
@ -2353,6 +2387,7 @@ class Message(TelegramObject):
async def stop_live_location(
self,
reply_markup: InlineKeyboardMarkup = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -2395,6 +2430,7 @@ class Message(TelegramObject):
score: int,
force: bool = None,
disable_edit_message: bool = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -2436,6 +2472,7 @@ class Message(TelegramObject):
async def get_game_high_scores(
self,
user_id: Union[int, str],
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -2473,6 +2510,7 @@ class Message(TelegramObject):
async def delete(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -2504,6 +2542,7 @@ class Message(TelegramObject):
async def stop_poll(
self,
reply_markup: InlineKeyboardMarkup = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -2537,6 +2576,7 @@ class Message(TelegramObject):
async def pin(
self,
disable_notification: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -2568,6 +2608,7 @@ class Message(TelegramObject):
async def unpin(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,

View file

@ -138,6 +138,7 @@ class PassportFile(TelegramObject):
async def get_file(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,

View file

@ -120,6 +120,7 @@ class PreCheckoutQuery(TelegramObject):
self,
ok: bool,
error_message: str = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,

View file

@ -95,6 +95,7 @@ class ShippingQuery(TelegramObject):
ok: bool,
shipping_options: List[ShippingOption] = None,
error_message: str = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,

View file

@ -62,6 +62,13 @@ class User(TelegramObject):
Objects of this class are comparable in terms of equality. Two objects of this class are
considered equal, if their :attr:`id` is equal.
.. versionchanged:: 20.0
The following are now keyword-only arguments in Bot methods:
``location``, ``filename``, ``venue``, ``contact``,
``{read, write, connect, pool}_timeout`` ``api_kwargs``. Use a named argument for those,
and notice that some positional arguments changed position as a result.
Args:
id (:obj:`int`): Unique identifier for this user or bot.
is_bot (:obj:`bool`): :obj:`True`, if this user is a bot.
@ -166,6 +173,7 @@ class User(TelegramObject):
self,
offset: int = None,
limit: int = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -254,6 +262,7 @@ class User(TelegramObject):
self,
message_id: int,
disable_notification: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -283,12 +292,13 @@ class User(TelegramObject):
async def unpin_message(
self,
message_id: int = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
message_id: int = None,
) -> bool:
"""Shortcut for::
@ -312,6 +322,7 @@ class User(TelegramObject):
async def unpin_all_messages(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -346,14 +357,15 @@ class User(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -373,14 +385,14 @@ class User(TelegramObject):
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
allow_sending_without_reply=allow_sending_without_reply,
entities=entities,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
entities=entities,
protect_content=protect_content,
)
async def send_photo(
@ -390,16 +402,17 @@ class User(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -418,16 +431,16 @@ class User(TelegramObject):
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
parse_mode=parse_mode,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
caption_entities=caption_entities,
filename=filename,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
)
async def send_media_group(
@ -437,13 +450,14 @@ class User(TelegramObject):
],
disable_notification: ODVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> List["Message"]:
"""Shortcut for::
@ -479,17 +493,18 @@ class User(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
thumb: FileInput = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
thumb: FileInput = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -511,22 +526,23 @@ class User(TelegramObject):
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
parse_mode=parse_mode,
thumb=thumb,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
caption_entities=caption_entities,
filename=filename,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
)
async def send_chat_action(
self,
action: str,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -564,15 +580,16 @@ class User(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
vcard: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
contact: "Contact" = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
contact: "Contact" = None,
vcard: str = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -608,14 +625,15 @@ class User(TelegramObject):
disable_notification: ODVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
emoji: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
emoji: str = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -645,22 +663,23 @@ class User(TelegramObject):
async def send_document(
self,
document: Union[FileInput, "Document"],
filename: str = None,
caption: str = None,
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
thumb: FileInput = None,
api_kwargs: JSONDict = None,
disable_content_type_detection: bool = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> "Message":
"""Shortcut for::
@ -699,13 +718,14 @@ class User(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: "InlineKeyboardMarkup" = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -756,15 +776,16 @@ class User(TelegramObject):
provider_data: Union[str, object] = None,
send_phone_number_to_provider: bool = None,
send_email_to_provider: bool = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
max_tip_amount: int = None,
suggested_tip_amounts: List[int] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
max_tip_amount: int = None,
suggested_tip_amounts: List[int] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -828,18 +849,19 @@ class User(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
location: "Location" = None,
live_period: int = None,
api_kwargs: JSONDict = None,
horizontal_accuracy: float = None,
heading: int = None,
proximity_alert_radius: int = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
location: "Location" = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> "Message":
"""Shortcut for::
@ -884,15 +906,16 @@ class User(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -933,13 +956,14 @@ class User(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -974,20 +998,21 @@ class User(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
width: int = None,
height: int = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
supports_streaming: bool = None,
thumb: FileInput = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> "Message":
"""Shortcut for::
@ -1033,17 +1058,18 @@ class User(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
venue: "Venue" = None,
foursquare_type: str = None,
api_kwargs: JSONDict = None,
google_place_id: str = None,
google_place_type: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
venue: "Venue" = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> "Message":
"""Shortcut for::
@ -1086,15 +1112,16 @@ class User(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
thumb: FileInput = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
thumb: FileInput = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
filename: str = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1133,16 +1160,17 @@ class User(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
filename: str = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
filename: str = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "Message":
"""Shortcut for::
@ -1186,18 +1214,19 @@ class User(TelegramObject):
disable_notification: ODVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
explanation: str = None,
explanation_parse_mode: ODVInput[str] = DEFAULT_NONE,
open_period: int = None,
close_date: Union[int, datetime] = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
explanation_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> "Message":
"""Shortcut for::
@ -1246,12 +1275,13 @@ class User(TelegramObject):
reply_to_message_id: int = None,
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
reply_markup: ReplyMarkup = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "MessageId":
"""Shortcut for::
@ -1293,12 +1323,13 @@ class User(TelegramObject):
reply_to_message_id: int = None,
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
reply_markup: ReplyMarkup = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> "MessageId":
"""Shortcut for::
@ -1332,6 +1363,7 @@ class User(TelegramObject):
async def approve_join_request(
self,
chat_id: Union[int, str],
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -1364,6 +1396,7 @@ class User(TelegramObject):
async def decline_join_request(
self,
chat_id: Union[int, str],
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -1396,6 +1429,7 @@ class User(TelegramObject):
async def set_menu_button(
self,
menu_button: MenuButton = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -1428,6 +1462,7 @@ class User(TelegramObject):
async def get_menu_button(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,

View file

@ -241,12 +241,13 @@ class ExtBot(Bot):
disable_notification: ODVInput[bool] = DEFAULT_NONE,
reply_markup: ReplyMarkup = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Union[bool, Message]:
# We override this method to call self._replace_keyboard and self._insert_callback_data.
# This covers most methods that have a reply_markup
@ -257,12 +258,12 @@ class ExtBot(Bot):
disable_notification=disable_notification,
reply_markup=self._replace_keyboard(reply_markup),
allow_sending_without_reply=allow_sending_without_reply,
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
protect_content=protect_content,
)
if isinstance(result, Message):
self._insert_callback_data(result)
@ -273,22 +274,23 @@ class ExtBot(Bot):
offset: int = None,
limit: int = None,
timeout: float = None,
allowed_updates: List[str] = None,
*,
read_timeout: float = 2,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
allowed_updates: List[str] = None,
api_kwargs: JSONDict = None,
) -> List[Update]:
updates = await super().get_updates(
offset=offset,
limit=limit,
timeout=timeout,
allowed_updates=allowed_updates,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
allowed_updates=allowed_updates,
api_kwargs=api_kwargs,
)
@ -360,6 +362,7 @@ class ExtBot(Bot):
chat_id: Union[int, str],
message_id: int,
reply_markup: InlineKeyboardMarkup = None,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
@ -390,12 +393,13 @@ class ExtBot(Bot):
reply_to_message_id: int = None,
allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE,
reply_markup: ReplyMarkup = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> MessageId:
# We override this method to call self._replace_keyboard
return await super().copy_message(
@ -409,17 +413,18 @@ class ExtBot(Bot):
reply_to_message_id=reply_to_message_id,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=self._replace_keyboard(reply_markup),
protect_content=protect_content,
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
protect_content=protect_content,
)
async def get_chat(
self,
chat_id: Union[str, int],
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,

View file

@ -504,6 +504,10 @@ def check_shortcut_signature(
# shortcuts to return more specific types than the bot method, but it's only annotations after
# all
for kwarg in effective_shortcut_args:
expected_kind = bot_sig.parameters[kwarg].kind
if shortcut_sig.parameters[kwarg].kind != expected_kind:
raise Exception(f"Argument {kwarg} must be of kind {expected_kind}.")
if bot_sig.parameters[kwarg].annotation != shortcut_sig.parameters[kwarg].annotation:
if isinstance(bot_sig.parameters[kwarg].annotation, type):
if bot_sig.parameters[kwarg].annotation.__name__ != str(
@ -527,6 +531,10 @@ def check_shortcut_signature(
f"Default for argument {arg} does not match the default of the Bot method."
)
for kwarg in additional_kwargs:
if not shortcut_sig.parameters[kwarg].kind == inspect.Parameter.KEYWORD_ONLY:
raise Exception(f"Argument {kwarg} must be a positional-only argument!")
return True

View file

@ -2381,7 +2381,7 @@ class TestBot:
# Test setting our chat menu button to Webapp.
my_menu = MenuButtonWebApp("click me!", WebAppInfo("https://telegram.org/"))
await bot.set_chat_menu_button(chat_id, my_menu)
await bot.set_chat_menu_button(chat_id=chat_id, menu_button=my_menu)
menu_button = await bot.get_chat_menu_button(chat_id)
assert isinstance(menu_button, MenuButtonWebApp)
assert menu_button.type == MenuButtonType.WEB_APP

View file

@ -28,8 +28,8 @@ from tests.conftest import check_defaults_handling, check_shortcut_call, check_s
def chat(bot):
return Chat(
TestChat.id_,
TestChat.title,
TestChat.type_,
title=TestChat.title,
type=TestChat.type_,
username=TestChat.username,
all_members_are_administrators=TestChat.all_members_are_administrators,
bot=bot,

View file

@ -62,9 +62,9 @@ from tests.test_passport import RAW_PASSPORT_DATA
@pytest.fixture(scope="class")
def message(bot):
return Message(
TestMessage.id_,
TestMessage.date,
TestMessage.chat,
message_id=TestMessage.id_,
date=TestMessage.date,
chat=TestMessage.chat,
from_user=TestMessage.from_user,
bot=bot,
)
@ -344,7 +344,14 @@ class TestMessage:
b"\\u200d\\U0001f467\\U0001f431http://google.com"
).decode("unicode-escape")
entity = MessageEntity(type=MessageEntity.URL, offset=13, length=17)
message = Message(1, self.from_user, self.date, self.chat, text=text, entities=[entity])
message = Message(
1,
from_user=self.from_user,
date=self.date,
chat=self.chat,
text=text,
entities=[entity],
)
assert message.parse_entity(entity) == "http://google.com"
with pytest.raises(RuntimeError, match="Message has no"):
@ -357,7 +364,12 @@ class TestMessage:
).decode("unicode-escape")
entity = MessageEntity(type=MessageEntity.URL, offset=13, length=17)
message = Message(
1, self.from_user, self.date, self.chat, caption=caption, caption_entities=[entity]
1,
from_user=self.from_user,
date=self.date,
chat=self.chat,
caption=caption,
caption_entities=[entity],
)
assert message.parse_caption_entity(entity) == "http://google.com"
@ -372,7 +384,12 @@ class TestMessage:
entity = MessageEntity(type=MessageEntity.URL, offset=13, length=17)
entity_2 = MessageEntity(type=MessageEntity.BOLD, offset=13, length=1)
message = Message(
1, self.from_user, self.date, self.chat, text=text, entities=[entity_2, entity]
1,
from_user=self.from_user,
date=self.date,
chat=self.chat,
text=text,
entities=[entity_2, entity],
)
assert message.parse_entities(MessageEntity.URL) == {entity: "http://google.com"}
assert message.parse_entities() == {entity: "http://google.com", entity_2: "h"}
@ -386,9 +403,9 @@ class TestMessage:
entity_2 = MessageEntity(type=MessageEntity.BOLD, offset=13, length=1)
message = Message(
1,
self.from_user,
self.date,
self.chat,
from_user=self.from_user,
date=self.date,
chat=self.chat,
caption=text,
caption_entities=[entity_2, entity],
)
@ -507,7 +524,12 @@ class TestMessage:
expected = b"\\U0001f469\\u200d\\U0001f469\\u200d <b>ABC</b>".decode("unicode-escape")
bold_entity = MessageEntity(type=MessageEntity.BOLD, offset=7, length=3)
message = Message(
1, self.from_user, self.date, self.chat, text=text, entities=[bold_entity]
1,
from_user=self.from_user,
date=self.date,
chat=self.chat,
text=text,
entities=[bold_entity],
)
assert expected == message.text_html
@ -607,9 +629,9 @@ class TestMessage:
bold_entity = MessageEntity(type=MessageEntity.BOLD, offset=7, length=3)
message = Message(
1,
self.from_user,
self.date,
self.chat,
from_user=self.from_user,
date=self.date,
chat=self.chat,
caption=caption,
caption_entities=[bold_entity],
)
@ -621,9 +643,9 @@ class TestMessage:
bold_entity = MessageEntity(type=MessageEntity.BOLD, offset=7, length=3)
message = Message(
1,
self.from_user,
self.date,
self.chat,
from_user=self.from_user,
date=self.date,
chat=self.chat,
caption=caption,
caption_entities=[bold_entity],
)

View file

@ -123,6 +123,14 @@ def check_method(h4):
assert (sig.parameters.keys() ^ checked) - ignored == set()
kw_or_positional_args = [
p.name for p in sig.parameters.values() if p.kind != inspect.Parameter.KEYWORD_ONLY
]
assert set(kw_or_positional_args).difference(checked).difference(["self"]) == set(), (
f"In {method.__qualname__}, extra args should be keyword only "
f"(compared to {name} in API)"
)
def check_object(h4):
name = h4.text