Skip to content

Commit

Permalink
API 5.6 (#2835)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshil21 committed Jan 3, 2022
1 parent c4b413e commit 98bf378
Show file tree
Hide file tree
Showing 24 changed files with 476 additions and 54 deletions.
4 changes: 2 additions & 2 deletions README.rst
Expand Up @@ -20,7 +20,7 @@ We have a vibrant community of developers helping each other in our `Telegram gr
:target: https://pypi.org/project/python-telegram-bot/
:alt: Supported Python versions

.. image:: https://img.shields.io/badge/Bot%20API-5.5-blue?logo=telegram
.. image:: https://img.shields.io/badge/Bot%20API-5.6-blue?logo=telegram
:target: https://core.telegram.org/bots/api-changelog
:alt: Supported Bot API versions

Expand Down Expand Up @@ -111,7 +111,7 @@ Installing both ``python-telegram-bot`` and ``python-telegram-bot-raw`` in conju
Telegram API support
====================

All types and methods of the Telegram Bot API **5.5** are supported.
All types and methods of the Telegram Bot API **5.6** are supported.

==========
Installing
Expand Down
4 changes: 2 additions & 2 deletions README_RAW.rst
Expand Up @@ -20,7 +20,7 @@ We have a vibrant community of developers helping each other in our `Telegram gr
:target: https://pypi.org/project/python-telegram-bot-raw/
:alt: Supported Python versions

.. image:: https://img.shields.io/badge/Bot%20API-5.5-blue?logo=telegram
.. image:: https://img.shields.io/badge/Bot%20API-5.6-blue?logo=telegram
:target: https://core.telegram.org/bots/api-changelog
:alt: Supported Bot API versions

Expand Down Expand Up @@ -105,7 +105,7 @@ Installing both ``python-telegram-bot`` and ``python-telegram-bot-raw`` in conju
Telegram API support
====================

All types and methods of the Telegram Bot API **5.5** are supported.
All types and methods of the Telegram Bot API **5.6** are supported.

==========
Installing
Expand Down
144 changes: 140 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
9 changes: 7 additions & 2 deletions telegram/constants.py
Expand Up @@ -21,7 +21,7 @@
`Telegram Bots API <https://core.telegram.org/bots/api>`_.
Attributes:
BOT_API_VERSION (:obj:`str`): `5.5`. Telegram Bot API version supported by this
BOT_API_VERSION (:obj:`str`): `5.6`. Telegram Bot API version supported by this
version of `python-telegram-bot`. Also available as ``telegram.bot_api_version``.
.. versionadded:: 13.4
Expand Down Expand Up @@ -141,6 +141,9 @@
MESSAGEENTITY_TEXT_MENTION (:obj:`str`): ``'text_mention'``
MESSAGEENTITY_UNDERLINE (:obj:`str`): ``'underline'``
MESSAGEENTITY_STRIKETHROUGH (:obj:`str`): ``'strikethrough'``
MESSAGEENTITY_SPOILER (:obj:`str`): ``'spoiler'``
.. versionadded:: 13.10
MESSAGEENTITY_ALL_TYPES (List[:obj:`str`]): List of all the types of message entity.
:class:`telegram.ParseMode`:
Expand Down Expand Up @@ -244,7 +247,7 @@
"""
from typing import List

BOT_API_VERSION: str = '5.5'
BOT_API_VERSION: str = '5.6'
MAX_MESSAGE_LENGTH: int = 4096
MAX_CAPTION_LENGTH: int = 1024
ANONYMOUS_ADMIN_ID: int = 1087968824
Expand Down Expand Up @@ -321,6 +324,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 +341,7 @@
MESSAGEENTITY_TEXT_MENTION,
MESSAGEENTITY_UNDERLINE,
MESSAGEENTITY_STRIKETHROUGH,
MESSAGEENTITY_SPOILER,
]

PARSEMODE_MARKDOWN: str = 'Markdown'
Expand Down

0 comments on commit 98bf378

Please sign in to comment.