Defaults.protect_content (#2840)

This commit is contained in:
Harshil 2022-01-07 20:02:23 +04:00 committed by Hinrich Mahler
parent 0a6cc7f722
commit 9354db7c19
22 changed files with 278 additions and 119 deletions

View file

@ -279,18 +279,16 @@ class Bot(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Union[bool, Message]: ) -> Union[bool, Message]:
if reply_to_message_id is not None: if reply_to_message_id is not None:
data['reply_to_message_id'] = reply_to_message_id data['reply_to_message_id'] = reply_to_message_id
if protect_content:
data['protect_content'] = protect_content
# We don't check if (DEFAULT_)None here, so that _post is able to insert the defaults # We don't check if (DEFAULT_)None here, so that _post is able to insert the defaults
# correctly, if necessary # correctly, if necessary
data['disable_notification'] = disable_notification data['disable_notification'] = disable_notification
data['allow_sending_without_reply'] = allow_sending_without_reply data['allow_sending_without_reply'] = allow_sending_without_reply
data['protect_content'] = protect_content
if reply_markup is not None: if reply_markup is not None:
if isinstance(reply_markup, ReplyMarkup): if isinstance(reply_markup, ReplyMarkup):
@ -414,7 +412,7 @@ class Bot(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
"""Use this method to send text messages. """Use this method to send text messages.
@ -534,7 +532,7 @@ class Bot(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE,
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
"""Use this method to forward messages of any kind. Service messages can't be forwarded. """Use this method to forward messages of any kind. Service messages can't be forwarded.
@ -604,7 +602,7 @@ class Bot(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
"""Use this method to send photos. """Use this method to send photos.
@ -706,7 +704,7 @@ class Bot(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
""" """
Use this method to send audio files, if you want Telegram clients to display them in the Use this method to send audio files, if you want Telegram clients to display them in the
@ -834,7 +832,7 @@ class Bot(TelegramObject):
disable_content_type_detection: bool = None, disable_content_type_detection: bool = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
""" """
Use this method to send general files. Use this method to send general files.
@ -946,7 +944,7 @@ class Bot(TelegramObject):
timeout: DVInput[float] = DEFAULT_20, timeout: DVInput[float] = DEFAULT_20,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
""" """
Use this method to send static ``.WEBP``, animated ``.TGS``, or video ``.WEBM`` stickers. Use this method to send static ``.WEBP``, animated ``.TGS``, or video ``.WEBM`` stickers.
@ -1026,7 +1024,7 @@ class Bot(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
""" """
Use this method to send video files, Telegram clients support mp4 videos Use this method to send video files, Telegram clients support mp4 videos
@ -1156,7 +1154,7 @@ class Bot(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
""" """
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long.
@ -1266,7 +1264,7 @@ class Bot(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
""" """
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
@ -1390,7 +1388,7 @@ class Bot(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
""" """
Use this method to send audio files, if you want Telegram clients to display the file Use this method to send audio files, if you want Telegram clients to display the file
@ -1493,7 +1491,7 @@ class Bot(TelegramObject):
timeout: DVInput[float] = DEFAULT_20, timeout: DVInput[float] = DEFAULT_20,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> List[Message]: ) -> List[Message]:
"""Use this method to send a group of photos or videos as an album. """Use this method to send a group of photos or videos as an album.
@ -1529,14 +1527,12 @@ class Bot(TelegramObject):
'media': media, 'media': media,
'disable_notification': disable_notification, 'disable_notification': disable_notification,
'allow_sending_without_reply': allow_sending_without_reply, 'allow_sending_without_reply': allow_sending_without_reply,
'protect_content': protect_content,
} }
if reply_to_message_id: if reply_to_message_id:
data['reply_to_message_id'] = reply_to_message_id data['reply_to_message_id'] = reply_to_message_id
if protect_content:
data['protect_content'] = protect_content
result = self._post('sendMediaGroup', data, timeout=timeout, api_kwargs=api_kwargs) result = self._post('sendMediaGroup', data, timeout=timeout, api_kwargs=api_kwargs)
return Message.de_list(result, self) # type: ignore return Message.de_list(result, self) # type: ignore
@ -1558,7 +1554,7 @@ class Bot(TelegramObject):
heading: int = None, heading: int = None,
proximity_alert_radius: int = None, proximity_alert_radius: int = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
"""Use this method to send point on the map. """Use this method to send point on the map.
@ -1805,7 +1801,7 @@ class Bot(TelegramObject):
google_place_id: str = None, google_place_id: str = None,
google_place_type: str = None, google_place_type: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
"""Use this method to send information about a venue. """Use this method to send information about a venue.
@ -1862,7 +1858,7 @@ class Bot(TelegramObject):
""" """
if not (venue or all([latitude, longitude, address, title])): if not (venue or all([latitude, longitude, address, title])):
raise ValueError( raise ValueError(
"Either venue or latitude, longitude, address and title must be" "Either venue or latitude, longitude, address and title must be "
"passed as arguments." "passed as arguments."
) )
@ -1920,7 +1916,7 @@ class Bot(TelegramObject):
vcard: str = None, vcard: str = None,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
"""Use this method to send phone contacts. """Use this method to send phone contacts.
@ -2009,7 +2005,7 @@ class Bot(TelegramObject):
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
"""Use this method to send a game. """Use this method to send a game.
@ -3511,7 +3507,7 @@ class Bot(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
max_tip_amount: int = None, max_tip_amount: int = None,
suggested_tip_amounts: List[int] = None, suggested_tip_amounts: List[int] = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
"""Use this method to send invoices. """Use this method to send invoices.
@ -5059,7 +5055,7 @@ class Bot(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
explanation_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, explanation_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
""" """
Use this method to send a native poll. Use this method to send a native poll.
@ -5220,7 +5216,7 @@ class Bot(TelegramObject):
emoji: str = None, emoji: str = None,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Message: ) -> Message:
""" """
Use this method to send an animated emoji that will display a random value. Use this method to send an animated emoji that will display a random value.
@ -5495,7 +5491,7 @@ class Bot(TelegramObject):
reply_markup: ReplyMarkup = None, reply_markup: ReplyMarkup = None,
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> MessageId: ) -> MessageId:
""" """
Use this method to copy messages of any kind. Service messages and invoice messages can't Use this method to copy messages of any kind. Service messages and invoice messages can't
@ -5549,6 +5545,7 @@ class Bot(TelegramObject):
'parse_mode': parse_mode, 'parse_mode': parse_mode,
'disable_notification': disable_notification, 'disable_notification': disable_notification,
'allow_sending_without_reply': allow_sending_without_reply, 'allow_sending_without_reply': allow_sending_without_reply,
'protect_content': protect_content,
} }
if caption is not None: if caption is not None:
data['caption'] = caption data['caption'] = caption
@ -5556,8 +5553,6 @@ class Bot(TelegramObject):
data['caption_entities'] = caption_entities data['caption_entities'] = caption_entities
if reply_to_message_id: if reply_to_message_id:
data['reply_to_message_id'] = reply_to_message_id data['reply_to_message_id'] = reply_to_message_id
if protect_content:
data['protect_content'] = protect_content
if reply_markup: if reply_markup:
if isinstance(reply_markup, ReplyMarkup): if isinstance(reply_markup, ReplyMarkup):
# We need to_json() instead of to_dict() here, because reply_markups may be # We need to_json() instead of to_dict() here, because reply_markups may be

View file

@ -618,7 +618,7 @@ class CallbackQuery(TelegramObject):
reply_markup: ReplyMarkup = None, reply_markup: ReplyMarkup = None,
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'MessageId': ) -> 'MessageId':
"""Shortcut for:: """Shortcut for::

View file

@ -745,7 +745,7 @@ class Chat(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -782,7 +782,7 @@ class Chat(TelegramObject):
timeout: DVInput[float] = DEFAULT_20, timeout: DVInput[float] = DEFAULT_20,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> List['Message']: ) -> List['Message']:
"""Shortcut for:: """Shortcut for::
@ -844,7 +844,7 @@ class Chat(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -885,7 +885,7 @@ class Chat(TelegramObject):
vcard: str = None, vcard: str = None,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -930,7 +930,7 @@ class Chat(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -977,7 +977,7 @@ class Chat(TelegramObject):
disable_content_type_detection: bool = None, disable_content_type_detection: bool = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1016,7 +1016,7 @@ class Chat(TelegramObject):
emoji: str = None, emoji: str = None,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1049,7 +1049,7 @@ class Chat(TelegramObject):
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1102,7 +1102,7 @@ class Chat(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
max_tip_amount: int = None, max_tip_amount: int = None,
suggested_tip_amounts: List[int] = None, suggested_tip_amounts: List[int] = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1169,7 +1169,7 @@ class Chat(TelegramObject):
heading: int = None, heading: int = None,
proximity_alert_radius: int = None, proximity_alert_radius: int = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1216,7 +1216,7 @@ class Chat(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1257,7 +1257,7 @@ class Chat(TelegramObject):
timeout: DVInput[float] = DEFAULT_20, timeout: DVInput[float] = DEFAULT_20,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1298,7 +1298,7 @@ class Chat(TelegramObject):
google_place_id: str = None, google_place_id: str = None,
google_place_type: str = None, google_place_type: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1348,7 +1348,7 @@ class Chat(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1394,7 +1394,7 @@ class Chat(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1436,7 +1436,7 @@ class Chat(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1486,7 +1486,7 @@ class Chat(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
explanation_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, explanation_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1534,7 +1534,7 @@ class Chat(TelegramObject):
reply_markup: 'ReplyMarkup' = None, reply_markup: 'ReplyMarkup' = None,
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'MessageId': ) -> 'MessageId':
"""Shortcut for:: """Shortcut for::
@ -1575,7 +1575,7 @@ class Chat(TelegramObject):
reply_markup: 'ReplyMarkup' = None, reply_markup: 'ReplyMarkup' = None,
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'MessageId': ) -> 'MessageId':
"""Shortcut for:: """Shortcut for::

View file

@ -739,7 +739,7 @@ class Message(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -785,7 +785,7 @@ class Message(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -841,7 +841,7 @@ class Message(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -893,7 +893,7 @@ class Message(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -944,7 +944,7 @@ class Message(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> List['Message']: ) -> List['Message']:
"""Shortcut for:: """Shortcut for::
@ -990,7 +990,7 @@ class Message(TelegramObject):
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1043,7 +1043,7 @@ class Message(TelegramObject):
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1098,7 +1098,7 @@ class Message(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1153,7 +1153,7 @@ class Message(TelegramObject):
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1202,7 +1202,7 @@ class Message(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1252,7 +1252,7 @@ class Message(TelegramObject):
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1306,7 +1306,7 @@ class Message(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
filename: str = None, filename: str = None,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1356,7 +1356,7 @@ class Message(TelegramObject):
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1408,7 +1408,7 @@ class Message(TelegramObject):
proximity_alert_radius: int = None, proximity_alert_radius: int = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1463,7 +1463,7 @@ class Message(TelegramObject):
google_place_type: str = None, google_place_type: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1516,7 +1516,7 @@ class Message(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1572,7 +1572,7 @@ class Message(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
explanation_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, explanation_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1624,7 +1624,7 @@ class Message(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1690,7 +1690,7 @@ class Message(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1753,7 +1753,7 @@ class Message(TelegramObject):
quote: bool = None, quote: bool = None,
max_tip_amount: int = None, max_tip_amount: int = None,
suggested_tip_amounts: List[int] = None, suggested_tip_amounts: List[int] = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1820,7 +1820,7 @@ class Message(TelegramObject):
disable_notification: DVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE,
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1866,7 +1866,7 @@ class Message(TelegramObject):
reply_markup: ReplyMarkup = None, reply_markup: ReplyMarkup = None,
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'MessageId': ) -> 'MessageId':
"""Shortcut for:: """Shortcut for::
@ -1912,7 +1912,7 @@ class Message(TelegramObject):
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
quote: bool = None, quote: bool = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'MessageId': ) -> 'MessageId':
"""Shortcut for:: """Shortcut for::

View file

@ -336,7 +336,7 @@ class User(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -376,7 +376,7 @@ class User(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -414,7 +414,7 @@ class User(TelegramObject):
timeout: DVInput[float] = DEFAULT_20, timeout: DVInput[float] = DEFAULT_20,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> List['Message']: ) -> List['Message']:
"""Shortcut for:: """Shortcut for::
@ -454,7 +454,7 @@ class User(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -525,7 +525,7 @@ class User(TelegramObject):
vcard: str = None, vcard: str = None,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -562,7 +562,7 @@ class User(TelegramObject):
emoji: str = None, emoji: str = None,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -601,7 +601,7 @@ class User(TelegramObject):
disable_content_type_detection: bool = None, disable_content_type_detection: bool = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -640,7 +640,7 @@ class User(TelegramObject):
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -693,7 +693,7 @@ class User(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
max_tip_amount: int = None, max_tip_amount: int = None,
suggested_tip_amounts: List[int] = None, suggested_tip_amounts: List[int] = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -760,7 +760,7 @@ class User(TelegramObject):
heading: int = None, heading: int = None,
proximity_alert_radius: int = None, proximity_alert_radius: int = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -807,7 +807,7 @@ class User(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -848,7 +848,7 @@ class User(TelegramObject):
timeout: DVInput[float] = DEFAULT_20, timeout: DVInput[float] = DEFAULT_20,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -890,7 +890,7 @@ class User(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -940,7 +940,7 @@ class User(TelegramObject):
google_place_id: str = None, google_place_id: str = None,
google_place_type: str = None, google_place_type: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -985,7 +985,7 @@ class User(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1027,7 +1027,7 @@ class User(TelegramObject):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None, filename: str = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1077,7 +1077,7 @@ class User(TelegramObject):
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
explanation_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None, explanation_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'Message': ) -> 'Message':
"""Shortcut for:: """Shortcut for::
@ -1125,7 +1125,7 @@ class User(TelegramObject):
reply_markup: 'ReplyMarkup' = None, reply_markup: 'ReplyMarkup' = None,
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'MessageId': ) -> 'MessageId':
"""Shortcut for:: """Shortcut for::
@ -1166,7 +1166,7 @@ class User(TelegramObject):
reply_markup: 'ReplyMarkup' = None, reply_markup: 'ReplyMarkup' = None,
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> 'MessageId': ) -> 'MessageId':
"""Shortcut for:: """Shortcut for::

View file

@ -54,6 +54,10 @@ class Defaults:
run_async (:obj:`bool`, optional): Default setting for the ``run_async`` parameter of run_async (:obj:`bool`, optional): Default setting for the ``run_async`` parameter of
handlers and error handlers registered through :meth:`Dispatcher.add_handler` and handlers and error handlers registered through :meth:`Dispatcher.add_handler` and
:meth:`Dispatcher.add_error_handler`. Defaults to :obj:`False`. :meth:`Dispatcher.add_error_handler`. Defaults to :obj:`False`.
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
forwarding and saving.
.. versionadded:: 14.0
""" """
__slots__ = ( __slots__ = (
@ -66,6 +70,7 @@ class Defaults:
'_allow_sending_without_reply', '_allow_sending_without_reply',
'_parse_mode', '_parse_mode',
'_api_defaults', '_api_defaults',
'_protect_content',
) )
def __init__( def __init__(
@ -80,6 +85,7 @@ class Defaults:
tzinfo: pytz.BaseTzInfo = pytz.utc, tzinfo: pytz.BaseTzInfo = pytz.utc,
run_async: bool = False, run_async: bool = False,
allow_sending_without_reply: bool = None, allow_sending_without_reply: bool = None,
protect_content: bool = None,
): ):
self._parse_mode = parse_mode self._parse_mode = parse_mode
self._disable_notification = disable_notification self._disable_notification = disable_notification
@ -89,6 +95,7 @@ class Defaults:
self._quote = quote self._quote = quote
self._tzinfo = tzinfo self._tzinfo = tzinfo
self._run_async = run_async self._run_async = run_async
self._protect_content = protect_content
# Gather all defaults that actually have a default value # Gather all defaults that actually have a default value
self._api_defaults = {} self._api_defaults = {}
@ -98,6 +105,7 @@ class Defaults:
'disable_notification', 'disable_notification',
'disable_web_page_preview', 'disable_web_page_preview',
'allow_sending_without_reply', 'allow_sending_without_reply',
'protect_content',
): ):
value = getattr(self, kwarg) value = getattr(self, kwarg)
if value not in [None, DEFAULT_NONE]: if value not in [None, DEFAULT_NONE]:
@ -220,6 +228,21 @@ class Defaults:
def run_async(self, value: object) -> NoReturn: def run_async(self, value: object) -> NoReturn:
raise AttributeError("You can not assign a new value to run_async after initialization.") raise AttributeError("You can not assign a new value to run_async after initialization.")
@property
def protect_content(self) -> Optional[bool]:
""":obj:`bool`: Optional. Protects the contents of the sent message from forwarding and
saving.
.. versionadded:: 14.0
"""
return self._protect_content
@protect_content.setter
def protect_content(self, value: object) -> NoReturn:
raise AttributeError(
"You can't assign a new value to protect_content after initialization."
)
def __hash__(self) -> int: def __hash__(self) -> int:
return hash( return hash(
( (
@ -231,6 +254,7 @@ class Defaults:
self._quote, self._quote,
self._tzinfo, self._tzinfo,
self._run_async, self._run_async,
self._protect_content,
) )
) )

View file

@ -256,7 +256,7 @@ class ExtBot(Bot):
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> Union[bool, Message]: ) -> Union[bool, Message]:
# We override this method to call self._replace_keyboard and self._insert_callback_data. # We override this method to call self._replace_keyboard and self._insert_callback_data.
# This covers most methods that have a reply_markup # This covers most methods that have a reply_markup
@ -387,7 +387,7 @@ class ExtBot(Bot):
reply_markup: ReplyMarkup = None, reply_markup: ReplyMarkup = None,
timeout: ODVInput[float] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None, api_kwargs: JSONDict = None,
protect_content: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE,
) -> MessageId: ) -> MessageId:
# We override this method to call self._replace_keyboard # We override this method to call self._replace_keyboard
return super().copy_message( return super().copy_message(

View file

@ -245,6 +245,14 @@ class TestAnimation:
chat_id, animation, reply_to_message_id=reply_to_message.message_id chat_id, animation, reply_to_message_id=reply_to_message.message_id
) )
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_animation_default_protect_content(self, default_bot, chat_id, animation):
animation_protected = default_bot.send_animation(chat_id, animation)
assert animation_protected.has_protected_content
ani_unprotected = default_bot.send_animation(chat_id, animation, protect_content=False)
assert not ani_unprotected.has_protected_content
@flaky(3, 1) @flaky(3, 1)
def test_resend(self, bot, chat_id, animation): def test_resend(self, bot, chat_id, animation):
message = bot.send_animation(chat_id, animation.file_id) message = bot.send_animation(chat_id, animation.file_id)

View file

@ -35,9 +35,8 @@ from tests.conftest import (
@pytest.fixture(scope='function') @pytest.fixture(scope='function')
def audio_file(): def audio_file():
f = data_file('telegram.mp3').open('rb') with open(data_file('telegram.mp3'), 'rb') as f:
yield f yield f
f.close()
@pytest.fixture(scope='class') @pytest.fixture(scope='class')
@ -186,7 +185,7 @@ class TestAudio:
@flaky(3, 1) @flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'parse_mode': 'Markdown'}], indirect=True) @pytest.mark.parametrize('default_bot', [{'parse_mode': 'Markdown'}], indirect=True)
def test_send_audio_default_parse_mode_1(self, default_bot, chat_id, audio_file, thumb_file): def test_send_audio_default_parse_mode_1(self, default_bot, chat_id, audio_file):
test_string = 'Italic Bold Code' test_string = 'Italic Bold Code'
test_markdown_string = '_Italic_ *Bold* `Code`' test_markdown_string = '_Italic_ *Bold* `Code`'
@ -196,7 +195,7 @@ class TestAudio:
@flaky(3, 1) @flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'parse_mode': 'Markdown'}], indirect=True) @pytest.mark.parametrize('default_bot', [{'parse_mode': 'Markdown'}], indirect=True)
def test_send_audio_default_parse_mode_2(self, default_bot, chat_id, audio_file, thumb_file): def test_send_audio_default_parse_mode_2(self, default_bot, chat_id, audio_file):
test_markdown_string = '_Italic_ *Bold* `Code`' test_markdown_string = '_Italic_ *Bold* `Code`'
message = default_bot.send_audio( message = default_bot.send_audio(
@ -207,7 +206,7 @@ class TestAudio:
@flaky(3, 1) @flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'parse_mode': 'Markdown'}], indirect=True) @pytest.mark.parametrize('default_bot', [{'parse_mode': 'Markdown'}], indirect=True)
def test_send_audio_default_parse_mode_3(self, default_bot, chat_id, audio_file, thumb_file): def test_send_audio_default_parse_mode_3(self, default_bot, chat_id, audio_file):
test_markdown_string = '_Italic_ *Bold* `Code`' test_markdown_string = '_Italic_ *Bold* `Code`'
message = default_bot.send_audio( message = default_bot.send_audio(
@ -216,6 +215,14 @@ class TestAudio:
assert message.caption == test_markdown_string assert message.caption == test_markdown_string
assert message.caption_markdown == escape_markdown(test_markdown_string) assert message.caption_markdown == escape_markdown(test_markdown_string)
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_audio_default_protect_content(self, default_bot, chat_id, audio):
protected_audio = default_bot.send_audio(chat_id, audio)
assert protected_audio.has_protected_content
unprotected = default_bot.send_audio(chat_id, audio, protect_content=False)
assert not unprotected.has_protected_content
def test_send_audio_local_files(self, monkeypatch, bot, chat_id): def test_send_audio_local_files(self, monkeypatch, bot, chat_id):
# For just test that the correct paths are passed as we have no local bot API set up # For just test that the correct paths are passed as we have no local bot API set up
test_flag = False test_flag = False

View file

@ -253,7 +253,6 @@ class TestBot:
'de_list', 'de_list',
'to_dict', 'to_dict',
'to_json', 'to_json',
'log',
'parse_data', 'parse_data',
'get_updates', 'get_updates',
'getUpdates', 'getUpdates',
@ -743,6 +742,14 @@ class TestBot:
reply_to_message_id=reply_to_message.message_id, reply_to_message_id=reply_to_message.message_id,
) )
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_poll_default_protect_content(self, chat_id, default_bot):
protected_poll = default_bot.send_poll(chat_id, 'Test', ['1', '2'])
assert protected_poll.has_protected_content
unprotect_poll = default_bot.send_poll(chat_id, 'test', ['1', '2'], protect_content=False)
assert not unprotect_poll.has_protected_content
@flaky(3, 1) @flaky(3, 1)
@pytest.mark.parametrize('emoji', Dice.ALL_EMOJI + [None]) @pytest.mark.parametrize('emoji', Dice.ALL_EMOJI + [None])
def test_send_dice(self, bot, chat_id, emoji): def test_send_dice(self, bot, chat_id, emoji):
@ -785,6 +792,14 @@ class TestBot:
with pytest.raises(BadRequest, match='message not found'): with pytest.raises(BadRequest, match='message not found'):
default_bot.send_dice(chat_id, reply_to_message_id=reply_to_message.message_id) default_bot.send_dice(chat_id, reply_to_message_id=reply_to_message.message_id)
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_dice_default_protect_content(self, chat_id, default_bot):
protected_dice = default_bot.send_dice(chat_id)
assert protected_dice.has_protected_content
unprotected_dice = default_bot.send_dice(chat_id, protect_content=False)
assert not unprotected_dice.has_protected_content
@flaky(3, 1) @flaky(3, 1)
@pytest.mark.parametrize( @pytest.mark.parametrize(
'chat_action', 'chat_action',
@ -1520,6 +1535,16 @@ class TestBot:
chat_id, game_short_name, reply_to_message_id=reply_to_message.message_id chat_id, game_short_name, reply_to_message_id=reply_to_message.message_id
) )
@flaky(3, 1)
@pytest.mark.parametrize(
'default_bot,val',
[({'protect_content': True}, True), ({'protect_content': False}, None)],
indirect=['default_bot'],
)
def test_send_game_default_protect_content(self, default_bot, chat_id, val):
protected = default_bot.send_game(chat_id, 'test_game', protect_content=val)
assert protected.has_protected_content is val
@xfail @xfail
def test_set_game_score_1(self, bot, chat_id): def test_set_game_score_1(self, bot, chat_id):
# NOTE: numbering of methods assures proper order between test_set_game_scoreX methods # NOTE: numbering of methods assures proper order between test_set_game_scoreX methods
@ -2084,6 +2109,15 @@ class TestBot:
assert message.text == test_markdown_string assert message.text == test_markdown_string
assert message.text_markdown == escape_markdown(test_markdown_string) assert message.text_markdown == escape_markdown(test_markdown_string)
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_message_default_protect_content(self, default_bot, chat_id):
to_check = default_bot.send_message(chat_id, "test")
assert to_check.has_protected_content
no_protect = default_bot.send_message(chat_id, "test", protect_content=False)
assert not no_protect.has_protected_content
@flaky(3, 1) @flaky(3, 1)
@pytest.mark.parametrize( @pytest.mark.parametrize(
'default_bot,custom', 'default_bot,custom',

View file

@ -111,6 +111,14 @@ class TestContact:
chat_id, contact=contact, reply_to_message_id=reply_to_message.message_id chat_id, contact=contact, reply_to_message_id=reply_to_message.message_id
) )
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_contact_default_protect_content(self, chat_id, default_bot, contact):
protected = default_bot.send_contact(chat_id, contact=contact)
assert protected.has_protected_content
unprotected = default_bot.send_contact(chat_id, contact=contact, protect_content=False)
assert not unprotected.has_protected_content
def test_send_contact_without_required(self, bot, chat_id): def test_send_contact_without_required(self, bot, chat_id):
with pytest.raises(ValueError, match='Either contact or phone_number and first_name'): with pytest.raises(ValueError, match='Either contact or phone_number and first_name'):
bot.send_contact(chat_id=chat_id) bot.send_contact(chat_id=chat_id)

View file

@ -18,6 +18,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/]. # along with this program. If not, see [http://www.gnu.org/licenses/].
import pytest import pytest
import inspect
from telegram.ext import Defaults from telegram.ext import Defaults
from telegram import User from telegram import User
@ -33,29 +34,14 @@ class TestDefault:
def test_data_assignment(self, dp): def test_data_assignment(self, dp):
defaults = Defaults() defaults = Defaults()
with pytest.raises(AttributeError): for name, val in inspect.getmembers(Defaults, lambda x: isinstance(x, property)):
defaults.parse_mode = True with pytest.raises(AttributeError):
with pytest.raises(AttributeError): setattr(defaults, name, True)
defaults.explanation_parse_mode = True
with pytest.raises(AttributeError):
defaults.disable_notification = True
with pytest.raises(AttributeError):
defaults.disable_web_page_preview = True
with pytest.raises(AttributeError):
defaults.allow_sending_without_reply = True
with pytest.raises(AttributeError):
defaults.timeout = True
with pytest.raises(AttributeError):
defaults.quote = True
with pytest.raises(AttributeError):
defaults.tzinfo = True
with pytest.raises(AttributeError):
defaults.run_async = True
def test_equality(self): def test_equality(self):
a = Defaults(parse_mode='HTML', quote=True) a = Defaults(parse_mode='HTML', quote=True)
b = Defaults(parse_mode='HTML', quote=True) b = Defaults(parse_mode='HTML', quote=True)
c = Defaults(parse_mode='HTML', quote=False) c = Defaults(parse_mode='HTML', quote=True, protect_content=True)
d = Defaults(parse_mode='HTML', timeout=50) d = Defaults(parse_mode='HTML', timeout=50)
e = User(123, 'test_user', False) e = User(123, 'test_user', False)

View file

@ -241,6 +241,14 @@ class TestDocument:
chat_id, document, reply_to_message_id=reply_to_message.message_id chat_id, document, reply_to_message_id=reply_to_message.message_id
) )
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_document_default_protect_content(self, chat_id, default_bot, document):
protected = default_bot.send_document(chat_id, document)
assert protected.has_protected_content
unprotected = default_bot.send_document(chat_id, document, protect_content=False)
assert not unprotected.has_protected_content
def test_send_document_local_files(self, monkeypatch, bot, chat_id): def test_send_document_local_files(self, monkeypatch, bot, chat_id):
# For just test that the correct paths are passed as we have no local bot API set up # For just test that the correct paths are passed as we have no local bot API set up
test_flag = False test_flag = False

View file

@ -565,6 +565,14 @@ class TestSendMediaGroup:
chat_id, media_group, reply_to_message_id=reply_to_message.message_id chat_id, media_group, reply_to_message_id=reply_to_message.message_id
) )
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_media_group_default_protect_content(self, chat_id, media_group, default_bot):
protected = default_bot.send_media_group(chat_id, media_group)
assert all(msg.has_protected_content for msg in protected)
unprotected = default_bot.send_media_group(chat_id, media_group, protect_content=False)
assert not all(msg.has_protected_content for msg in unprotected)
@flaky(3, 1) @flaky(3, 1)
def test_edit_message_media(self, bot, chat_id, media_group): def test_edit_message_media(self, bot, chat_id, media_group):
messages = bot.send_media_group(chat_id, media_group) messages = bot.send_media_group(chat_id, media_group)

View file

@ -264,6 +264,31 @@ class TestInvoice:
reply_to_message_id=reply_to_message.message_id, reply_to_message_id=reply_to_message.message_id,
) )
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_invoice_default_protect_content(self, chat_id, default_bot, provider_token):
protected = default_bot.send_invoice(
chat_id,
self.title,
self.description,
self.payload,
provider_token,
self.currency,
self.prices,
)
assert protected.has_protected_content
unprotected = default_bot.send_invoice(
chat_id,
self.title,
self.description,
self.payload,
provider_token,
self.currency,
self.prices,
protect_content=False,
)
assert not unprotected.has_protected_content
def test_equality(self): def test_equality(self):
a = Invoice('invoice', 'desc', 'start', 'EUR', 7) a = Invoice('invoice', 'desc', 'start', 'EUR', 7)
b = Invoice('invoice', 'desc', 'start', 'EUR', 7) b = Invoice('invoice', 'desc', 'start', 'EUR', 7)

View file

@ -182,6 +182,14 @@ class TestLocation:
chat_id, location=location, reply_to_message_id=reply_to_message.message_id chat_id, location=location, reply_to_message_id=reply_to_message.message_id
) )
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_location_default_protect_content(self, chat_id, default_bot, location):
protected = default_bot.send_location(chat_id, location=location)
assert protected.has_protected_content
unprotected = default_bot.send_location(chat_id, location=location, protect_content=False)
assert not unprotected.has_protected_content
def test_edit_live_location_with_location(self, monkeypatch, bot, location): def test_edit_live_location_with_location(self, monkeypatch, bot, location):
def test(url, data, **kwargs): def test(url, data, **kwargs):
lat = data['latitude'] == location.latitude lat = data['latitude'] == location.latitude

View file

@ -230,6 +230,14 @@ class TestPhoto:
assert message.caption == test_markdown_string assert message.caption == test_markdown_string
assert message.caption_markdown == escape_markdown(test_markdown_string) assert message.caption_markdown == escape_markdown(test_markdown_string)
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_photo_default_protect_content(self, chat_id, default_bot, photo):
protected = default_bot.send_photo(chat_id, photo)
assert protected.has_protected_content
unprotected = default_bot.send_photo(chat_id, photo, protect_content=False)
assert not unprotected.has_protected_content
def test_send_photo_local_files(self, monkeypatch, bot, chat_id): def test_send_photo_local_files(self, monkeypatch, bot, chat_id):
# For just test that the correct paths are passed as we have no local bot API set up # For just test that the correct paths are passed as we have no local bot API set up
test_flag = False test_flag = False

View file

@ -277,6 +277,14 @@ class TestSticker:
chat_id, sticker, reply_to_message_id=reply_to_message.message_id chat_id, sticker, reply_to_message_id=reply_to_message.message_id
) )
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_sticker_default_protect_content(self, chat_id, sticker, default_bot):
protected = default_bot.send_sticker(chat_id, sticker)
assert protected.has_protected_content
unprotected = default_bot.send_sticker(chat_id, sticker, protect_content=False)
assert not unprotected.has_protected_content
def test_to_dict(self, sticker): def test_to_dict(self, sticker):
sticker_dict = sticker.to_dict() sticker_dict = sticker.to_dict()

View file

@ -121,6 +121,14 @@ class TestVenue:
chat_id, venue=venue, reply_to_message_id=reply_to_message.message_id chat_id, venue=venue, reply_to_message_id=reply_to_message.message_id
) )
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_venue_default_protect_content(self, default_bot, chat_id, venue):
protected = default_bot.send_venue(chat_id, venue=venue)
assert protected.has_protected_content
unprotected = default_bot.send_venue(chat_id, venue=venue, protect_content=False)
assert not unprotected.has_protected_content
def test_send_venue_without_required(self, bot, chat_id): def test_send_venue_without_required(self, bot, chat_id):
with pytest.raises(ValueError, match='Either venue or latitude, longitude, address and'): with pytest.raises(ValueError, match='Either venue or latitude, longitude, address and'):
bot.send_venue(chat_id=chat_id) bot.send_venue(chat_id=chat_id)

View file

@ -232,6 +232,14 @@ class TestVideo:
assert message.caption == test_markdown_string assert message.caption == test_markdown_string
assert message.caption_markdown == escape_markdown(test_markdown_string) assert message.caption_markdown == escape_markdown(test_markdown_string)
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_video_default_protect_content(self, chat_id, default_bot, video):
protected = default_bot.send_video(chat_id, video)
assert protected.has_protected_content
unprotected = default_bot.send_video(chat_id, video, protect_content=False)
assert not unprotected.has_protected_content
def test_send_video_local_files(self, monkeypatch, bot, chat_id): def test_send_video_local_files(self, monkeypatch, bot, chat_id):
# For just test that the correct paths are passed as we have no local bot API set up # For just test that the correct paths are passed as we have no local bot API set up
test_flag = False test_flag = False

View file

@ -219,6 +219,14 @@ class TestVideoNote:
chat_id, video_note, reply_to_message_id=reply_to_message.message_id chat_id, video_note, reply_to_message_id=reply_to_message.message_id
) )
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_video_note_default_protect_content(self, chat_id, default_bot, video_note):
protected = default_bot.send_video_note(chat_id, video_note)
assert protected.has_protected_content
unprotected = default_bot.send_video_note(chat_id, video_note, protect_content=False)
assert not unprotected.has_protected_content
@flaky(3, 1) @flaky(3, 1)
def test_error_send_empty_file(self, bot, chat_id): def test_error_send_empty_file(self, bot, chat_id):
with pytest.raises(TelegramError): with pytest.raises(TelegramError):

View file

@ -193,6 +193,14 @@ class TestVoice:
assert message.caption == test_markdown_string assert message.caption == test_markdown_string
assert message.caption_markdown == escape_markdown(test_markdown_string) assert message.caption_markdown == escape_markdown(test_markdown_string)
@flaky(3, 1)
@pytest.mark.parametrize('default_bot', [{'protect_content': True}], indirect=True)
def test_send_voice_default_protect_content(self, chat_id, default_bot, voice):
protected = default_bot.send_voice(chat_id, voice)
assert protected.has_protected_content
unprotected = default_bot.send_voice(chat_id, voice, protect_content=False)
assert not unprotected.has_protected_content
def test_send_voice_local_files(self, monkeypatch, bot, chat_id): def test_send_voice_local_files(self, monkeypatch, bot, chat_id):
# For just test that the correct paths are passed as we have no local bot API set up # For just test that the correct paths are passed as we have no local bot API set up
test_flag = False test_flag = False