Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API 5.6 #2835

Merged
merged 8 commits into from Jan 3, 2022
Merged

API 5.6 #2835

Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
162 changes: 158 additions & 4 deletions telegram/bot.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions telegram/callbackquery.py
Expand Up @@ -620,6 +620,7 @@ def copy_message(
reply_markup: ReplyMarkup = None,
timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
protect_content: bool = None,
) -> 'MessageId':
"""Shortcut for::

Expand Down Expand Up @@ -648,6 +649,7 @@ def copy_message(
reply_markup=reply_markup,
timeout=timeout,
api_kwargs=api_kwargs,
protect_content=protect_content,
)

MAX_ANSWER_TEXT_LENGTH: ClassVar[int] = constants.MAX_ANSWER_CALLBACK_QUERY_TEXT_LENGTH
Expand Down
38 changes: 38 additions & 0 deletions telegram/chat.py
Expand Up @@ -792,6 +792,7 @@ def send_message(
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand All @@ -815,6 +816,7 @@ def send_message(
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
entities=entities,
protect_content=protect_content,
)

def send_media_group(
Expand All @@ -827,6 +829,7 @@ def send_media_group(
timeout: DVInput[float] = DEFAULT_20,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None,
) -> List['Message']:
"""Shortcut for::

Expand All @@ -846,6 +849,7 @@ def send_media_group(
timeout=timeout,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
protect_content=protect_content,
)

def send_chat_action(
Expand Down Expand Up @@ -887,6 +891,7 @@ def send_photo(
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand All @@ -911,6 +916,7 @@ def send_photo(
allow_sending_without_reply=allow_sending_without_reply,
caption_entities=caption_entities,
filename=filename,
protect_content=protect_content,
)

def send_contact(
Expand All @@ -926,6 +932,7 @@ def send_contact(
vcard: str = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand All @@ -950,6 +957,7 @@ def send_contact(
vcard=vcard,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
protect_content=protect_content,
)

def send_audio(
Expand All @@ -969,6 +977,7 @@ def send_audio(
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand Down Expand Up @@ -997,6 +1006,7 @@ def send_audio(
allow_sending_without_reply=allow_sending_without_reply,
caption_entities=caption_entities,
filename=filename,
protect_content=protect_content,
)

def send_document(
Expand All @@ -1014,6 +1024,7 @@ def send_document(
disable_content_type_detection: bool = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand All @@ -1040,6 +1051,7 @@ def send_document(
disable_content_type_detection=disable_content_type_detection,
allow_sending_without_reply=allow_sending_without_reply,
caption_entities=caption_entities,
protect_content=protect_content,
)

def send_dice(
Expand All @@ -1051,6 +1063,7 @@ def send_dice(
emoji: str = None,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand All @@ -1071,6 +1084,7 @@ def send_dice(
emoji=emoji,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
protect_content=protect_content,
)

def send_game(
Expand All @@ -1082,6 +1096,7 @@ def send_game(
timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand All @@ -1102,6 +1117,7 @@ def send_game(
timeout=timeout,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
protect_content=protect_content,
)

def send_invoice(
Expand Down Expand Up @@ -1133,6 +1149,7 @@ def send_invoice(
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
max_tip_amount: int = None,
suggested_tip_amounts: List[int] = None,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand Down Expand Up @@ -1181,6 +1198,7 @@ def send_invoice(
allow_sending_without_reply=allow_sending_without_reply,
max_tip_amount=max_tip_amount,
suggested_tip_amounts=suggested_tip_amounts,
protect_content=protect_content,
)

def send_location(
Expand All @@ -1198,6 +1216,7 @@ def send_location(
heading: int = None,
proximity_alert_radius: int = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand All @@ -1224,6 +1243,7 @@ def send_location(
heading=heading,
proximity_alert_radius=proximity_alert_radius,
allow_sending_without_reply=allow_sending_without_reply,
protect_content=protect_content,
)

def send_animation(
Expand All @@ -1243,6 +1263,7 @@ def send_animation(
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand Down Expand Up @@ -1271,6 +1292,7 @@ def send_animation(
allow_sending_without_reply=allow_sending_without_reply,
caption_entities=caption_entities,
filename=filename,
protect_content=protect_content,
)

def send_sticker(
Expand All @@ -1282,6 +1304,7 @@ def send_sticker(
timeout: DVInput[float] = DEFAULT_20,
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand All @@ -1302,6 +1325,7 @@ def send_sticker(
timeout=timeout,
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
protect_content=protect_content,
)

def send_venue(
Expand All @@ -1321,6 +1345,7 @@ def send_venue(
google_place_id: str = None,
google_place_type: str = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand Down Expand Up @@ -1349,6 +1374,7 @@ def send_venue(
google_place_id=google_place_id,
google_place_type=google_place_type,
allow_sending_without_reply=allow_sending_without_reply,
protect_content=protect_content,
)

def send_video(
Expand All @@ -1369,6 +1395,7 @@ def send_video(
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand Down Expand Up @@ -1398,6 +1425,7 @@ def send_video(
allow_sending_without_reply=allow_sending_without_reply,
caption_entities=caption_entities,
filename=filename,
protect_content=protect_content,
)

def send_video_note(
Expand All @@ -1413,6 +1441,7 @@ def send_video_note(
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
filename: str = None,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand All @@ -1437,6 +1466,7 @@ def send_video_note(
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
filename=filename,
protect_content=protect_content,
)

def send_voice(
Expand All @@ -1453,6 +1483,7 @@ def send_voice(
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
filename: str = None,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand All @@ -1478,6 +1509,7 @@ def send_voice(
allow_sending_without_reply=allow_sending_without_reply,
caption_entities=caption_entities,
filename=filename,
protect_content=protect_content,
)

def send_poll(
Expand All @@ -1501,6 +1533,7 @@ def send_poll(
api_kwargs: JSONDict = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
explanation_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
protect_content: bool = None,
) -> 'Message':
"""Shortcut for::

Expand Down Expand Up @@ -1532,6 +1565,7 @@ def send_poll(
api_kwargs=api_kwargs,
allow_sending_without_reply=allow_sending_without_reply,
explanation_entities=explanation_entities,
protect_content=protect_content,
)

def send_copy(
Expand All @@ -1547,6 +1581,7 @@ def send_copy(
reply_markup: 'ReplyMarkup' = None,
timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
protect_content: bool = None,
) -> 'MessageId':
"""Shortcut for::

Expand All @@ -1571,6 +1606,7 @@ def send_copy(
reply_markup=reply_markup,
timeout=timeout,
api_kwargs=api_kwargs,
protect_content=protect_content,
)

def copy_message(
Expand All @@ -1586,6 +1622,7 @@ def copy_message(
reply_markup: 'ReplyMarkup' = None,
timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
protect_content: bool = None,
) -> 'MessageId':
"""Shortcut for::

Expand All @@ -1610,6 +1647,7 @@ def copy_message(
reply_markup=reply_markup,
timeout=timeout,
api_kwargs=api_kwargs,
protect_content=protect_content,
)

def export_invite_link(
Expand Down
2 changes: 2 additions & 0 deletions telegram/constants.py
Expand Up @@ -321,6 +321,7 @@
MESSAGEENTITY_TEXT_MENTION: str = 'text_mention'
MESSAGEENTITY_UNDERLINE: str = 'underline'
MESSAGEENTITY_STRIKETHROUGH: str = 'strikethrough'
MESSAGEENTITY_SPOILER: str = 'spoiler'
MESSAGEENTITY_ALL_TYPES: List[str] = [
MESSAGEENTITY_MENTION,
MESSAGEENTITY_HASHTAG,
Expand All @@ -337,6 +338,7 @@
MESSAGEENTITY_TEXT_MENTION,
MESSAGEENTITY_UNDERLINE,
MESSAGEENTITY_STRIKETHROUGH,
MESSAGEENTITY_SPOILER,
]

PARSEMODE_MARKDOWN: str = 'Markdown'
Expand Down
2 changes: 2 additions & 0 deletions telegram/ext/extbot.py
Expand Up @@ -299,6 +299,7 @@ def copy_message(
reply_markup: ReplyMarkup = None,
timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
protect_content: bool = None,
) -> MessageId:
# We override this method to call self._replace_keyboard
return super().copy_message(
Expand All @@ -314,6 +315,7 @@ def copy_message(
reply_markup=self._replace_keyboard(reply_markup),
timeout=timeout,
api_kwargs=api_kwargs,
protect_content=protect_content,
)

def get_chat(
Expand Down