From ffb0cdf88f185cb92a232f8b9e9a95d70007484d Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 11 Jan 2020 19:47:39 +0200 Subject: [PATCH] Telegram Bot API 4.5 --- README.md | 2 +- aiogram/__init__.py | 4 +-- aiogram/api/client/bot.py | 22 +++++++++++++++ aiogram/api/methods/__init__.py | 2 ++ .../set_chat_administrator_custom_title.py | 27 +++++++++++++++++++ aiogram/api/types/animation.py | 5 +++- aiogram/api/types/audio.py | 5 +++- aiogram/api/types/chat.py | 5 +++- aiogram/api/types/chat_member.py | 2 ++ aiogram/api/types/chat_photo.py | 6 +++++ aiogram/api/types/document.py | 5 +++- aiogram/api/types/file.py | 5 +++- aiogram/api/types/message_entity.py | 10 ++++--- aiogram/api/types/passport_file.py | 5 +++- aiogram/api/types/photo_size.py | 5 +++- aiogram/api/types/shipping_query.py | 2 +- aiogram/api/types/sticker.py | 7 +++-- aiogram/api/types/video.py | 5 +++- aiogram/api/types/video_note.py | 5 +++- aiogram/api/types/voice.py | 5 +++- docs/api/methods/add_sticker_to_set.md | 2 +- docs/api/methods/create_new_sticker_set.md | 2 +- docs/api/types/animation.md | 3 ++- docs/api/types/audio.md | 3 ++- docs/api/types/callback_query.md | 2 +- docs/api/types/chat.md | 1 + docs/api/types/chat_member.md | 1 + docs/api/types/chat_photo.md | 2 ++ docs/api/types/document.md | 3 ++- docs/api/types/file.md | 3 ++- docs/api/types/message_entity.md | 2 +- docs/api/types/passport_file.md | 3 ++- docs/api/types/photo_size.md | 3 ++- docs/api/types/sticker.md | 3 ++- docs/api/types/video.md | 3 ++- docs/api/types/video_note.md | 3 ++- docs/api/types/voice.md | 3 ++- docs/index.md | 4 +-- pyproject.toml | 3 ++- 39 files changed, 146 insertions(+), 37 deletions(-) create mode 100644 aiogram/api/methods/set_chat_administrator_custom_title.py diff --git a/README.md b/README.md index 8766e027..b1ca77ae 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![MIT License](https://img.shields.io/pypi/l/aiogram.svg?style=flat-square)](https://opensource.org/licenses/MIT) [![Supported python versions](https://img.shields.io/pypi/pyversions/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) -[![Telegram Bot API](https://img.shields.io/badge/Telegram%20Bot%20API-4.4-blue.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api) +[![Telegram Bot API](https://img.shields.io/badge/Telegram%20Bot%20API-4.5-blue.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api) [![PyPi Package Version](https://img.shields.io/pypi/v/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) [![PyPi status](https://img.shields.io/pypi/status/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) [![Downloads](https://img.shields.io/pypi/dm/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) diff --git a/aiogram/__init__.py b/aiogram/__init__.py index 9af0a993..8a568996 100644 --- a/aiogram/__init__.py +++ b/aiogram/__init__.py @@ -26,5 +26,5 @@ __all__ = ( "handler", ) -__version__ = "3.0.0a0" -__api_version__ = "4.4" +__version__ = "3.0.0a1" +__api_version__ = "4.5" diff --git a/aiogram/api/client/bot.py b/aiogram/api/client/bot.py index 06d1af05..203c1b16 100644 --- a/aiogram/api/client/bot.py +++ b/aiogram/api/client/bot.py @@ -55,6 +55,7 @@ from ..methods import ( SendVideo, SendVideoNote, SendVoice, + SetChatAdministratorCustomTitle, SetChatDescription, SetChatPermissions, SetChatPhoto, @@ -1204,6 +1205,27 @@ class Bot(BaseBot): ) return await self.emit(call) + async def set_chat_administrator_custom_title( + self, chat_id: Union[int, str], user_id: int, custom_title: str, + ) -> bool: + """ + Use this method to set a custom title for an administrator in a supergroup promoted by the + bot. Returns True on success. + + Source: https://core.telegram.org/bots/api#setchatadministratorcustomtitle + + :param chat_id: Unique identifier for the target chat or username of the target supergroup + (in the format @supergroupusername) + :param user_id: Unique identifier of the target user + :param custom_title: New custom title for the administrator; 0-16 characters, emoji are + not allowed + :return: Returns True on success. + """ + call = SetChatAdministratorCustomTitle( + chat_id=chat_id, user_id=user_id, custom_title=custom_title, + ) + return await self.emit(call) + async def set_chat_permissions( self, chat_id: Union[int, str], permissions: ChatPermissions ) -> bool: diff --git a/aiogram/api/methods/__init__.py b/aiogram/api/methods/__init__.py index 39095df7..b1a1344e 100644 --- a/aiogram/api/methods/__init__.py +++ b/aiogram/api/methods/__init__.py @@ -50,6 +50,7 @@ from .send_venue import SendVenue from .send_video import SendVideo from .send_video_note import SendVideoNote from .send_voice import SendVoice +from .set_chat_administrator_custom_title import SetChatAdministratorCustomTitle from .set_chat_description import SetChatDescription from .set_chat_permissions import SetChatPermissions from .set_chat_photo import SetChatPhoto @@ -97,6 +98,7 @@ __all__ = ( "UnbanChatMember", "RestrictChatMember", "PromoteChatMember", + "SetChatAdministratorCustomTitle", "SetChatPermissions", "ExportChatInviteLink", "SetChatPhoto", diff --git a/aiogram/api/methods/set_chat_administrator_custom_title.py b/aiogram/api/methods/set_chat_administrator_custom_title.py new file mode 100644 index 00000000..a153212a --- /dev/null +++ b/aiogram/api/methods/set_chat_administrator_custom_title.py @@ -0,0 +1,27 @@ +from typing import Any, Dict, Union + +from .base import Request, TelegramMethod + + +class SetChatAdministratorCustomTitle(TelegramMethod[bool]): + """ + Use this method to set a custom title for an administrator in a supergroup promoted by the + bot. Returns True on success. + + Source: https://core.telegram.org/bots/api#setchatadministratorcustomtitle + """ + + __returning__ = bool + + chat_id: Union[int, str] + """Unique identifier for the target chat or username of the target supergroup (in the format + @supergroupusername)""" + user_id: int + """Unique identifier of the target user""" + custom_title: str + """New custom title for the administrator; 0-16 characters, emoji are not allowed""" + + def build_request(self) -> Request: + data: Dict[str, Any] = self.dict() + + return Request(method="setChatAdministratorCustomTitle", data=data) diff --git a/aiogram/api/types/animation.py b/aiogram/api/types/animation.py index 9f9c8db4..ffa3141b 100644 --- a/aiogram/api/types/animation.py +++ b/aiogram/api/types/animation.py @@ -16,7 +16,10 @@ class Animation(TelegramObject): """ file_id: str - """Identifier for this file""" + """Identifier for this file, which can be used to download or reuse the file""" + file_unique_id: str + """Unique identifier for this file, which is supposed to be the same over time and for + different bots. Can't be used to download or reuse the file.""" width: int """Video width as defined by sender""" height: int diff --git a/aiogram/api/types/audio.py b/aiogram/api/types/audio.py index ce690e9b..4b496d06 100644 --- a/aiogram/api/types/audio.py +++ b/aiogram/api/types/audio.py @@ -16,7 +16,10 @@ class Audio(TelegramObject): """ file_id: str - """Identifier for this file""" + """Identifier for this file, which can be used to download or reuse the file""" + file_unique_id: str + """Unique identifier for this file, which is supposed to be the same over time and for + different bots. Can't be used to download or reuse the file.""" duration: int """Duration of the audio in seconds as defined by sender""" performer: Optional[str] = None diff --git a/aiogram/api/types/chat.py b/aiogram/api/types/chat.py index 23b79f31..f56cc9df 100644 --- a/aiogram/api/types/chat.py +++ b/aiogram/api/types/chat.py @@ -5,8 +5,8 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject if TYPE_CHECKING: # pragma: no cover - from .chat_photo import ChatPhoto from .message import Message + from .chat_photo import ChatPhoto from .chat_permissions import ChatPermissions @@ -44,6 +44,9 @@ class Chat(TelegramObject): """Pinned message, for groups, supergroups and channels. Returned only in getChat.""" permissions: Optional[ChatPermissions] = None """Default chat member permissions, for groups and supergroups. Returned only in getChat.""" + slow_mode_delay: Optional[int] = None + """For supergroups, the minimum allowed delay between consecutive messages sent by each + unpriviledged user. Returned only in getChat.""" sticker_set_name: Optional[str] = None """For supergroups, name of group sticker set. Returned only in getChat.""" can_set_sticker_set: Optional[bool] = None diff --git a/aiogram/api/types/chat_member.py b/aiogram/api/types/chat_member.py index b7662e5a..2708b073 100644 --- a/aiogram/api/types/chat_member.py +++ b/aiogram/api/types/chat_member.py @@ -21,6 +21,8 @@ class ChatMember(TelegramObject): status: str """The member's status in the chat. Can be 'creator', 'administrator', 'member', 'restricted', '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 """Restricted and kicked only. Date when restrictions will be lifted for this user; unix time""" can_be_edited: Optional[bool] = None diff --git a/aiogram/api/types/chat_photo.py b/aiogram/api/types/chat_photo.py index 87429764..9fd53d32 100644 --- a/aiogram/api/types/chat_photo.py +++ b/aiogram/api/types/chat_photo.py @@ -13,6 +13,12 @@ class ChatPhoto(TelegramObject): small_file_id: str """File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.""" + small_file_unique_id: str + """Unique file identifier of small (160x160) chat photo, which is supposed to be the same over + time and for different bots. Can't be used to download or reuse the file.""" big_file_id: str """File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.""" + big_file_unique_id: str + """Unique file identifier of big (640x640) chat photo, which is supposed to be the same over + time and for different bots. Can't be used to download or reuse the file.""" diff --git a/aiogram/api/types/document.py b/aiogram/api/types/document.py index 39ed3552..7939cd9a 100644 --- a/aiogram/api/types/document.py +++ b/aiogram/api/types/document.py @@ -16,7 +16,10 @@ class Document(TelegramObject): """ file_id: str - """Identifier for this file""" + """Identifier for this file, which can be used to download or reuse the file""" + file_unique_id: str + """Unique identifier for this file, which is supposed to be the same over time and for + different bots. Can't be used to download or reuse the file.""" thumb: Optional[PhotoSize] = None """Document thumbnail as defined by sender""" file_name: Optional[str] = None diff --git a/aiogram/api/types/file.py b/aiogram/api/types/file.py index 25551a8c..f914fe00 100644 --- a/aiogram/api/types/file.py +++ b/aiogram/api/types/file.py @@ -17,7 +17,10 @@ class File(TelegramObject): """ file_id: str - """Identifier for this file""" + """Identifier for this file, which can be used to download or reuse the file""" + file_unique_id: str + """Unique identifier for this file, which is supposed to be the same over time and for + different bots. Can't be used to download or reuse the file.""" file_size: Optional[int] = None """File size, if known""" file_path: Optional[str] = None diff --git a/aiogram/api/types/message_entity.py b/aiogram/api/types/message_entity.py index b8166b3f..a08e4306 100644 --- a/aiogram/api/types/message_entity.py +++ b/aiogram/api/types/message_entity.py @@ -17,10 +17,12 @@ class MessageEntity(TelegramObject): """ type: str - """Type of the entity. Can be mention (@username), hashtag, cashtag, bot_command, url, email, - phone_number, bold (bold text), italic (italic text), code (monowidth string), pre - (monowidth block), text_link (for clickable text URLs), text_mention (for users without - usernames)""" + """Type of the entity. Can be 'mention' (@username), 'hashtag' (#hashtag), 'cashtag' ($USD), + 'bot_command' (/start@jobs_bot), 'url' (https://telegram.org), 'email' + (do-not-reply@telegram.org), 'phone_number' (+1-212-555-0123), 'bold' (bold text), 'italic' + (italic text), 'underline' (underlined text), 'strikethrough' (strikethrough text), 'code' + (monowidth string), 'pre' (monowidth block), 'text_link' (for clickable text URLs), + 'text_mention' (for users without usernames)""" offset: int """Offset in UTF-16 code units to the start of the entity""" length: int diff --git a/aiogram/api/types/passport_file.py b/aiogram/api/types/passport_file.py index ed02e7e1..9b7185f2 100644 --- a/aiogram/api/types/passport_file.py +++ b/aiogram/api/types/passport_file.py @@ -12,7 +12,10 @@ class PassportFile(TelegramObject): """ file_id: str - """Identifier for this file""" + """Identifier for this file, which can be used to download or reuse the file""" + file_unique_id: str + """Unique identifier for this file, which is supposed to be the same over time and for + different bots. Can't be used to download or reuse the file.""" file_size: int """File size""" file_date: int diff --git a/aiogram/api/types/photo_size.py b/aiogram/api/types/photo_size.py index e0d18ac9..7aeb89fd 100644 --- a/aiogram/api/types/photo_size.py +++ b/aiogram/api/types/photo_size.py @@ -13,7 +13,10 @@ class PhotoSize(TelegramObject): """ file_id: str - """Identifier for this file""" + """Identifier for this file, which can be used to download or reuse the file""" + file_unique_id: str + """Unique identifier for this file, which is supposed to be the same over time and for + different bots. Can't be used to download or reuse the file.""" width: int """Photo width""" height: int diff --git a/aiogram/api/types/shipping_query.py b/aiogram/api/types/shipping_query.py index 8129e1a4..a219be7c 100644 --- a/aiogram/api/types/shipping_query.py +++ b/aiogram/api/types/shipping_query.py @@ -7,8 +7,8 @@ from pydantic import Field from .base import TelegramObject if TYPE_CHECKING: # pragma: no cover - from .user import User from .shipping_address import ShippingAddress + from .user import User class ShippingQuery(TelegramObject): diff --git a/aiogram/api/types/sticker.py b/aiogram/api/types/sticker.py index 1eb98599..1743de6b 100644 --- a/aiogram/api/types/sticker.py +++ b/aiogram/api/types/sticker.py @@ -5,8 +5,8 @@ from typing import TYPE_CHECKING, Optional from .base import TelegramObject if TYPE_CHECKING: # pragma: no cover - from .photo_size import PhotoSize from .mask_position import MaskPosition + from .photo_size import PhotoSize class Sticker(TelegramObject): @@ -17,7 +17,10 @@ class Sticker(TelegramObject): """ file_id: str - """Identifier for this file""" + """Identifier for this file, which can be used to download or reuse the file""" + file_unique_id: str + """Unique identifier for this file, which is supposed to be the same over time and for + different bots. Can't be used to download or reuse the file.""" width: int """Sticker width""" height: int diff --git a/aiogram/api/types/video.py b/aiogram/api/types/video.py index acd3a303..647333b5 100644 --- a/aiogram/api/types/video.py +++ b/aiogram/api/types/video.py @@ -16,7 +16,10 @@ class Video(TelegramObject): """ file_id: str - """Identifier for this file""" + """Identifier for this file, which can be used to download or reuse the file""" + file_unique_id: str + """Unique identifier for this file, which is supposed to be the same over time and for + different bots. Can't be used to download or reuse the file.""" width: int """Video width as defined by sender""" height: int diff --git a/aiogram/api/types/video_note.py b/aiogram/api/types/video_note.py index 184087ba..b33baa39 100644 --- a/aiogram/api/types/video_note.py +++ b/aiogram/api/types/video_note.py @@ -16,7 +16,10 @@ class VideoNote(TelegramObject): """ file_id: str - """Identifier for this file""" + """Identifier for this file, which can be used to download or reuse the file""" + file_unique_id: str + """Unique identifier for this file, which is supposed to be the same over time and for + different bots. Can't be used to download or reuse the file.""" length: int """Video width and height (diameter of the video message) as defined by sender""" duration: int diff --git a/aiogram/api/types/voice.py b/aiogram/api/types/voice.py index 634571ec..52e5bb71 100644 --- a/aiogram/api/types/voice.py +++ b/aiogram/api/types/voice.py @@ -13,7 +13,10 @@ class Voice(TelegramObject): """ file_id: str - """Identifier for this file""" + """Identifier for this file, which can be used to download or reuse the file""" + file_unique_id: str + """Unique identifier for this file, which is supposed to be the same over time and for + different bots. Can't be used to download or reuse the file.""" duration: int """Duration of the audio in seconds as defined by sender""" mime_type: Optional[str] = None diff --git a/docs/api/methods/add_sticker_to_set.md b/docs/api/methods/add_sticker_to_set.md index f7cdb803..26fd5817 100644 --- a/docs/api/methods/add_sticker_to_set.md +++ b/docs/api/methods/add_sticker_to_set.md @@ -60,5 +60,5 @@ result: bool = await AddStickerToSet(...) ## Related pages: - [Official documentation](https://core.telegram.org/bots/api#addstickertoset) -- [aiogram.types.InputFile](../types/input_file.md) - [aiogram.types.MaskPosition](../types/mask_position.md) +- [aiogram.types.InputFile](../types/input_file.md) diff --git a/docs/api/methods/create_new_sticker_set.md b/docs/api/methods/create_new_sticker_set.md index 3f25c14e..11c43d94 100644 --- a/docs/api/methods/create_new_sticker_set.md +++ b/docs/api/methods/create_new_sticker_set.md @@ -62,5 +62,5 @@ result: bool = await CreateNewStickerSet(...) ## Related pages: - [Official documentation](https://core.telegram.org/bots/api#createnewstickerset) -- [aiogram.types.InputFile](../types/input_file.md) - [aiogram.types.MaskPosition](../types/mask_position.md) +- [aiogram.types.InputFile](../types/input_file.md) diff --git a/docs/api/types/animation.md b/docs/api/types/animation.md index 75f57efd..db527991 100644 --- a/docs/api/types/animation.md +++ b/docs/api/types/animation.md @@ -9,7 +9,8 @@ This object represents an animation file (GIF or H.264/MPEG-4 AVC video without | Name | Type | Description | | - | - | - | -| `file_id` | `#!python str` | Identifier for this file | +| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file | +| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | | `width` | `#!python int` | Video width as defined by sender | | `height` | `#!python int` | Video height as defined by sender | | `duration` | `#!python int` | Duration of the video in seconds as defined by sender | diff --git a/docs/api/types/audio.md b/docs/api/types/audio.md index e56505b8..694f883c 100644 --- a/docs/api/types/audio.md +++ b/docs/api/types/audio.md @@ -9,7 +9,8 @@ This object represents an audio file to be treated as music by the Telegram clie | Name | Type | Description | | - | - | - | -| `file_id` | `#!python str` | Identifier for this file | +| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file | +| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | | `duration` | `#!python int` | Duration of the audio in seconds as defined by sender | | `performer` | `#!python Optional[str]` | Optional. Performer of the audio as defined by sender or by audio tags | | `title` | `#!python Optional[str]` | Optional. Title of the audio as defined by sender or by audio tags | diff --git a/docs/api/types/callback_query.md b/docs/api/types/callback_query.md index 5fc09499..1a7c5312 100644 --- a/docs/api/types/callback_query.md +++ b/docs/api/types/callback_query.md @@ -30,5 +30,5 @@ NOTE: After the user presses a callback button, Telegram clients will display a ## Related pages: - [Official documentation](https://core.telegram.org/bots/api#callbackquery) -- [aiogram.types.User](../types/user.md) - [aiogram.types.Message](../types/message.md) +- [aiogram.types.User](../types/user.md) diff --git a/docs/api/types/chat.md b/docs/api/types/chat.md index b2aacbdf..c269927c 100644 --- a/docs/api/types/chat.md +++ b/docs/api/types/chat.md @@ -20,6 +20,7 @@ This object represents a chat. | `invite_link` | `#!python Optional[str]` | Optional. Chat invite link, for groups, supergroups and channel chats. Each administrator in a chat generates their own invite links, so the bot must first generate the link using exportChatInviteLink. Returned only in getChat. | | `pinned_message` | `#!python Optional[Message]` | Optional. Pinned message, for groups, supergroups and channels. Returned only in getChat. | | `permissions` | `#!python Optional[ChatPermissions]` | Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat. | +| `slow_mode_delay` | `#!python Optional[int]` | Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user. Returned only in getChat. | | `sticker_set_name` | `#!python Optional[str]` | Optional. For supergroups, name of group sticker set. Returned only in getChat. | | `can_set_sticker_set` | `#!python Optional[bool]` | Optional. True, if the bot can change the group sticker set. Returned only in getChat. | diff --git a/docs/api/types/chat_member.md b/docs/api/types/chat_member.md index 08b4f9a4..d475c33d 100644 --- a/docs/api/types/chat_member.md +++ b/docs/api/types/chat_member.md @@ -11,6 +11,7 @@ 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 | | `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 | diff --git a/docs/api/types/chat_photo.md b/docs/api/types/chat_photo.md index 954ceb0c..2098d4da 100644 --- a/docs/api/types/chat_photo.md +++ b/docs/api/types/chat_photo.md @@ -10,7 +10,9 @@ This object represents a chat photo. | Name | Type | Description | | - | - | - | | `small_file_id` | `#!python str` | File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. | +| `small_file_unique_id` | `#!python str` | Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | | `big_file_id` | `#!python str` | File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. | +| `big_file_unique_id` | `#!python str` | Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | diff --git a/docs/api/types/document.md b/docs/api/types/document.md index 316f4d19..bed757d9 100644 --- a/docs/api/types/document.md +++ b/docs/api/types/document.md @@ -9,7 +9,8 @@ This object represents a general file (as opposed to photos, voice messages and | Name | Type | Description | | - | - | - | -| `file_id` | `#!python str` | Identifier for this file | +| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file | +| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | | `thumb` | `#!python Optional[PhotoSize]` | Optional. Document thumbnail as defined by sender | | `file_name` | `#!python Optional[str]` | Optional. Original filename as defined by sender | | `mime_type` | `#!python Optional[str]` | Optional. MIME type of the file as defined by sender | diff --git a/docs/api/types/file.md b/docs/api/types/file.md index 32fb6cb3..7f914b41 100644 --- a/docs/api/types/file.md +++ b/docs/api/types/file.md @@ -11,7 +11,8 @@ Maximum file size to download is 20 MB | Name | Type | Description | | - | - | - | -| `file_id` | `#!python str` | Identifier for this file | +| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file | +| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | | `file_size` | `#!python Optional[int]` | Optional. File size, if known | | `file_path` | `#!python Optional[str]` | Optional. File path. Use https://api.telegram.org/file/bot/ to get the file. | diff --git a/docs/api/types/message_entity.md b/docs/api/types/message_entity.md index 48282a71..702d7701 100644 --- a/docs/api/types/message_entity.md +++ b/docs/api/types/message_entity.md @@ -9,7 +9,7 @@ This object represents one special entity in a text message. For example, hashta | Name | Type | Description | | - | - | - | -| `type` | `#!python str` | Type of the entity. Can be mention (@username), hashtag, cashtag, bot_command, url, email, phone_number, bold (bold text), italic (italic text), code (monowidth string), pre (monowidth block), text_link (for clickable text URLs), text_mention (for users without usernames) | +| `type` | `#!python str` | Type of the entity. Can be 'mention' (@username), 'hashtag' (#hashtag), 'cashtag' ($USD), 'bot_command' (/start@jobs_bot), 'url' (https://telegram.org), 'email' (do-not-reply@telegram.org), 'phone_number' (+1-212-555-0123), 'bold' (bold text), 'italic' (italic text), 'underline' (underlined text), 'strikethrough' (strikethrough text), 'code' (monowidth string), 'pre' (monowidth block), 'text_link' (for clickable text URLs), 'text_mention' (for users without usernames) | | `offset` | `#!python int` | Offset in UTF-16 code units to the start of the entity | | `length` | `#!python int` | Length of the entity in UTF-16 code units | | `url` | `#!python Optional[str]` | Optional. For 'text_link' only, url that will be opened after user taps on the text | diff --git a/docs/api/types/passport_file.md b/docs/api/types/passport_file.md index 2883c6cf..ed8a7561 100644 --- a/docs/api/types/passport_file.md +++ b/docs/api/types/passport_file.md @@ -9,7 +9,8 @@ This object represents a file uploaded to Telegram Passport. Currently all Teleg | Name | Type | Description | | - | - | - | -| `file_id` | `#!python str` | Identifier for this file | +| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file | +| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | | `file_size` | `#!python int` | File size | | `file_date` | `#!python int` | Unix time when the file was uploaded | diff --git a/docs/api/types/photo_size.md b/docs/api/types/photo_size.md index 42f5fe14..ee13b2cf 100644 --- a/docs/api/types/photo_size.md +++ b/docs/api/types/photo_size.md @@ -9,7 +9,8 @@ This object represents one size of a photo or a file / sticker thumbnail. | Name | Type | Description | | - | - | - | -| `file_id` | `#!python str` | Identifier for this file | +| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file | +| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | | `width` | `#!python int` | Photo width | | `height` | `#!python int` | Photo height | | `file_size` | `#!python Optional[int]` | Optional. File size | diff --git a/docs/api/types/sticker.md b/docs/api/types/sticker.md index ff945b24..dde51a74 100644 --- a/docs/api/types/sticker.md +++ b/docs/api/types/sticker.md @@ -9,7 +9,8 @@ This object represents a sticker. | Name | Type | Description | | - | - | - | -| `file_id` | `#!python str` | Identifier for this file | +| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file | +| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | | `width` | `#!python int` | Sticker width | | `height` | `#!python int` | Sticker height | | `is_animated` | `#!python bool` | True, if the sticker is animated | diff --git a/docs/api/types/video.md b/docs/api/types/video.md index 9e368de2..2e43020b 100644 --- a/docs/api/types/video.md +++ b/docs/api/types/video.md @@ -9,7 +9,8 @@ This object represents a video file. | Name | Type | Description | | - | - | - | -| `file_id` | `#!python str` | Identifier for this file | +| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file | +| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | | `width` | `#!python int` | Video width as defined by sender | | `height` | `#!python int` | Video height as defined by sender | | `duration` | `#!python int` | Duration of the video in seconds as defined by sender | diff --git a/docs/api/types/video_note.md b/docs/api/types/video_note.md index 9222b6be..34387929 100644 --- a/docs/api/types/video_note.md +++ b/docs/api/types/video_note.md @@ -9,7 +9,8 @@ This object represents a video message (available in Telegram apps as of v.4.0). | Name | Type | Description | | - | - | - | -| `file_id` | `#!python str` | Identifier for this file | +| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file | +| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | | `length` | `#!python int` | Video width and height (diameter of the video message) as defined by sender | | `duration` | `#!python int` | Duration of the video in seconds as defined by sender | | `thumb` | `#!python Optional[PhotoSize]` | Optional. Video thumbnail | diff --git a/docs/api/types/voice.md b/docs/api/types/voice.md index 776e920b..f108efcb 100644 --- a/docs/api/types/voice.md +++ b/docs/api/types/voice.md @@ -9,7 +9,8 @@ This object represents a voice note. | Name | Type | Description | | - | - | - | -| `file_id` | `#!python str` | Identifier for this file | +| `file_id` | `#!python str` | Identifier for this file, which can be used to download or reuse the file | +| `file_unique_id` | `#!python str` | Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. | | `duration` | `#!python int` | Duration of the audio in seconds as defined by sender | | `mime_type` | `#!python Optional[str]` | Optional. MIME type of the file as defined by sender | | `file_size` | `#!python Optional[int]` | Optional. File size | diff --git a/docs/index.md b/docs/index.md index 5bd98ffe..073f8d61 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,7 +4,7 @@ Documentation for version 3.0 [WIP] [^1] [![MIT License](https://img.shields.io/pypi/l/aiogram.svg?style=flat-square)](https://opensource.org/licenses/MIT) [![Supported python versions](https://img.shields.io/pypi/pyversions/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) -[![Telegram Bot API](https://img.shields.io/badge/Telegram%20Bot%20API-4.4-blue.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api) +[![Telegram Bot API](https://img.shields.io/badge/Telegram%20Bot%20API-4.5-blue.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api) [![PyPi Package Version](https://img.shields.io/pypi/v/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) [![PyPi status](https://img.shields.io/pypi/status/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) [![Downloads](https://img.shields.io/pypi/dm/aiogram.svg?style=flat-square)](https://pypi.python.org/pypi/aiogram) @@ -16,7 +16,7 @@ Documentation for version 3.0 [WIP] [^1] ## Features - Asynchronous -- [Supports Telegram Bot API v4.4](api/index.md) +- [Supports Telegram Bot API v4.5](api/index.md) - Finite State Machine - [Replies into Webhook](https://core.telegram.org/bots/faq#how-can-i-make-requests-in-response-to-updates) - Middlewares diff --git a/pyproject.toml b/pyproject.toml index 7902c8b3..0d9b7fc8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "aiogram" -version = "3.0.0-alpha.0" +version = "3.0.0-alpha.1" description = "modern and fully asynchronous framework for Telegram Bot API" authors = ["Alex Root Junior "] license = "MIT" @@ -17,6 +17,7 @@ classifiers = [ "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", "Topic :: Software Development :: Libraries :: Application Frameworks", ]