From 6be0b3630583aeeb29ba49f2c56aff0ea505fcd7 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 2 May 2020 23:01:32 +0300 Subject: [PATCH] Dev 3.x api 4.8 (#317) * AIOG-T-20 Bot API 4.8 * AIOG-T-20 Update aliases * AIOG-T-20 Add parse mode passing in sendPoll method * AIOG-T-20 Small changes in docs * AIOG-T-20 Revert overriding remove keyboard default value and add tests * AIOG-T-20 Bot API 4.8 --- .gitignore | 1 + aiogram/__init__.py | 5 +- aiogram/api/client/bot.py | 96 ++++++++++++------- aiogram/api/methods/add_sticker_to_set.py | 6 +- aiogram/api/methods/answer_callback_query.py | 2 +- aiogram/api/methods/base.py | 8 +- aiogram/api/methods/edit_message_caption.py | 3 +- aiogram/api/methods/edit_message_text.py | 3 +- .../api/methods/export_chat_invite_link.py | 2 +- aiogram/api/methods/get_game_high_scores.py | 5 +- aiogram/api/methods/get_updates.py | 2 +- .../api/methods/get_user_profile_photos.py | 2 +- aiogram/api/methods/kick_chat_member.py | 2 +- aiogram/api/methods/promote_chat_member.py | 2 +- aiogram/api/methods/restrict_chat_member.py | 2 +- aiogram/api/methods/send_animation.py | 4 +- aiogram/api/methods/send_audio.py | 3 +- aiogram/api/methods/send_dice.py | 3 + aiogram/api/methods/send_document.py | 3 +- aiogram/api/methods/send_media_group.py | 2 +- aiogram/api/methods/send_message.py | 3 +- aiogram/api/methods/send_photo.py | 3 +- aiogram/api/methods/send_poll.py | 15 ++- aiogram/api/methods/send_video.py | 3 +- aiogram/api/methods/send_voice.py | 4 +- aiogram/api/methods/upload_sticker_file.py | 2 +- aiogram/api/types/__init__.py | 3 +- aiogram/api/types/chat_member.py | 4 +- aiogram/api/types/dice.py | 14 ++- aiogram/api/types/inline_keyboard_button.py | 2 +- .../api/types/inline_query_result_audio.py | 3 +- .../types/inline_query_result_cached_audio.py | 3 +- .../inline_query_result_cached_document.py | 3 +- .../types/inline_query_result_cached_gif.py | 3 +- .../inline_query_result_cached_mpeg4_gif.py | 3 +- .../types/inline_query_result_cached_photo.py | 3 +- .../types/inline_query_result_cached_video.py | 3 +- .../types/inline_query_result_cached_voice.py | 4 +- .../api/types/inline_query_result_document.py | 3 +- aiogram/api/types/inline_query_result_gif.py | 3 +- .../types/inline_query_result_mpeg4_gif.py | 3 +- .../api/types/inline_query_result_photo.py | 3 +- .../api/types/inline_query_result_video.py | 3 +- .../api/types/inline_query_result_voice.py | 4 +- aiogram/api/types/input_media_animation.py | 4 +- aiogram/api/types/input_media_audio.py | 3 +- aiogram/api/types/input_media_document.py | 3 +- aiogram/api/types/input_media_photo.py | 3 +- aiogram/api/types/input_media_video.py | 3 +- .../api/types/input_text_message_content.py | 3 +- aiogram/api/types/message.py | 30 ++++++ aiogram/api/types/poll.py | 13 ++- build.py | 18 ++++ docs/_api_version.md | 2 +- docs/api/index.md | 22 ++++- docs/api/methods/add_sticker_to_set.md | 2 +- docs/api/methods/answer_callback_query.md | 2 +- docs/api/methods/edit_message_caption.md | 2 +- docs/api/methods/edit_message_text.md | 2 +- docs/api/methods/export_chat_invite_link.md | 2 +- docs/api/methods/get_game_high_scores.md | 6 +- docs/api/methods/get_updates.md | 2 +- docs/api/methods/get_user_profile_photos.md | 2 +- docs/api/methods/kick_chat_member.md | 2 +- docs/api/methods/promote_chat_member.md | 2 +- docs/api/methods/restrict_chat_member.md | 2 +- docs/api/methods/send_animation.md | 2 +- docs/api/methods/send_audio.md | 2 +- docs/api/methods/send_dice.md | 1 + docs/api/methods/send_document.md | 2 +- docs/api/methods/send_media_group.md | 2 +- docs/api/methods/send_message.md | 2 +- docs/api/methods/send_photo.md | 2 +- docs/api/methods/send_poll.md | 4 + docs/api/methods/send_video.md | 2 +- docs/api/methods/send_voice.md | 2 +- docs/api/methods/upload_sticker_file.md | 2 +- docs/api/types/chat_member.md | 4 +- docs/api/types/dice.md | 5 +- docs/api/types/inline_keyboard_button.md | 2 +- docs/api/types/inline_query_result_audio.md | 2 +- .../types/inline_query_result_cached_audio.md | 2 +- .../inline_query_result_cached_document.md | 2 +- .../types/inline_query_result_cached_gif.md | 2 +- .../inline_query_result_cached_mpeg4_gif.md | 2 +- .../types/inline_query_result_cached_photo.md | 2 +- .../types/inline_query_result_cached_video.md | 2 +- .../types/inline_query_result_cached_voice.md | 2 +- .../api/types/inline_query_result_document.md | 2 +- docs/api/types/inline_query_result_gif.md | 2 +- .../types/inline_query_result_mpeg4_gif.md | 2 +- docs/api/types/inline_query_result_photo.md | 2 +- docs/api/types/inline_query_result_video.md | 2 +- docs/api/types/inline_query_result_voice.md | 2 +- docs/api/types/input_media_animation.md | 2 +- docs/api/types/input_media_audio.md | 2 +- docs/api/types/input_media_document.md | 2 +- docs/api/types/input_media_photo.md | 2 +- docs/api/types/input_media_video.md | 2 +- docs/api/types/input_text_message_content.md | 2 +- docs/api/types/poll.md | 5 + pyproject.toml | 3 +- tests/test_api/test_types/test_message.py | 2 +- .../test_types/test_reply_keyboard_remove.py | 20 ++++ 104 files changed, 312 insertions(+), 175 deletions(-) create mode 100644 build.py create mode 100644 tests/test_api/test_types/test_reply_keyboard_remove.py diff --git a/.gitignore b/.gitignore index e76a617b..43d848ee 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ dist/ site/ *.egg-info/ *.egg +aiogram/_meta.py .mypy_cache .pytest_cache diff --git a/aiogram/__init__.py b/aiogram/__init__.py index 816a1f57..3eacb117 100644 --- a/aiogram/__init__.py +++ b/aiogram/__init__.py @@ -1,3 +1,4 @@ +from ._meta import VERSION from .api import methods, types from .api.client import session from .api.client.bot import Bot @@ -28,5 +29,5 @@ __all__ = ( "handler", ) -__version__ = "3.0.0a3" -__api_version__ = "4.7" +__version__ = VERSION +__api_version__ = "4.8" diff --git a/aiogram/api/client/bot.py b/aiogram/api/client/bot.py index c33105e4..f626aaaa 100644 --- a/aiogram/api/client/bot.py +++ b/aiogram/api/client/bot.py @@ -224,7 +224,7 @@ class Bot(ContextInstanceMixin["Bot"]): with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten. - :param limit: Limits the number of updates to be retrieved. Values between 1—100 are + :param limit: Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100. :param timeout: Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing @@ -355,8 +355,8 @@ class Bot(ContextInstanceMixin["Bot"]): :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) :param text: Text of the message to be sent, 1-4096 characters after entities parsing - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, - fixed-width text or inline URLs in your bot's message. + :param parse_mode: Mode for parsing entities in the message text. See formatting options + for more details. :param disable_web_page_preview: Disables link previews for links in this message :param disable_notification: Sends the message silently. Users will receive a notification with no sound. @@ -431,8 +431,8 @@ class Bot(ContextInstanceMixin["Bot"]): multipart/form-data. :param caption: Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, - fixed-width text or inline URLs in the media caption. + :param parse_mode: Mode for parsing entities in the photo caption. See formatting options + for more details. :param disable_notification: Sends the message silently. Users will receive a notification with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message @@ -484,8 +484,8 @@ class Bot(ContextInstanceMixin["Bot"]): for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. :param caption: Audio caption, 0-1024 characters after entities parsing - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, - fixed-width text or inline URLs in the media caption. + :param parse_mode: Mode for parsing entities in the audio caption. See formatting options + for more details. :param duration: Duration of the audio in seconds :param performer: Performer :param title: Track name @@ -554,8 +554,8 @@ class Bot(ContextInstanceMixin["Bot"]): multipart/form-data under . :param caption: Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, - fixed-width text or inline URLs in the media caption. + :param parse_mode: Mode for parsing entities in the document caption. See formatting + options for more details. :param disable_notification: Sends the message silently. Users will receive a notification with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message @@ -618,8 +618,8 @@ class Bot(ContextInstanceMixin["Bot"]): multipart/form-data under . :param caption: Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, - fixed-width text or inline URLs in the media caption. + :param parse_mode: Mode for parsing entities in the video caption. See formatting options + for more details. :param supports_streaming: Pass True, if the uploaded video is suitable for streaming :param disable_notification: Sends the message silently. Users will receive a notification with no sound. @@ -686,8 +686,8 @@ class Bot(ContextInstanceMixin["Bot"]): multipart/form-data under . :param caption: Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, - fixed-width text or inline URLs in the media caption. + :param parse_mode: Mode for parsing entities in the animation caption. See formatting + options for more details. :param disable_notification: Sends the message silently. Users will receive a notification with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message @@ -740,8 +740,8 @@ class Bot(ContextInstanceMixin["Bot"]): Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :param caption: Voice message caption, 0-1024 characters after entities parsing - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, - fixed-width text or inline URLs in the media caption. + :param parse_mode: Mode for parsing entities in the voice message caption. See formatting + options for more details. :param duration: Duration of the voice message in seconds :param disable_notification: Sends the message silently. Users will receive a notification with no sound. @@ -833,7 +833,7 @@ class Bot(ContextInstanceMixin["Bot"]): :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) :param media: A JSON-serialized array describing photos and videos to be sent, must - include 2–10 items + include 2-10 items :param disable_notification: Sends the messages silently. Users will receive a notification with no sound. :param reply_to_message_id: If the messages are a reply, ID of the original message @@ -1068,6 +1068,10 @@ class Bot(ContextInstanceMixin["Bot"]): type: Optional[str] = None, allows_multiple_answers: Optional[bool] = None, correct_option_id: Optional[int] = None, + explanation: Optional[str] = None, + explanation_parse_mode: Optional[str] = None, + open_period: Optional[int] = None, + close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, is_closed: Optional[bool] = None, disable_notification: Optional[bool] = None, reply_to_message_id: Optional[int] = None, @@ -1091,6 +1095,16 @@ class Bot(ContextInstanceMixin["Bot"]): polls in quiz mode, defaults to False :param correct_option_id: 0-based identifier of the correct answer option, required for polls in quiz mode + :param explanation: Text that is shown when a user chooses an incorrect answer or taps on + the lamp icon in a quiz-style poll, 0-200 characters with at most 2 + line feeds after entities parsing + :param explanation_parse_mode: Mode for parsing entities in the explanation. See + formatting options for more details. + :param open_period: Amount of time in seconds the poll will be active after creation, + 5-600. Can't be used together with close_date. + :param close_date: Point in time (Unix timestamp) when the poll will be automatically + closed. Must be at least 5 and no more than 600 seconds in the future. + Can't be used together with open_period. :param is_closed: Pass True, if the poll needs to be immediately closed. This can be useful for poll preview. :param disable_notification: Sends the message silently. Users will receive a notification @@ -1109,6 +1123,10 @@ class Bot(ContextInstanceMixin["Bot"]): type=type, allows_multiple_answers=allows_multiple_answers, correct_option_id=correct_option_id, + explanation=explanation, + explanation_parse_mode=explanation_parse_mode, + open_period=open_period, + close_date=close_date, is_closed=is_closed, disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, @@ -1119,6 +1137,7 @@ class Bot(ContextInstanceMixin["Bot"]): async def send_dice( self, chat_id: Union[int, str], + emoji: Optional[str] = None, disable_notification: Optional[bool] = None, reply_to_message_id: Optional[int] = None, reply_markup: Optional[ @@ -1134,6 +1153,8 @@ class Bot(ContextInstanceMixin["Bot"]): :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername) + :param emoji: Emoji on which the dice throw animation is based. Currently, must be one of + '' or ''. Defauts to '' :param disable_notification: Sends the message silently. Users will receive a notification with no sound. :param reply_to_message_id: If the message is a reply, ID of the original message @@ -1144,6 +1165,7 @@ class Bot(ContextInstanceMixin["Bot"]): """ call = SendDice( chat_id=chat_id, + emoji=emoji, disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, reply_markup=reply_markup, @@ -1188,7 +1210,7 @@ class Bot(ContextInstanceMixin["Bot"]): :param user_id: Unique identifier of the target user :param offset: Sequential number of the first photo to be returned. By default, all photos are returned. - :param limit: Limits the number of photos to be retrieved. Values between 1—100 are + :param limit: Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100. :return: Returns a UserProfilePhotos object. """ @@ -1218,7 +1240,7 @@ class Bot(ContextInstanceMixin["Bot"]): self, chat_id: Union[int, str], user_id: int, - until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None, + until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, ) -> bool: """ Use this method to kick a user from a group, a supergroup or a channel. In the case of @@ -1262,7 +1284,7 @@ class Bot(ContextInstanceMixin["Bot"]): chat_id: Union[int, str], user_id: int, permissions: ChatPermissions, - until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None, + until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, ) -> bool: """ Use this method to restrict a user in a supergroup. The bot must be an administrator in @@ -1322,7 +1344,7 @@ class Bot(ContextInstanceMixin["Bot"]): :param can_pin_messages: Pass True, if the administrator can pin messages, supergroups only :param can_promote_members: Pass True, if the administrator can add new administrators - with a subset of his own privileges or demote administrators + with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him) :return: Returns True on success. @@ -1387,7 +1409,7 @@ class Bot(ContextInstanceMixin["Bot"]): appropriate admin rights. Returns the new invite link as String on success. Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, - it will need to generate its own link using exportChatInviteLink – after this the link + it will need to generate its own link using exportChatInviteLink — after this the link will become available to the bot via the getChat method. If your bot needs to generate a new invite link replacing its previous one, use exportChatInviteLink again. @@ -1644,7 +1666,7 @@ class Bot(ContextInstanceMixin["Bot"]): :param show_alert: If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. :param url: URL that will be opened by the user's client. If you have created a Game and - accepted the conditions via @Botfather, specify the URL that opens your game – + accepted the conditions via @Botfather, specify the URL that opens your game — note that this will only work if the query comes from a callback_game button. :param cache_time: The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching @@ -1714,8 +1736,8 @@ class Bot(ContextInstanceMixin["Bot"]): message to edit :param inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, - fixed-width text or inline URLs in your bot's message. + :param parse_mode: Mode for parsing entities in the message text. See formatting options + for more details. :param disable_web_page_preview: Disables link previews for links in this message :param reply_markup: A JSON-serialized object for an inline keyboard. :return: On success, if edited message is sent by the bot, the edited Message is returned, @@ -1755,8 +1777,8 @@ class Bot(ContextInstanceMixin["Bot"]): :param inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message :param caption: New caption of the message, 0-1024 characters after entities parsing - :param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, - fixed-width text or inline URLs in the media caption. + :param parse_mode: Mode for parsing entities in the message caption. See formatting + options for more details. :param reply_markup: A JSON-serialized object for an inline keyboard. :return: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. @@ -1953,7 +1975,7 @@ class Bot(ContextInstanceMixin["Bot"]): Source: https://core.telegram.org/bots/api#uploadstickerfile :param user_id: User identifier of sticker file owner - :param png_sticker: Png image with the sticker, must be up to 512 kilobytes in size, + :param png_sticker: PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. :return: Returns the uploaded File on success. @@ -2016,8 +2038,8 @@ class Bot(ContextInstanceMixin["Bot"]): self, user_id: int, name: str, - png_sticker: Union[InputFile, str], emojis: str, + png_sticker: Optional[Union[InputFile, str]] = None, tgs_sticker: Optional[InputFile] = None, mask_position: Optional[MaskPosition] = None, ) -> bool: @@ -2031,13 +2053,13 @@ class Bot(ContextInstanceMixin["Bot"]): :param user_id: User identifier of sticker set owner :param name: Sticker set name + :param emojis: One or more emoji corresponding to the sticker :param png_sticker: PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. - :param emojis: One or more emoji corresponding to the sticker :param tgs_sticker: TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements @@ -2048,8 +2070,8 @@ class Bot(ContextInstanceMixin["Bot"]): call = AddStickerToSet( user_id=user_id, name=name, - png_sticker=png_sticker, emojis=emojis, + png_sticker=png_sticker, tgs_sticker=tgs_sticker, mask_position=mask_position, ) @@ -2443,9 +2465,9 @@ class Bot(ContextInstanceMixin["Bot"]): ) -> List[GameHighScore]: """ Use this method to get data for high score tables. Will return the score of the specified - user and several of his neighbors in a game. On success, returns an Array of GameHighScore - objects. - This method will currently return scores for the target user, plus two of his closest + user and several of their neighbors in a game. On success, returns an Array of + GameHighScore objects. + This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. Please note that this behavior is subject to change. @@ -2458,11 +2480,11 @@ class Bot(ContextInstanceMixin["Bot"]): message :param inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message - :return: Will return the score of the specified user and several of his neighbors in a + :return: Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects. This method will - currently return scores for the target user, plus two of his closest neighbors on - each side. Will also return the top three users if the user and his neighbors are - not among them. + currently return scores for the target user, plus two of their closest neighbors + on each side. Will also return the top three users if the user and his neighbors + are not among them. """ call = GetGameHighScores( user_id=user_id, diff --git a/aiogram/api/methods/add_sticker_to_set.py b/aiogram/api/methods/add_sticker_to_set.py index 517d21fc..f9c801e3 100644 --- a/aiogram/api/methods/add_sticker_to_set.py +++ b/aiogram/api/methods/add_sticker_to_set.py @@ -20,13 +20,13 @@ class AddStickerToSet(TelegramMethod[bool]): """User identifier of sticker set owner""" name: str """Sticker set name""" - png_sticker: Union[InputFile, str] + emojis: str + """One or more emoji corresponding to the sticker""" + png_sticker: Optional[Union[InputFile, str]] = None """PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.""" - emojis: str - """One or more emoji corresponding to the sticker""" tgs_sticker: Optional[InputFile] = None """TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical diff --git a/aiogram/api/methods/answer_callback_query.py b/aiogram/api/methods/answer_callback_query.py index 23346b73..f0d8405f 100644 --- a/aiogram/api/methods/answer_callback_query.py +++ b/aiogram/api/methods/answer_callback_query.py @@ -27,7 +27,7 @@ class AnswerCallbackQuery(TelegramMethod[bool]): chat screen. Defaults to false.""" url: Optional[str] = None """URL that will be opened by the user's client. If you have created a Game and accepted the - conditions via @Botfather, specify the URL that opens your game – note that this will only + conditions via @Botfather, specify the URL that opens your game — note that this will only work if the query comes from a callback_game button.""" cache_time: Optional[int] = None """The maximum amount of time in seconds that the result of the callback query may be cached diff --git a/aiogram/api/methods/base.py b/aiogram/api/methods/base.py index 72eafa05..52402977 100644 --- a/aiogram/api/methods/base.py +++ b/aiogram/api/methods/base.py @@ -105,19 +105,19 @@ def prepare_media_file(data: Dict[str, Any], files: Dict[str, InputFile]) -> Non data["media"]["media"] = f"attach://{tag}" -def prepare_parse_mode(root: Any) -> None: +def prepare_parse_mode(root: Any, parse_mode_property: str = "parse_mode") -> None: if isinstance(root, list): for item in root: - prepare_parse_mode(item) + prepare_parse_mode(item, parse_mode_property=parse_mode_property) return - if root.get("parse_mode"): + if root.get(parse_mode_property): return from ..client.bot import Bot bot = Bot.get_current(no_error=True) if bot and bot.parse_mode: - root["parse_mode"] = bot.parse_mode + root[parse_mode_property] = bot.parse_mode return return diff --git a/aiogram/api/methods/edit_message_caption.py b/aiogram/api/methods/edit_message_caption.py index 75b5cc69..c0e14469 100644 --- a/aiogram/api/methods/edit_message_caption.py +++ b/aiogram/api/methods/edit_message_caption.py @@ -24,8 +24,7 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]): caption: Optional[str] = None """New caption of the message, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the message caption. See formatting options for more details.""" reply_markup: Optional[InlineKeyboardMarkup] = None """A JSON-serialized object for an inline keyboard.""" diff --git a/aiogram/api/methods/edit_message_text.py b/aiogram/api/methods/edit_message_text.py index 5c3c4c4c..da1da00f 100644 --- a/aiogram/api/methods/edit_message_text.py +++ b/aiogram/api/methods/edit_message_text.py @@ -24,8 +24,7 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]): inline_message_id: Optional[str] = None """Required if chat_id and message_id are not specified. Identifier of the inline message""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in your bot's message.""" + """Mode for parsing entities in the message text. See formatting options for more details.""" disable_web_page_preview: Optional[bool] = None """Disables link previews for links in this message""" reply_markup: Optional[InlineKeyboardMarkup] = None diff --git a/aiogram/api/methods/export_chat_invite_link.py b/aiogram/api/methods/export_chat_invite_link.py index 7d4fc267..923664e0 100644 --- a/aiogram/api/methods/export_chat_invite_link.py +++ b/aiogram/api/methods/export_chat_invite_link.py @@ -10,7 +10,7 @@ class ExportChatInviteLink(TelegramMethod[str]): appropriate admin rights. Returns the new invite link as String on success. Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it - will need to generate its own link using exportChatInviteLink – after this the link will + will need to generate its own link using exportChatInviteLink — after this the link will become available to the bot via the getChat method. If your bot needs to generate a new invite link replacing its previous one, use exportChatInviteLink again. diff --git a/aiogram/api/methods/get_game_high_scores.py b/aiogram/api/methods/get_game_high_scores.py index 9e832f61..5f1b1bb3 100644 --- a/aiogram/api/methods/get_game_high_scores.py +++ b/aiogram/api/methods/get_game_high_scores.py @@ -7,8 +7,9 @@ from .base import Request, TelegramMethod class GetGameHighScores(TelegramMethod[List[GameHighScore]]): """ Use this method to get data for high score tables. Will return the score of the specified user - and several of his neighbors in a game. On success, returns an Array of GameHighScore objects. - This method will currently return scores for the target user, plus two of his closest + and several of their neighbors in a game. On success, returns an Array of GameHighScore + objects. + This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. Please note that this behavior is subject to change. diff --git a/aiogram/api/methods/get_updates.py b/aiogram/api/methods/get_updates.py index ea04e7f3..20ca5a8a 100644 --- a/aiogram/api/methods/get_updates.py +++ b/aiogram/api/methods/get_updates.py @@ -25,7 +25,7 @@ class GetUpdates(TelegramMethod[List[Update]]): specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten.""" limit: Optional[int] = None - """Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults + """Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.""" timeout: Optional[int] = None """Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be diff --git a/aiogram/api/methods/get_user_profile_photos.py b/aiogram/api/methods/get_user_profile_photos.py index 0a0c33d9..def605c0 100644 --- a/aiogram/api/methods/get_user_profile_photos.py +++ b/aiogram/api/methods/get_user_profile_photos.py @@ -19,7 +19,7 @@ class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]): offset: Optional[int] = None """Sequential number of the first photo to be returned. By default, all photos are returned.""" limit: Optional[int] = None - """Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to + """Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100.""" def build_request(self) -> Request: diff --git a/aiogram/api/methods/kick_chat_member.py b/aiogram/api/methods/kick_chat_member.py index 90cb50cf..64af64a1 100644 --- a/aiogram/api/methods/kick_chat_member.py +++ b/aiogram/api/methods/kick_chat_member.py @@ -21,7 +21,7 @@ class KickChatMember(TelegramMethod[bool]): the format @channelusername)""" user_id: int """Unique identifier of the target user""" - until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None + until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None """Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever""" diff --git a/aiogram/api/methods/promote_chat_member.py b/aiogram/api/methods/promote_chat_member.py index c05c9123..db32fd5b 100644 --- a/aiogram/api/methods/promote_chat_member.py +++ b/aiogram/api/methods/promote_chat_member.py @@ -35,7 +35,7 @@ class PromoteChatMember(TelegramMethod[bool]): can_pin_messages: Optional[bool] = None """Pass True, if the administrator can pin messages, supergroups only""" can_promote_members: Optional[bool] = None - """Pass True, if the administrator can add new administrators with a subset of his own + """Pass True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)""" diff --git a/aiogram/api/methods/restrict_chat_member.py b/aiogram/api/methods/restrict_chat_member.py index 7ee5f8c1..05dac3a3 100644 --- a/aiogram/api/methods/restrict_chat_member.py +++ b/aiogram/api/methods/restrict_chat_member.py @@ -23,7 +23,7 @@ class RestrictChatMember(TelegramMethod[bool]): """Unique identifier of the target user""" permissions: ChatPermissions """New user permissions""" - until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None + until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None """Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever""" diff --git a/aiogram/api/methods/send_animation.py b/aiogram/api/methods/send_animation.py index 27007d1b..6e5f6444 100644 --- a/aiogram/api/methods/send_animation.py +++ b/aiogram/api/methods/send_animation.py @@ -46,8 +46,8 @@ class SendAnimation(TelegramMethod[Message]): """Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the animation caption. See formatting options for more + details.""" disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" reply_to_message_id: Optional[int] = None diff --git a/aiogram/api/methods/send_audio.py b/aiogram/api/methods/send_audio.py index a67ca833..d56782e5 100644 --- a/aiogram/api/methods/send_audio.py +++ b/aiogram/api/methods/send_audio.py @@ -34,8 +34,7 @@ class SendAudio(TelegramMethod[Message]): caption: Optional[str] = None """Audio caption, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the audio caption. See formatting options for more details.""" duration: Optional[int] = None """Duration of the audio in seconds""" performer: Optional[str] = None diff --git a/aiogram/api/methods/send_dice.py b/aiogram/api/methods/send_dice.py index 42a8b3a6..f200850e 100644 --- a/aiogram/api/methods/send_dice.py +++ b/aiogram/api/methods/send_dice.py @@ -24,6 +24,9 @@ class SendDice(TelegramMethod[Message]): chat_id: Union[int, str] """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" + emoji: Optional[str] = None + """Emoji on which the dice throw animation is based. Currently, must be one of '' or ''. + Defauts to ''""" disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" reply_to_message_id: Optional[int] = None diff --git a/aiogram/api/methods/send_document.py b/aiogram/api/methods/send_document.py index 3c070539..8415aadf 100644 --- a/aiogram/api/methods/send_document.py +++ b/aiogram/api/methods/send_document.py @@ -40,8 +40,7 @@ class SendDocument(TelegramMethod[Message]): """Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the document caption. See formatting options for more details.""" disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" reply_to_message_id: Optional[int] = None diff --git a/aiogram/api/methods/send_media_group.py b/aiogram/api/methods/send_media_group.py index 69ae1d99..735711dc 100644 --- a/aiogram/api/methods/send_media_group.py +++ b/aiogram/api/methods/send_media_group.py @@ -18,7 +18,7 @@ class SendMediaGroup(TelegramMethod[List[Message]]): """Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" media: List[Union[InputMediaPhoto, InputMediaVideo]] - """A JSON-serialized array describing photos and videos to be sent, must include 2–10 items""" + """A JSON-serialized array describing photos and videos to be sent, must include 2-10 items""" disable_notification: Optional[bool] = None """Sends the messages silently. Users will receive a notification with no sound.""" reply_to_message_id: Optional[int] = None diff --git a/aiogram/api/methods/send_message.py b/aiogram/api/methods/send_message.py index 849a1f5b..080adfdb 100644 --- a/aiogram/api/methods/send_message.py +++ b/aiogram/api/methods/send_message.py @@ -25,8 +25,7 @@ class SendMessage(TelegramMethod[Message]): text: str """Text of the message to be sent, 1-4096 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in your bot's message.""" + """Mode for parsing entities in the message text. See formatting options for more details.""" disable_web_page_preview: Optional[bool] = None """Disables link previews for links in this message""" disable_notification: Optional[bool] = None diff --git a/aiogram/api/methods/send_photo.py b/aiogram/api/methods/send_photo.py index 328b29b6..2b75b815 100644 --- a/aiogram/api/methods/send_photo.py +++ b/aiogram/api/methods/send_photo.py @@ -31,8 +31,7 @@ class SendPhoto(TelegramMethod[Message]): """Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the photo caption. See formatting options for more details.""" disable_notification: Optional[bool] = None """Sends the message silently. Users will receive a notification with no sound.""" reply_to_message_id: Optional[int] = None diff --git a/aiogram/api/methods/send_poll.py b/aiogram/api/methods/send_poll.py index 8a71fe20..95ed10ed 100644 --- a/aiogram/api/methods/send_poll.py +++ b/aiogram/api/methods/send_poll.py @@ -1,3 +1,4 @@ +import datetime from typing import Any, Dict, List, Optional, Union from ..types import ( @@ -7,7 +8,7 @@ from ..types import ( ReplyKeyboardMarkup, ReplyKeyboardRemove, ) -from .base import Request, TelegramMethod +from .base import Request, TelegramMethod, prepare_parse_mode class SendPoll(TelegramMethod[Message]): @@ -35,6 +36,17 @@ class SendPoll(TelegramMethod[Message]): False""" correct_option_id: Optional[int] = None """0-based identifier of the correct answer option, required for polls in quiz mode""" + explanation: Optional[str] = None + """Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a + quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing""" + explanation_parse_mode: Optional[str] = None + """Mode for parsing entities in the explanation. See formatting options for more details.""" + open_period: Optional[int] = None + """Amount of time in seconds the poll will be active after creation, 5-600. Can't be used + together with close_date.""" + close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None + """Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least + 5 and no more than 600 seconds in the future. Can't be used together with open_period.""" is_closed: Optional[bool] = None """Pass True, if the poll needs to be immediately closed. This can be useful for poll preview.""" disable_notification: Optional[bool] = None @@ -49,5 +61,6 @@ class SendPoll(TelegramMethod[Message]): def build_request(self) -> Request: data: Dict[str, Any] = self.dict() + prepare_parse_mode(data, parse_mode_property="explanation_parse_mode") return Request(method="sendPoll", data=data) diff --git a/aiogram/api/methods/send_video.py b/aiogram/api/methods/send_video.py index 07c4a3b6..1017b286 100644 --- a/aiogram/api/methods/send_video.py +++ b/aiogram/api/methods/send_video.py @@ -46,8 +46,7 @@ class SendVideo(TelegramMethod[Message]): """Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the video caption. See formatting options for more details.""" supports_streaming: Optional[bool] = None """Pass True, if the uploaded video is suitable for streaming""" disable_notification: Optional[bool] = None diff --git a/aiogram/api/methods/send_voice.py b/aiogram/api/methods/send_voice.py index 17522782..96e2a159 100644 --- a/aiogram/api/methods/send_voice.py +++ b/aiogram/api/methods/send_voice.py @@ -34,8 +34,8 @@ class SendVoice(TelegramMethod[Message]): caption: Optional[str] = None """Voice message caption, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the voice message caption. See formatting options for more + details.""" duration: Optional[int] = None """Duration of the voice message in seconds""" disable_notification: Optional[bool] = None diff --git a/aiogram/api/methods/upload_sticker_file.py b/aiogram/api/methods/upload_sticker_file.py index e9eea3f0..7e806754 100644 --- a/aiogram/api/methods/upload_sticker_file.py +++ b/aiogram/api/methods/upload_sticker_file.py @@ -17,7 +17,7 @@ class UploadStickerFile(TelegramMethod[File]): user_id: int """User identifier of sticker file owner""" png_sticker: InputFile - """Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed + """PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px.""" def build_request(self) -> Request: diff --git a/aiogram/api/types/__init__.py b/aiogram/api/types/__init__.py index 429b6f41..036166d2 100644 --- a/aiogram/api/types/__init__.py +++ b/aiogram/api/types/__init__.py @@ -10,7 +10,7 @@ from .chat_permissions import ChatPermissions from .chat_photo import ChatPhoto from .chosen_inline_result import ChosenInlineResult from .contact import Contact -from .dice import Dice +from .dice import Dice, DiceEmoji from .document import Document from .encrypted_credentials import EncryptedCredentials from .encrypted_passport_element import EncryptedPassportElement @@ -124,6 +124,7 @@ __all__ = ( "PollAnswer", "Poll", "Dice", + "DiceEmoji", "UserProfilePhotos", "File", "ReplyKeyboardMarkup", diff --git a/aiogram/api/types/chat_member.py b/aiogram/api/types/chat_member.py index 2708b073..58aa7630 100644 --- a/aiogram/api/types/chat_member.py +++ b/aiogram/api/types/chat_member.py @@ -23,7 +23,7 @@ class ChatMember(TelegramObject): 'left' or 'kicked'""" custom_title: Optional[str] = None """Owner and administrators only. Custom title for this user""" - until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None + until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None """Restricted and kicked only. Date when restrictions will be lifted for this user; unix time""" can_be_edited: Optional[bool] = None """Administrators only. True, if the bot is allowed to edit administrator privileges of that @@ -39,7 +39,7 @@ class ChatMember(TelegramObject): """Administrators only. True, if the administrator can restrict, ban or unban chat members""" can_promote_members: Optional[bool] = None """Administrators only. True, if the administrator can add new administrators with a subset of - his own privileges or demote administrators that he has promoted, directly or indirectly + their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user)""" can_change_info: Optional[bool] = None """Administrators and restricted only. True, if the user is allowed to change the chat title, diff --git a/aiogram/api/types/dice.py b/aiogram/api/types/dice.py index 3b1436c6..a85d54ac 100644 --- a/aiogram/api/types/dice.py +++ b/aiogram/api/types/dice.py @@ -5,11 +5,19 @@ from .base import TelegramObject class Dice(TelegramObject): """ - This object represents a dice with random value from 1 to 6. (Yes, we're aware of the 'proper' - singular of die. But it's awkward, and we decided to help it change. One dice at a time!) + This object represents a dice with a random value from 1 to 6 for currently supported base + emoji. (Yes, we're aware of the 'proper' singular of die. But it's awkward, and we decided to + help it change. One dice at a time!) Source: https://core.telegram.org/bots/api#dice """ + emoji: str + """Emoji on which the dice throw animation is based""" value: int - """Value of the dice, 1-6""" + """Value of the dice, 1-6 for currently supported base emoji""" + + +class DiceEmoji: + DICE = "🎲" + DART = "🎯" diff --git a/aiogram/api/types/inline_keyboard_button.py b/aiogram/api/types/inline_keyboard_button.py index b157c666..deb1f3c2 100644 --- a/aiogram/api/types/inline_keyboard_button.py +++ b/aiogram/api/types/inline_keyboard_button.py @@ -32,7 +32,7 @@ class InlineKeyboardButton(MutableTelegramObject): be empty, in which case just the bot’s username will be inserted.""" switch_inline_query_current_chat: Optional[str] = None """If set, pressing the button will insert the bot‘s username and the specified inline query - in the current chat's input field. Can be empty, in which case only the bot’s username will + in the current chat’s input field. Can be empty, in which case only the bot's username will be inserted.""" callback_game: Optional[CallbackGame] = None """Description of the game that will be launched when the user presses the button.""" diff --git a/aiogram/api/types/inline_query_result_audio.py b/aiogram/api/types/inline_query_result_audio.py index c47104ba..dd4ed624 100644 --- a/aiogram/api/types/inline_query_result_audio.py +++ b/aiogram/api/types/inline_query_result_audio.py @@ -33,8 +33,7 @@ class InlineQueryResultAudio(InlineQueryResult): caption: Optional[str] = None """Caption, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the audio caption. See formatting options for more details.""" performer: Optional[str] = None """Performer""" audio_duration: Optional[int] = None diff --git a/aiogram/api/types/inline_query_result_cached_audio.py b/aiogram/api/types/inline_query_result_cached_audio.py index 426ea462..b1b32880 100644 --- a/aiogram/api/types/inline_query_result_cached_audio.py +++ b/aiogram/api/types/inline_query_result_cached_audio.py @@ -31,8 +31,7 @@ class InlineQueryResultCachedAudio(InlineQueryResult): caption: Optional[str] = None """Caption, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the audio caption. See formatting options for more details.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_cached_document.py b/aiogram/api/types/inline_query_result_cached_document.py index 27bcd27e..1f377fb7 100644 --- a/aiogram/api/types/inline_query_result_cached_document.py +++ b/aiogram/api/types/inline_query_result_cached_document.py @@ -35,8 +35,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult): caption: Optional[str] = None """Caption of the document to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the document caption. See formatting options for more details.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_cached_gif.py b/aiogram/api/types/inline_query_result_cached_gif.py index 2b85bcd9..228da905 100644 --- a/aiogram/api/types/inline_query_result_cached_gif.py +++ b/aiogram/api/types/inline_query_result_cached_gif.py @@ -31,8 +31,7 @@ class InlineQueryResultCachedGif(InlineQueryResult): caption: Optional[str] = None """Caption of the GIF file to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the caption. See formatting options for more details.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_cached_mpeg4_gif.py b/aiogram/api/types/inline_query_result_cached_mpeg4_gif.py index 5611e114..73e9ad2b 100644 --- a/aiogram/api/types/inline_query_result_cached_mpeg4_gif.py +++ b/aiogram/api/types/inline_query_result_cached_mpeg4_gif.py @@ -32,8 +32,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult): caption: Optional[str] = None """Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the caption. See formatting options for more details.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_cached_photo.py b/aiogram/api/types/inline_query_result_cached_photo.py index da865bed..be425a5c 100644 --- a/aiogram/api/types/inline_query_result_cached_photo.py +++ b/aiogram/api/types/inline_query_result_cached_photo.py @@ -33,8 +33,7 @@ class InlineQueryResultCachedPhoto(InlineQueryResult): caption: Optional[str] = None """Caption of the photo to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the photo caption. See formatting options for more details.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_cached_video.py b/aiogram/api/types/inline_query_result_cached_video.py index db71f4f2..497283e4 100644 --- a/aiogram/api/types/inline_query_result_cached_video.py +++ b/aiogram/api/types/inline_query_result_cached_video.py @@ -33,8 +33,7 @@ class InlineQueryResultCachedVideo(InlineQueryResult): caption: Optional[str] = None """Caption of the video to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the video caption. See formatting options for more details.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_cached_voice.py b/aiogram/api/types/inline_query_result_cached_voice.py index 9d65b6fd..c11ecef0 100644 --- a/aiogram/api/types/inline_query_result_cached_voice.py +++ b/aiogram/api/types/inline_query_result_cached_voice.py @@ -33,8 +33,8 @@ class InlineQueryResultCachedVoice(InlineQueryResult): caption: Optional[str] = None """Caption, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the voice message caption. See formatting options for more + details.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_document.py b/aiogram/api/types/inline_query_result_document.py index 625b4675..207345de 100644 --- a/aiogram/api/types/inline_query_result_document.py +++ b/aiogram/api/types/inline_query_result_document.py @@ -36,8 +36,7 @@ class InlineQueryResultDocument(InlineQueryResult): caption: Optional[str] = None """Caption of the document to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the document caption. See formatting options for more details.""" description: Optional[str] = None """Short description of the result""" reply_markup: Optional[InlineKeyboardMarkup] = None diff --git a/aiogram/api/types/inline_query_result_gif.py b/aiogram/api/types/inline_query_result_gif.py index ffaa7a66..e428225b 100644 --- a/aiogram/api/types/inline_query_result_gif.py +++ b/aiogram/api/types/inline_query_result_gif.py @@ -39,8 +39,7 @@ class InlineQueryResultGif(InlineQueryResult): caption: Optional[str] = None """Caption of the GIF file to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the caption. See formatting options for more details.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_mpeg4_gif.py b/aiogram/api/types/inline_query_result_mpeg4_gif.py index 59d1ef01..139dbb30 100644 --- a/aiogram/api/types/inline_query_result_mpeg4_gif.py +++ b/aiogram/api/types/inline_query_result_mpeg4_gif.py @@ -40,8 +40,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult): caption: Optional[str] = None """Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the caption. See formatting options for more details.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_photo.py b/aiogram/api/types/inline_query_result_photo.py index 7ee7e4f5..e44b63c8 100644 --- a/aiogram/api/types/inline_query_result_photo.py +++ b/aiogram/api/types/inline_query_result_photo.py @@ -39,8 +39,7 @@ class InlineQueryResultPhoto(InlineQueryResult): caption: Optional[str] = None """Caption of the photo to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the photo caption. See formatting options for more details.""" reply_markup: Optional[InlineKeyboardMarkup] = None """Inline keyboard attached to the message""" input_message_content: Optional[InputMessageContent] = None diff --git a/aiogram/api/types/inline_query_result_video.py b/aiogram/api/types/inline_query_result_video.py index a0010fea..a025fc4e 100644 --- a/aiogram/api/types/inline_query_result_video.py +++ b/aiogram/api/types/inline_query_result_video.py @@ -37,8 +37,7 @@ class InlineQueryResultVideo(InlineQueryResult): caption: Optional[str] = None """Caption of the video to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the video caption. See formatting options for more details.""" video_width: Optional[int] = None """Video width""" video_height: Optional[int] = None diff --git a/aiogram/api/types/inline_query_result_voice.py b/aiogram/api/types/inline_query_result_voice.py index b4b10f4f..161eafe8 100644 --- a/aiogram/api/types/inline_query_result_voice.py +++ b/aiogram/api/types/inline_query_result_voice.py @@ -34,8 +34,8 @@ class InlineQueryResultVoice(InlineQueryResult): caption: Optional[str] = None """Caption, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the voice message caption. See formatting options for more + details.""" voice_duration: Optional[int] = None """Recording duration in seconds""" reply_markup: Optional[InlineKeyboardMarkup] = None diff --git a/aiogram/api/types/input_media_animation.py b/aiogram/api/types/input_media_animation.py index de994e85..17523135 100644 --- a/aiogram/api/types/input_media_animation.py +++ b/aiogram/api/types/input_media_animation.py @@ -34,8 +34,8 @@ class InputMediaAnimation(InputMedia): caption: Optional[str] = None """Caption of the animation to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the animation caption. See formatting options for more + details.""" width: Optional[int] = None """Animation width""" height: Optional[int] = None diff --git a/aiogram/api/types/input_media_audio.py b/aiogram/api/types/input_media_audio.py index 9d700101..37162374 100644 --- a/aiogram/api/types/input_media_audio.py +++ b/aiogram/api/types/input_media_audio.py @@ -34,8 +34,7 @@ class InputMediaAudio(InputMedia): caption: Optional[str] = None """Caption of the audio to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the audio caption. See formatting options for more details.""" duration: Optional[int] = None """Duration of the audio in seconds""" performer: Optional[str] = None diff --git a/aiogram/api/types/input_media_document.py b/aiogram/api/types/input_media_document.py index 5f95b233..a3237906 100644 --- a/aiogram/api/types/input_media_document.py +++ b/aiogram/api/types/input_media_document.py @@ -34,5 +34,4 @@ class InputMediaDocument(InputMedia): caption: Optional[str] = None """Caption of the document to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the document caption. See formatting options for more details.""" diff --git a/aiogram/api/types/input_media_photo.py b/aiogram/api/types/input_media_photo.py index 7698d95d..529a5bc9 100644 --- a/aiogram/api/types/input_media_photo.py +++ b/aiogram/api/types/input_media_photo.py @@ -27,5 +27,4 @@ class InputMediaPhoto(InputMedia): caption: Optional[str] = None """Caption of the photo to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the photo caption. See formatting options for more details.""" diff --git a/aiogram/api/types/input_media_video.py b/aiogram/api/types/input_media_video.py index a0cdd46f..6af1b68c 100644 --- a/aiogram/api/types/input_media_video.py +++ b/aiogram/api/types/input_media_video.py @@ -34,8 +34,7 @@ class InputMediaVideo(InputMedia): caption: Optional[str] = None """Caption of the video to be sent, 0-1024 characters after entities parsing""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in the media caption.""" + """Mode for parsing entities in the video caption. See formatting options for more details.""" width: Optional[int] = None """Video width""" height: Optional[int] = None diff --git a/aiogram/api/types/input_text_message_content.py b/aiogram/api/types/input_text_message_content.py index ff3ef5d9..2a8257cd 100644 --- a/aiogram/api/types/input_text_message_content.py +++ b/aiogram/api/types/input_text_message_content.py @@ -15,7 +15,6 @@ class InputTextMessageContent(InputMessageContent): message_text: str """Text of the message to be sent, 1-4096 characters""" parse_mode: Optional[str] = None - """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or - inline URLs in your bot's message.""" + """Mode for parsing entities in the message text. See formatting options for more details.""" disable_web_page_preview: Optional[bool] = None """Disables link previews for links in the sent message""" diff --git a/aiogram/api/types/message.py b/aiogram/api/types/message.py index 32894498..68b56209 100644 --- a/aiogram/api/types/message.py +++ b/aiogram/api/types/message.py @@ -1007,6 +1007,10 @@ class Message(TelegramObject): type: Optional[str] = None, allows_multiple_answers: Optional[bool] = None, correct_option_id: Optional[int] = None, + explanation: Optional[str] = None, + explanation_parse_mode: Optional[str] = None, + open_period: Optional[int] = None, + close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, is_closed: Optional[bool] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[ @@ -1022,6 +1026,10 @@ class Message(TelegramObject): :param type: :param allows_multiple_answers: :param correct_option_id: + :param explanation: + :param explanation_parse_mode: + :param open_period: + :param close_date: :param is_closed: :param disable_notification: :param reply_markup: @@ -1037,6 +1045,10 @@ class Message(TelegramObject): type=type, allows_multiple_answers=allows_multiple_answers, correct_option_id=correct_option_id, + explanation=explanation, + explanation_parse_mode=explanation_parse_mode, + open_period=open_period, + close_date=close_date, is_closed=is_closed, disable_notification=disable_notification, reply_to_message_id=self.message_id, @@ -1051,6 +1063,10 @@ class Message(TelegramObject): type: Optional[str] = None, allows_multiple_answers: Optional[bool] = None, correct_option_id: Optional[int] = None, + explanation: Optional[str] = None, + explanation_parse_mode: Optional[str] = None, + open_period: Optional[int] = None, + close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None, is_closed: Optional[bool] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[ @@ -1066,6 +1082,10 @@ class Message(TelegramObject): :param type: :param allows_multiple_answers: :param correct_option_id: + :param explanation: + :param explanation_parse_mode: + :param open_period: + :param close_date: :param is_closed: :param disable_notification: :param reply_markup: @@ -1081,6 +1101,10 @@ class Message(TelegramObject): type=type, allows_multiple_answers=allows_multiple_answers, correct_option_id=correct_option_id, + explanation=explanation, + explanation_parse_mode=explanation_parse_mode, + open_period=open_period, + close_date=close_date, is_closed=is_closed, disable_notification=disable_notification, reply_to_message_id=None, @@ -1089,6 +1113,7 @@ class Message(TelegramObject): def reply_dice( self, + emoji: Optional[str] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -1097,6 +1122,7 @@ class Message(TelegramObject): """ Reply with dice + :param emoji: :param disable_notification: :param reply_markup: :return: @@ -1105,6 +1131,7 @@ class Message(TelegramObject): return SendDice( chat_id=self.chat.id, + emoji=emoji, disable_notification=disable_notification, reply_to_message_id=self.message_id, reply_markup=reply_markup, @@ -1112,6 +1139,7 @@ class Message(TelegramObject): def answer_dice( self, + emoji: Optional[str] = None, disable_notification: Optional[bool] = None, reply_markup: Optional[ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] @@ -1120,6 +1148,7 @@ class Message(TelegramObject): """ Answer with dice + :param emoji: :param disable_notification: :param reply_markup: :return: @@ -1128,6 +1157,7 @@ class Message(TelegramObject): return SendDice( chat_id=self.chat.id, + emoji=emoji, disable_notification=disable_notification, reply_to_message_id=None, reply_markup=reply_markup, diff --git a/aiogram/api/types/poll.py b/aiogram/api/types/poll.py index 4fe97330..c19808fc 100644 --- a/aiogram/api/types/poll.py +++ b/aiogram/api/types/poll.py @@ -1,10 +1,12 @@ from __future__ import annotations -from typing import TYPE_CHECKING, List, Optional +import datetime +from typing import TYPE_CHECKING, List, Optional, Union from .base import TelegramObject if TYPE_CHECKING: # pragma: no cover + from .message_entity import MessageEntity from .poll_option import PollOption @@ -35,3 +37,12 @@ class Poll(TelegramObject): """0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.""" + explanation: Optional[str] = None + """Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a + quiz-style poll, 0-200 characters""" + explanation_entities: Optional[List[MessageEntity]] = None + """Special entities like usernames, URLs, bot commands, etc. that appear in the explanation""" + open_period: Optional[int] = None + """Amount of time in seconds the poll will be active after creation""" + close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None + """Point in time (Unix timestamp) when the poll will be automatically closed""" diff --git a/build.py b/build.py new file mode 100644 index 00000000..376523a6 --- /dev/null +++ b/build.py @@ -0,0 +1,18 @@ +from pathlib import Path +from typing import Any, Dict + +BUILD_PATH: Path = Path(__file__).parent +META_PATH: Path = BUILD_PATH / "aiogram" / "_meta.py" + + +def write_metadata(setup_kwargs: Dict[str, Any]) -> None: + version = setup_kwargs["version"] + description = setup_kwargs["description"] + + content = [f"VERSION = {version!r}", f"DESCRIPTION = {description!r}"] + + META_PATH.write_text("\n".join(content + [""])) + + +def build(setup_kwargs: Dict[str, Any]): + write_metadata(setup_kwargs) diff --git a/docs/_api_version.md b/docs/_api_version.md index 4f8c6396..ef216a53 100644 --- a/docs/_api_version.md +++ b/docs/_api_version.md @@ -1 +1 @@ -4.7 +4.8 diff --git a/docs/api/index.md b/docs/api/index.md index 5164d96f..3b3ed1e5 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -18,7 +18,7 @@ Full list of methods can be found in section "[Methods](methods/index.md)" All types is also wrapped with [pydantic](https://pydantic-docs.helpmanual.io/) and placed in `aiogram.api.types` package. In this place makes some more differences with official documentations: -- name `from` was renamed to `from_user` in due to `from` is an keyword in python +- name `from` was renamed to `from_user` in due to `from` is an [keyword in python](https://docs.python.org/3/reference/lexical_analysis.html#keywords) - timestamps has `datetime.datetime` type instead of `int` - InputFile is used for sending files and is not use `pydantic.BaseModel` as base class @@ -37,3 +37,23 @@ Constructor specification: | `parse_mode` | `#!python3 Optional[str]` | Default parse mode. If specified it will be propagated into the API methods at runtime. | This class has aliases for all API methods and named in `lower_camel_case`. For example `sendMessage` named `send_message` and has the same specification with all class-based methods. + +Here you can pass default parse mode (argument `parse_mode`) and this value will be used in all API methods automatically. + + +## Usage +```python3 +import asyncio +from os import getenv + +from aiogram import Bot + + +async def main(): + async with Bot(token=getenv("TELEGRAM_TOKEN"), parse_mode="HTML").context() as bot: + await bot.send_message(61043901, "Hello, World!") + + +if __name__ == "__main__": + asyncio.run(main()) +``` diff --git a/docs/api/methods/add_sticker_to_set.md b/docs/api/methods/add_sticker_to_set.md index 910b072d..f40f3c10 100644 --- a/docs/api/methods/add_sticker_to_set.md +++ b/docs/api/methods/add_sticker_to_set.md @@ -11,8 +11,8 @@ Use this method to add a new sticker to a set created by the bot. You must use e | - | - | - | | `user_id` | `#!python3 int` | User identifier of sticker set owner | | `name` | `#!python3 str` | Sticker set name | -| `png_sticker` | `#!python3 Union[InputFile, str]` | PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. | | `emojis` | `#!python3 str` | One or more emoji corresponding to the sticker | +| `png_sticker` | `#!python3 Optional[Union[InputFile, str]]` | Optional. PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. | | `tgs_sticker` | `#!python3 Optional[InputFile]` | Optional. TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements | | `mask_position` | `#!python3 Optional[MaskPosition]` | Optional. A JSON-serialized object for position where the mask should be placed on faces | diff --git a/docs/api/methods/answer_callback_query.md b/docs/api/methods/answer_callback_query.md index 202ecb49..63afe5df 100644 --- a/docs/api/methods/answer_callback_query.md +++ b/docs/api/methods/answer_callback_query.md @@ -14,7 +14,7 @@ Alternatively, the user can be redirected to the specified Game URL. For this op | `callback_query_id` | `#!python3 str` | Unique identifier for the query to be answered | | `text` | `#!python3 Optional[str]` | Optional. Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters | | `show_alert` | `#!python3 Optional[bool]` | Optional. If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. | -| `url` | `#!python3 Optional[str]` | Optional. URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game – note that this will only work if the query comes from a callback_game button. | +| `url` | `#!python3 Optional[str]` | Optional. URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game — note that this will only work if the query comes from a callback_game button. | | `cache_time` | `#!python3 Optional[int]` | Optional. The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0. | diff --git a/docs/api/methods/edit_message_caption.md b/docs/api/methods/edit_message_caption.md index 7f2c6556..19a472e2 100644 --- a/docs/api/methods/edit_message_caption.md +++ b/docs/api/methods/edit_message_caption.md @@ -13,7 +13,7 @@ Use this method to edit captions of messages. On success, if edited message is s | `message_id` | `#!python3 Optional[int]` | Optional. Required if inline_message_id is not specified. Identifier of the message to edit | | `inline_message_id` | `#!python3 Optional[str]` | Optional. Required if chat_id and message_id are not specified. Identifier of the inline message | | `caption` | `#!python3 Optional[str]` | Optional. New caption of the message, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the message caption. See formatting options for more details. | | `reply_markup` | `#!python3 Optional[InlineKeyboardMarkup]` | Optional. A JSON-serialized object for an inline keyboard. | diff --git a/docs/api/methods/edit_message_text.md b/docs/api/methods/edit_message_text.md index 8931a835..6095964c 100644 --- a/docs/api/methods/edit_message_text.md +++ b/docs/api/methods/edit_message_text.md @@ -13,7 +13,7 @@ Use this method to edit text and game messages. On success, if edited message is | `chat_id` | `#!python3 Optional[Union[int, str]]` | Optional. Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername) | | `message_id` | `#!python3 Optional[int]` | Optional. Required if inline_message_id is not specified. Identifier of the message to edit | | `inline_message_id` | `#!python3 Optional[str]` | Optional. Required if chat_id and message_id are not specified. Identifier of the inline message | -| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. | +| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the message text. See formatting options for more details. | | `disable_web_page_preview` | `#!python3 Optional[bool]` | Optional. Disables link previews for links in this message | | `reply_markup` | `#!python3 Optional[InlineKeyboardMarkup]` | Optional. A JSON-serialized object for an inline keyboard. | diff --git a/docs/api/methods/export_chat_invite_link.md b/docs/api/methods/export_chat_invite_link.md index cfa43df6..d205275d 100644 --- a/docs/api/methods/export_chat_invite_link.md +++ b/docs/api/methods/export_chat_invite_link.md @@ -4,7 +4,7 @@ Use this method to generate a new invite link for a chat; any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the new invite link as String on success. -Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using exportChatInviteLink – after this the link will become available to the bot via the getChat method. If your bot needs to generate a new invite link replacing its previous one, use exportChatInviteLink again. +Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using exportChatInviteLink — after this the link will become available to the bot via the getChat method. If your bot needs to generate a new invite link replacing its previous one, use exportChatInviteLink again. ## Arguments diff --git a/docs/api/methods/get_game_high_scores.md b/docs/api/methods/get_game_high_scores.md index 0b0390d1..c26eaaf6 100644 --- a/docs/api/methods/get_game_high_scores.md +++ b/docs/api/methods/get_game_high_scores.md @@ -2,9 +2,9 @@ ## Description -Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects. +Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects. -This method will currently return scores for the target user, plus two of his closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. Please note that this behavior is subject to change. +This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. Please note that this behavior is subject to change. ## Arguments @@ -22,7 +22,7 @@ This method will currently return scores for the target user, plus two of his cl Type: `#!python3 List[GameHighScore]` -Description: Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects. This method will currently return scores for the target user, plus two of his closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. +Description: Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects. This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. ## Usage diff --git a/docs/api/methods/get_updates.md b/docs/api/methods/get_updates.md index e7850ed4..1202e9bb 100644 --- a/docs/api/methods/get_updates.md +++ b/docs/api/methods/get_updates.md @@ -16,7 +16,7 @@ Notes | Name | Type | Description | | - | - | - | | `offset` | `#!python3 Optional[int]` | Optional. Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten. | -| `limit` | `#!python3 Optional[int]` | Optional. Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100. | +| `limit` | `#!python3 Optional[int]` | Optional. Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100. | | `timeout` | `#!python3 Optional[int]` | Optional. Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only. | | `allowed_updates` | `#!python3 Optional[List[str]]` | Optional. A JSON-serialized list of the update types you want your bot to receive. For example, specify ['message', 'edited_channel_post', 'callback_query'] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used. | diff --git a/docs/api/methods/get_user_profile_photos.md b/docs/api/methods/get_user_profile_photos.md index a02a2a99..15145145 100644 --- a/docs/api/methods/get_user_profile_photos.md +++ b/docs/api/methods/get_user_profile_photos.md @@ -11,7 +11,7 @@ Use this method to get a list of profile pictures for a user. Returns a UserProf | - | - | - | | `user_id` | `#!python3 int` | Unique identifier of the target user | | `offset` | `#!python3 Optional[int]` | Optional. Sequential number of the first photo to be returned. By default, all photos are returned. | -| `limit` | `#!python3 Optional[int]` | Optional. Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100. | +| `limit` | `#!python3 Optional[int]` | Optional. Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100. | diff --git a/docs/api/methods/kick_chat_member.md b/docs/api/methods/kick_chat_member.md index d58e5664..eeaa7243 100644 --- a/docs/api/methods/kick_chat_member.md +++ b/docs/api/methods/kick_chat_member.md @@ -11,7 +11,7 @@ Use this method to kick a user from a group, a supergroup or a channel. In the c | - | - | - | | `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername) | | `user_id` | `#!python3 int` | Unique identifier of the target user | -| `until_date` | `#!python3 Optional[Union[int, datetime.datetime, datetime.timedelta]]` | Optional. Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever | +| `until_date` | `#!python3 Optional[Union[datetime.datetime, datetime.timedelta, int]]` | Optional. Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever | diff --git a/docs/api/methods/promote_chat_member.md b/docs/api/methods/promote_chat_member.md index eae50d26..3466215a 100644 --- a/docs/api/methods/promote_chat_member.md +++ b/docs/api/methods/promote_chat_member.md @@ -18,7 +18,7 @@ Use this method to promote or demote a user in a supergroup or a channel. The bo | `can_invite_users` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can invite new users to the chat | | `can_restrict_members` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can restrict, ban or unban chat members | | `can_pin_messages` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can pin messages, supergroups only | -| `can_promote_members` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him) | +| `can_promote_members` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him) | diff --git a/docs/api/methods/restrict_chat_member.md b/docs/api/methods/restrict_chat_member.md index 50ed84fa..2ba06980 100644 --- a/docs/api/methods/restrict_chat_member.md +++ b/docs/api/methods/restrict_chat_member.md @@ -12,7 +12,7 @@ Use this method to restrict a user in a supergroup. The bot must be an administr | `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) | | `user_id` | `#!python3 int` | Unique identifier of the target user | | `permissions` | `#!python3 ChatPermissions` | New user permissions | -| `until_date` | `#!python3 Optional[Union[int, datetime.datetime, datetime.timedelta]]` | Optional. Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever | +| `until_date` | `#!python3 Optional[Union[datetime.datetime, datetime.timedelta, int]]` | Optional. Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever | diff --git a/docs/api/methods/send_animation.md b/docs/api/methods/send_animation.md index b383ca61..36f576e7 100644 --- a/docs/api/methods/send_animation.md +++ b/docs/api/methods/send_animation.md @@ -16,7 +16,7 @@ Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without s | `height` | `#!python3 Optional[int]` | Optional. Animation height | | `thumb` | `#!python3 Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . | | `caption` | `#!python3 Optional[str]` | Optional. Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing | -| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the animation caption. See formatting options for more details. | | `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. | | `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message | | `reply_markup` | `#!python3 Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` | Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | diff --git a/docs/api/methods/send_audio.md b/docs/api/methods/send_audio.md index dede2bc1..0e20fd51 100644 --- a/docs/api/methods/send_audio.md +++ b/docs/api/methods/send_audio.md @@ -14,7 +14,7 @@ For sending voice messages, use the sendVoice method instead. | `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) | | `audio` | `#!python3 Union[InputFile, str]` | Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. | | `caption` | `#!python3 Optional[str]` | Optional. Audio caption, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the audio caption. See formatting options for more details. | | `duration` | `#!python3 Optional[int]` | Optional. Duration of the audio in seconds | | `performer` | `#!python3 Optional[str]` | Optional. Performer | | `title` | `#!python3 Optional[str]` | Optional. Track name | diff --git a/docs/api/methods/send_dice.md b/docs/api/methods/send_dice.md index 86180563..6ac56aaf 100644 --- a/docs/api/methods/send_dice.md +++ b/docs/api/methods/send_dice.md @@ -10,6 +10,7 @@ Use this method to send a dice, which will have a random value from 1 to 6. On s | Name | Type | Description | | - | - | - | | `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) | +| `emoji` | `#!python3 Optional[str]` | Optional. Emoji on which the dice throw animation is based. Currently, must be one of '' or ''. Defauts to '' | | `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. | | `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message | | `reply_markup` | `#!python3 Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` | Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | diff --git a/docs/api/methods/send_document.md b/docs/api/methods/send_document.md index 99a869c4..8a6d9dd1 100644 --- a/docs/api/methods/send_document.md +++ b/docs/api/methods/send_document.md @@ -13,7 +13,7 @@ Use this method to send general files. On success, the sent Message is returned. | `document` | `#!python3 Union[InputFile, str]` | File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. | | `thumb` | `#!python3 Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . | | `caption` | `#!python3 Optional[str]` | Optional. Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing | -| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the document caption. See formatting options for more details. | | `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. | | `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message | | `reply_markup` | `#!python3 Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` | Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | diff --git a/docs/api/methods/send_media_group.md b/docs/api/methods/send_media_group.md index b15ccacc..230a96a1 100644 --- a/docs/api/methods/send_media_group.md +++ b/docs/api/methods/send_media_group.md @@ -10,7 +10,7 @@ Use this method to send a group of photos or videos as an album. On success, an | Name | Type | Description | | - | - | - | | `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) | -| `media` | `#!python3 List[Union[InputMediaPhoto, InputMediaVideo]]` | A JSON-serialized array describing photos and videos to be sent, must include 2–10 items | +| `media` | `#!python3 List[Union[InputMediaPhoto, InputMediaVideo]]` | A JSON-serialized array describing photos and videos to be sent, must include 2-10 items | | `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the messages silently. Users will receive a notification with no sound. | | `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the messages are a reply, ID of the original message | diff --git a/docs/api/methods/send_message.md b/docs/api/methods/send_message.md index 67b740ba..2c811987 100644 --- a/docs/api/methods/send_message.md +++ b/docs/api/methods/send_message.md @@ -11,7 +11,7 @@ Use this method to send text messages. On success, the sent Message is returned. | - | - | - | | `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) | | `text` | `#!python3 str` | Text of the message to be sent, 1-4096 characters after entities parsing | -| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. | +| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the message text. See formatting options for more details. | | `disable_web_page_preview` | `#!python3 Optional[bool]` | Optional. Disables link previews for links in this message | | `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. | | `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message | diff --git a/docs/api/methods/send_photo.md b/docs/api/methods/send_photo.md index d2667a85..224a4fac 100644 --- a/docs/api/methods/send_photo.md +++ b/docs/api/methods/send_photo.md @@ -12,7 +12,7 @@ Use this method to send photos. On success, the sent Message is returned. | `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) | | `photo` | `#!python3 Union[InputFile, str]` | Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. | | `caption` | `#!python3 Optional[str]` | Optional. Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing | -| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the photo caption. See formatting options for more details. | | `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. | | `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message | | `reply_markup` | `#!python3 Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` | Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | diff --git a/docs/api/methods/send_poll.md b/docs/api/methods/send_poll.md index 175dc2eb..1765afce 100644 --- a/docs/api/methods/send_poll.md +++ b/docs/api/methods/send_poll.md @@ -16,6 +16,10 @@ Use this method to send a native poll. On success, the sent Message is returned. | `type` | `#!python3 Optional[str]` | Optional. Poll type, 'quiz' or 'regular', defaults to 'regular' | | `allows_multiple_answers` | `#!python3 Optional[bool]` | Optional. True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False | | `correct_option_id` | `#!python3 Optional[int]` | Optional. 0-based identifier of the correct answer option, required for polls in quiz mode | +| `explanation` | `#!python3 Optional[str]` | Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing | +| `explanation_parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the explanation. See formatting options for more details. | +| `open_period` | `#!python3 Optional[int]` | Optional. Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. | +| `close_date` | `#!python3 Optional[Union[datetime.datetime, datetime.timedelta, int]]` | Optional. Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period. | | `is_closed` | `#!python3 Optional[bool]` | Optional. Pass True, if the poll needs to be immediately closed. This can be useful for poll preview. | | `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. | | `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message | diff --git a/docs/api/methods/send_video.md b/docs/api/methods/send_video.md index 87077d72..dd565480 100644 --- a/docs/api/methods/send_video.md +++ b/docs/api/methods/send_video.md @@ -16,7 +16,7 @@ Use this method to send video files, Telegram clients support mp4 videos (other | `height` | `#!python3 Optional[int]` | Optional. Video height | | `thumb` | `#!python3 Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . | | `caption` | `#!python3 Optional[str]` | Optional. Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing | -| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the video caption. See formatting options for more details. | | `supports_streaming` | `#!python3 Optional[bool]` | Optional. Pass True, if the uploaded video is suitable for streaming | | `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. | | `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message | diff --git a/docs/api/methods/send_voice.md b/docs/api/methods/send_voice.md index becd34f7..40bdd7e4 100644 --- a/docs/api/methods/send_voice.md +++ b/docs/api/methods/send_voice.md @@ -12,7 +12,7 @@ Use this method to send audio files, if you want Telegram clients to display the | `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) | | `voice` | `#!python3 Union[InputFile, str]` | Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. | | `caption` | `#!python3 Optional[str]` | Optional. Voice message caption, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. | | `duration` | `#!python3 Optional[int]` | Optional. Duration of the voice message in seconds | | `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. | | `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message | diff --git a/docs/api/methods/upload_sticker_file.md b/docs/api/methods/upload_sticker_file.md index 8777df2e..02133c4e 100644 --- a/docs/api/methods/upload_sticker_file.md +++ b/docs/api/methods/upload_sticker_file.md @@ -10,7 +10,7 @@ Use this method to upload a .PNG file with a sticker for later use in createNewS | Name | Type | Description | | - | - | - | | `user_id` | `#!python3 int` | User identifier of sticker file owner | -| `png_sticker` | `#!python3 InputFile` | Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. | +| `png_sticker` | `#!python3 InputFile` | PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. | diff --git a/docs/api/types/chat_member.md b/docs/api/types/chat_member.md index d475c33d..0d374b01 100644 --- a/docs/api/types/chat_member.md +++ b/docs/api/types/chat_member.md @@ -12,13 +12,13 @@ This object contains information about one member of a chat. | `user` | `#!python User` | Information about the user | | `status` | `#!python str` | The member's status in the chat. Can be 'creator', 'administrator', 'member', 'restricted', 'left' or 'kicked' | | `custom_title` | `#!python Optional[str]` | Optional. Owner and administrators only. Custom title for this user | -| `until_date` | `#!python Optional[Union[int, datetime.datetime, datetime.timedelta]]` | Optional. Restricted and kicked only. Date when restrictions will be lifted for this user; unix time | +| `until_date` | `#!python Optional[Union[datetime.datetime, datetime.timedelta, int]]` | Optional. Restricted and kicked only. Date when restrictions will be lifted for this user; unix time | | `can_be_edited` | `#!python Optional[bool]` | Optional. Administrators only. True, if the bot is allowed to edit administrator privileges of that user | | `can_post_messages` | `#!python Optional[bool]` | Optional. Administrators only. True, if the administrator can post in the channel; channels only | | `can_edit_messages` | `#!python Optional[bool]` | Optional. Administrators only. True, if the administrator can edit messages of other users and can pin messages; channels only | | `can_delete_messages` | `#!python Optional[bool]` | Optional. Administrators only. True, if the administrator can delete messages of other users | | `can_restrict_members` | `#!python Optional[bool]` | Optional. Administrators only. True, if the administrator can restrict, ban or unban chat members | -| `can_promote_members` | `#!python Optional[bool]` | Optional. Administrators only. True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) | +| `can_promote_members` | `#!python Optional[bool]` | Optional. Administrators only. True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) | | `can_change_info` | `#!python Optional[bool]` | Optional. Administrators and restricted only. True, if the user is allowed to change the chat title, photo and other settings | | `can_invite_users` | `#!python Optional[bool]` | Optional. Administrators and restricted only. True, if the user is allowed to invite new users to the chat | | `can_pin_messages` | `#!python Optional[bool]` | Optional. Administrators and restricted only. True, if the user is allowed to pin messages; groups and supergroups only | diff --git a/docs/api/types/dice.md b/docs/api/types/dice.md index 1eb938f8..87bd5165 100644 --- a/docs/api/types/dice.md +++ b/docs/api/types/dice.md @@ -2,14 +2,15 @@ ## Description -This object represents a dice with random value from 1 to 6. (Yes, we're aware of the 'proper' singular of die. But it's awkward, and we decided to help it change. One dice at a time!) +This object represents a dice with a random value from 1 to 6 for currently supported base emoji. (Yes, we're aware of the 'proper' singular of die. But it's awkward, and we decided to help it change. One dice at a time!) ## Attributes | Name | Type | Description | | - | - | - | -| `value` | `#!python int` | Value of the dice, 1-6 | +| `emoji` | `#!python str` | Emoji on which the dice throw animation is based | +| `value` | `#!python int` | Value of the dice, 1-6 for currently supported base emoji | diff --git a/docs/api/types/inline_keyboard_button.md b/docs/api/types/inline_keyboard_button.md index 173ddb4e..9736392e 100644 --- a/docs/api/types/inline_keyboard_button.md +++ b/docs/api/types/inline_keyboard_button.md @@ -14,7 +14,7 @@ This object represents one button of an inline keyboard. You must use exactly on | `login_url` | `#!python Optional[LoginUrl]` | Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. | | `callback_data` | `#!python Optional[str]` | Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes | | `switch_inline_query` | `#!python Optional[str]` | Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot‘s username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted. | -| `switch_inline_query_current_chat` | `#!python Optional[str]` | Optional. If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot’s username will be inserted. | +| `switch_inline_query_current_chat` | `#!python Optional[str]` | Optional. If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat’s input field. Can be empty, in which case only the bot's username will be inserted. | | `callback_game` | `#!python Optional[CallbackGame]` | Optional. Description of the game that will be launched when the user presses the button. | | `pay` | `#!python Optional[bool]` | Optional. Specify True, to send a Pay button. | diff --git a/docs/api/types/inline_query_result_audio.md b/docs/api/types/inline_query_result_audio.md index 4a4257ea..3a2f0c35 100644 --- a/docs/api/types/inline_query_result_audio.md +++ b/docs/api/types/inline_query_result_audio.md @@ -16,7 +16,7 @@ Note: This will only work in Telegram versions released after 9 April, 2016. Old | `audio_url` | `#!python str` | A valid URL for the audio file | | `title` | `#!python str` | Title | | `caption` | `#!python Optional[str]` | Optional. Caption, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the audio caption. See formatting options for more details. | | `performer` | `#!python Optional[str]` | Optional. Performer | | `audio_duration` | `#!python Optional[int]` | Optional. Audio duration in seconds | | `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message | diff --git a/docs/api/types/inline_query_result_cached_audio.md b/docs/api/types/inline_query_result_cached_audio.md index 2fdbeb0e..76528051 100644 --- a/docs/api/types/inline_query_result_cached_audio.md +++ b/docs/api/types/inline_query_result_cached_audio.md @@ -15,7 +15,7 @@ Note: This will only work in Telegram versions released after 9 April, 2016. Old | `id` | `#!python str` | Unique identifier for this result, 1-64 bytes | | `audio_file_id` | `#!python str` | A valid file identifier for the audio file | | `caption` | `#!python Optional[str]` | Optional. Caption, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the audio caption. See formatting options for more details. | | `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message | | `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the audio | diff --git a/docs/api/types/inline_query_result_cached_document.md b/docs/api/types/inline_query_result_cached_document.md index 0fc60042..f699806c 100644 --- a/docs/api/types/inline_query_result_cached_document.md +++ b/docs/api/types/inline_query_result_cached_document.md @@ -17,7 +17,7 @@ Note: This will only work in Telegram versions released after 9 April, 2016. Old | `document_file_id` | `#!python str` | A valid file identifier for the file | | `description` | `#!python Optional[str]` | Optional. Short description of the result | | `caption` | `#!python Optional[str]` | Optional. Caption of the document to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the document caption. See formatting options for more details. | | `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message | | `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the file | diff --git a/docs/api/types/inline_query_result_cached_gif.md b/docs/api/types/inline_query_result_cached_gif.md index 575582af..bbf26c58 100644 --- a/docs/api/types/inline_query_result_cached_gif.md +++ b/docs/api/types/inline_query_result_cached_gif.md @@ -14,7 +14,7 @@ Represents a link to an animated GIF file stored on the Telegram servers. By def | `gif_file_id` | `#!python str` | A valid file identifier for the GIF file | | `title` | `#!python Optional[str]` | Optional. Title for the result | | `caption` | `#!python Optional[str]` | Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the caption. See formatting options for more details. | | `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message | | `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the GIF animation | diff --git a/docs/api/types/inline_query_result_cached_mpeg4_gif.md b/docs/api/types/inline_query_result_cached_mpeg4_gif.md index 1efd7acf..557f628d 100644 --- a/docs/api/types/inline_query_result_cached_mpeg4_gif.md +++ b/docs/api/types/inline_query_result_cached_mpeg4_gif.md @@ -14,7 +14,7 @@ Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) st | `mpeg4_file_id` | `#!python str` | A valid file identifier for the MP4 file | | `title` | `#!python Optional[str]` | Optional. Title for the result | | `caption` | `#!python Optional[str]` | Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the caption. See formatting options for more details. | | `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message | | `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the video animation | diff --git a/docs/api/types/inline_query_result_cached_photo.md b/docs/api/types/inline_query_result_cached_photo.md index e06c6a73..d85e05ae 100644 --- a/docs/api/types/inline_query_result_cached_photo.md +++ b/docs/api/types/inline_query_result_cached_photo.md @@ -15,7 +15,7 @@ Represents a link to a photo stored on the Telegram servers. By default, this ph | `title` | `#!python Optional[str]` | Optional. Title for the result | | `description` | `#!python Optional[str]` | Optional. Short description of the result | | `caption` | `#!python Optional[str]` | Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the photo caption. See formatting options for more details. | | `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message | | `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the photo | diff --git a/docs/api/types/inline_query_result_cached_video.md b/docs/api/types/inline_query_result_cached_video.md index c0620726..6d32f7e6 100644 --- a/docs/api/types/inline_query_result_cached_video.md +++ b/docs/api/types/inline_query_result_cached_video.md @@ -15,7 +15,7 @@ Represents a link to a video file stored on the Telegram servers. By default, th | `title` | `#!python str` | Title for the result | | `description` | `#!python Optional[str]` | Optional. Short description of the result | | `caption` | `#!python Optional[str]` | Optional. Caption of the video to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the video caption. See formatting options for more details. | | `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message | | `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the video | diff --git a/docs/api/types/inline_query_result_cached_voice.md b/docs/api/types/inline_query_result_cached_voice.md index 28d00e6b..10c9a044 100644 --- a/docs/api/types/inline_query_result_cached_voice.md +++ b/docs/api/types/inline_query_result_cached_voice.md @@ -16,7 +16,7 @@ Note: This will only work in Telegram versions released after 9 April, 2016. Old | `voice_file_id` | `#!python str` | A valid file identifier for the voice message | | `title` | `#!python str` | Voice message title | | `caption` | `#!python Optional[str]` | Optional. Caption, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. | | `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message | | `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the voice message | diff --git a/docs/api/types/inline_query_result_document.md b/docs/api/types/inline_query_result_document.md index 9ebbf1a7..1988fbea 100644 --- a/docs/api/types/inline_query_result_document.md +++ b/docs/api/types/inline_query_result_document.md @@ -17,7 +17,7 @@ Note: This will only work in Telegram versions released after 9 April, 2016. Old | `document_url` | `#!python str` | A valid URL for the file | | `mime_type` | `#!python str` | Mime type of the content of the file, either 'application/pdf' or 'application/zip' | | `caption` | `#!python Optional[str]` | Optional. Caption of the document to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the document caption. See formatting options for more details. | | `description` | `#!python Optional[str]` | Optional. Short description of the result | | `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message | | `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the file | diff --git a/docs/api/types/inline_query_result_gif.md b/docs/api/types/inline_query_result_gif.md index 59a3a6e3..268c7a1a 100644 --- a/docs/api/types/inline_query_result_gif.md +++ b/docs/api/types/inline_query_result_gif.md @@ -18,7 +18,7 @@ Represents a link to an animated GIF file. By default, this animated GIF file wi | `gif_duration` | `#!python Optional[int]` | Optional. Duration of the GIF | | `title` | `#!python Optional[str]` | Optional. Title for the result | | `caption` | `#!python Optional[str]` | Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the caption. See formatting options for more details. | | `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message | | `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the GIF animation | diff --git a/docs/api/types/inline_query_result_mpeg4_gif.md b/docs/api/types/inline_query_result_mpeg4_gif.md index 3b03d8ef..708e6b1c 100644 --- a/docs/api/types/inline_query_result_mpeg4_gif.md +++ b/docs/api/types/inline_query_result_mpeg4_gif.md @@ -18,7 +18,7 @@ Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). B | `mpeg4_duration` | `#!python Optional[int]` | Optional. Video duration | | `title` | `#!python Optional[str]` | Optional. Title for the result | | `caption` | `#!python Optional[str]` | Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the caption. See formatting options for more details. | | `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message | | `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the video animation | diff --git a/docs/api/types/inline_query_result_photo.md b/docs/api/types/inline_query_result_photo.md index 3c13c787..4361c557 100644 --- a/docs/api/types/inline_query_result_photo.md +++ b/docs/api/types/inline_query_result_photo.md @@ -18,7 +18,7 @@ Represents a link to a photo. By default, this photo will be sent by the user wi | `title` | `#!python Optional[str]` | Optional. Title for the result | | `description` | `#!python Optional[str]` | Optional. Short description of the result | | `caption` | `#!python Optional[str]` | Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the photo caption. See formatting options for more details. | | `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message | | `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the photo | diff --git a/docs/api/types/inline_query_result_video.md b/docs/api/types/inline_query_result_video.md index 3a503511..6e2fe54e 100644 --- a/docs/api/types/inline_query_result_video.md +++ b/docs/api/types/inline_query_result_video.md @@ -18,7 +18,7 @@ If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), | `thumb_url` | `#!python str` | URL of the thumbnail (jpeg only) for the video | | `title` | `#!python str` | Title for the result | | `caption` | `#!python Optional[str]` | Optional. Caption of the video to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the video caption. See formatting options for more details. | | `video_width` | `#!python Optional[int]` | Optional. Video width | | `video_height` | `#!python Optional[int]` | Optional. Video height | | `video_duration` | `#!python Optional[int]` | Optional. Video duration in seconds | diff --git a/docs/api/types/inline_query_result_voice.md b/docs/api/types/inline_query_result_voice.md index c3907b7b..f5621353 100644 --- a/docs/api/types/inline_query_result_voice.md +++ b/docs/api/types/inline_query_result_voice.md @@ -16,7 +16,7 @@ Note: This will only work in Telegram versions released after 9 April, 2016. Old | `voice_url` | `#!python str` | A valid URL for the voice recording | | `title` | `#!python str` | Recording title | | `caption` | `#!python Optional[str]` | Optional. Caption, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. | | `voice_duration` | `#!python Optional[int]` | Optional. Recording duration in seconds | | `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message | | `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the voice recording | diff --git a/docs/api/types/input_media_animation.md b/docs/api/types/input_media_animation.md index be9ebf4f..c784d6a4 100644 --- a/docs/api/types/input_media_animation.md +++ b/docs/api/types/input_media_animation.md @@ -13,7 +13,7 @@ Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be | `media` | `#!python Union[str, InputFile]` | File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. | | `thumb` | `#!python Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . | | `caption` | `#!python Optional[str]` | Optional. Caption of the animation to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the animation caption. See formatting options for more details. | | `width` | `#!python Optional[int]` | Optional. Animation width | | `height` | `#!python Optional[int]` | Optional. Animation height | | `duration` | `#!python Optional[int]` | Optional. Animation duration | diff --git a/docs/api/types/input_media_audio.md b/docs/api/types/input_media_audio.md index 45e699f5..3f672da9 100644 --- a/docs/api/types/input_media_audio.md +++ b/docs/api/types/input_media_audio.md @@ -13,7 +13,7 @@ Represents an audio file to be treated as music to be sent. | `media` | `#!python Union[str, InputFile]` | File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. | | `thumb` | `#!python Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . | | `caption` | `#!python Optional[str]` | Optional. Caption of the audio to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the audio caption. See formatting options for more details. | | `duration` | `#!python Optional[int]` | Optional. Duration of the audio in seconds | | `performer` | `#!python Optional[str]` | Optional. Performer of the audio | | `title` | `#!python Optional[str]` | Optional. Title of the audio | diff --git a/docs/api/types/input_media_document.md b/docs/api/types/input_media_document.md index 62a9d39e..61946b34 100644 --- a/docs/api/types/input_media_document.md +++ b/docs/api/types/input_media_document.md @@ -13,7 +13,7 @@ Represents a general file to be sent. | `media` | `#!python Union[str, InputFile]` | File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. | | `thumb` | `#!python Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . | | `caption` | `#!python Optional[str]` | Optional. Caption of the document to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the document caption. See formatting options for more details. | diff --git a/docs/api/types/input_media_photo.md b/docs/api/types/input_media_photo.md index 9d75feff..c995e70d 100644 --- a/docs/api/types/input_media_photo.md +++ b/docs/api/types/input_media_photo.md @@ -12,7 +12,7 @@ Represents a photo to be sent. | `type` | `#!python str` | Type of the result, must be photo | | `media` | `#!python Union[str, InputFile]` | File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. | | `caption` | `#!python Optional[str]` | Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the photo caption. See formatting options for more details. | diff --git a/docs/api/types/input_media_video.md b/docs/api/types/input_media_video.md index 3779cd1c..d803fdfb 100644 --- a/docs/api/types/input_media_video.md +++ b/docs/api/types/input_media_video.md @@ -13,7 +13,7 @@ Represents a video to be sent. | `media` | `#!python Union[str, InputFile]` | File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://' to upload a new one using multipart/form-data under name. | | `thumb` | `#!python Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://' if the thumbnail was uploaded using multipart/form-data under . | | `caption` | `#!python Optional[str]` | Optional. Caption of the video to be sent, 0-1024 characters after entities parsing | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the video caption. See formatting options for more details. | | `width` | `#!python Optional[int]` | Optional. Video width | | `height` | `#!python Optional[int]` | Optional. Video height | | `duration` | `#!python Optional[int]` | Optional. Video duration | diff --git a/docs/api/types/input_text_message_content.md b/docs/api/types/input_text_message_content.md index 14562070..2ed15f6d 100644 --- a/docs/api/types/input_text_message_content.md +++ b/docs/api/types/input_text_message_content.md @@ -10,7 +10,7 @@ Represents the content of a text message to be sent as the result of an inline q | Name | Type | Description | | - | - | - | | `message_text` | `#!python str` | Text of the message to be sent, 1-4096 characters | -| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. | +| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the message text. See formatting options for more details. | | `disable_web_page_preview` | `#!python Optional[bool]` | Optional. Disables link previews for links in the sent message | diff --git a/docs/api/types/poll.md b/docs/api/types/poll.md index 421a816d..81650bee 100644 --- a/docs/api/types/poll.md +++ b/docs/api/types/poll.md @@ -18,6 +18,10 @@ This object contains information about a poll. | `type` | `#!python str` | Poll type, currently can be 'regular' or 'quiz' | | `allows_multiple_answers` | `#!python bool` | True, if the poll allows multiple answers | | `correct_option_id` | `#!python Optional[int]` | Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. | +| `explanation` | `#!python Optional[str]` | Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters | +| `explanation_entities` | `#!python Optional[List[MessageEntity]]` | Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation | +| `open_period` | `#!python Optional[int]` | Optional. Amount of time in seconds the poll will be active after creation | +| `close_date` | `#!python Optional[Union[datetime.datetime, datetime.timedelta, int]]` | Optional. Point in time (Unix timestamp) when the poll will be automatically closed | @@ -30,4 +34,5 @@ This object contains information about a poll. ## Related pages: - [Official documentation](https://core.telegram.org/bots/api#poll) +- [aiogram.types.MessageEntity](../types/message_entity.md) - [aiogram.types.PollOption](../types/poll_option.md) diff --git a/pyproject.toml b/pyproject.toml index 7cecf764..9aefad90 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "aiogram" -version = "3.0.0-alpha.3" +version = "3.0.0-alpha.4" description = "Modern and fully asynchronous framework for Telegram Bot API" authors = ["Alex Root Junior "] license = "MIT" @@ -30,6 +30,7 @@ classifiers = [ "Framework :: AsyncIO", "Typing :: Typed", ] +build = "build.py" [tool.poetry.dependencies] python = "^3.7" diff --git a/tests/test_api/test_types/test_message.py b/tests/test_api/test_types/test_message.py index 1254bd31..f386e191 100644 --- a/tests/test_api/test_types/test_message.py +++ b/tests/test_api/test_types/test_message.py @@ -398,7 +398,7 @@ class TestMessage: message_id=42, date=datetime.datetime.now(), chat=Chat(id=42, type="private"), - dice=Dice(value=6), + dice=Dice(value=6, emoji="X"), from_user=User(id=42, is_bot=False, first_name="Test"), ), ContentType.DICE, diff --git a/tests/test_api/test_types/test_reply_keyboard_remove.py b/tests/test_api/test_types/test_reply_keyboard_remove.py new file mode 100644 index 00000000..bfc669bd --- /dev/null +++ b/tests/test_api/test_types/test_reply_keyboard_remove.py @@ -0,0 +1,20 @@ +import pytest +from aiogram.api.types import ReplyKeyboardRemove + + +class TestReplyKeyboardRemove: + """ + This test is needed to prevent to override value by code generator + """ + + def test_remove_keyboard_default_is_true(self): + assert ( + ReplyKeyboardRemove.__fields__["remove_keyboard"].default is True + ), "Remove keyboard has incorrect default value!" + + @pytest.mark.parametrize( + "kwargs,expected", + [[{}, True], [{"remove_keyboard": True}, True], [{"remove_keyboard": False}, False]], + ) + def test_remove_keyboard_values(self, kwargs, expected): + assert ReplyKeyboardRemove(**kwargs).remove_keyboard is expected