From 6e70371c14a2d20e050d0c319f29f8fcaa4927f7 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 31 Dec 2022 00:10:51 +0200 Subject: [PATCH] Added full support of Bot API 6.4 --- README.md | 2 +- README.rst | 2 +- aiogram/__init__.py | 4 +- aiogram/bot/api.py | 5 + aiogram/bot/bot.py | 110 +++++++++++++++++- aiogram/types/__init__.py | 8 ++ aiogram/types/chat.py | 6 +- aiogram/types/forum_topic_edited.py | 14 +++ aiogram/types/general_forum_topic_hidden.py | 9 ++ aiogram/types/general_forum_topic_unhidden.py | 9 ++ aiogram/types/input_media.py | 12 +- aiogram/types/message.py | 42 +++++-- aiogram/types/reply_keyboard.py | 1 + aiogram/types/write_access_allowed.py | 9 ++ docs/source/index.rst | 2 +- 15 files changed, 216 insertions(+), 19 deletions(-) create mode 100644 aiogram/types/forum_topic_edited.py create mode 100644 aiogram/types/general_forum_topic_hidden.py create mode 100644 aiogram/types/general_forum_topic_unhidden.py create mode 100644 aiogram/types/write_access_allowed.py diff --git a/README.md b/README.md index 74be4c16..603f3920 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![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) [![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-6.3-blue.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api) +[![Telegram Bot API](https://img.shields.io/badge/Telegram%20Bot%20API-6.4-blue.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api) [![Documentation Status](https://img.shields.io/readthedocs/aiogram?style=flat-square)](http://docs.aiogram.dev/en/latest/?badge=latest) [![Github issues](https://img.shields.io/github/issues/aiogram/aiogram.svg?style=flat-square)](https://github.com/aiogram/aiogram/issues) [![MIT License](https://img.shields.io/pypi/l/aiogram.svg?style=flat-square)](https://opensource.org/licenses/MIT) diff --git a/README.rst b/README.rst index a7983ce9..0d28a539 100644 --- a/README.rst +++ b/README.rst @@ -21,7 +21,7 @@ aiogram :target: https://pypi.python.org/pypi/aiogram :alt: Supported python versions -.. image:: https://img.shields.io/badge/Telegram%20Bot%20API-6.3-blue.svg?style=flat-square&logo=telegram +.. image:: https://img.shields.io/badge/Telegram%20Bot%20API-6.4-blue.svg?style=flat-square&logo=telegram :target: https://core.telegram.org/bots/api :alt: Telegram Bot API diff --git a/aiogram/__init__.py b/aiogram/__init__.py index aa40e62f..ea1d5df8 100644 --- a/aiogram/__init__.py +++ b/aiogram/__init__.py @@ -43,5 +43,5 @@ __all__ = ( 'utils', ) -__version__ = '2.23.1' -__api_version__ = '6.3' +__version__ = '2.24' +__api_version__ = '6.4' diff --git a/aiogram/bot/api.py b/aiogram/bot/api.py index 29311d73..ef1d24be 100644 --- a/aiogram/bot/api.py +++ b/aiogram/bot/api.py @@ -259,6 +259,11 @@ class Methods(Helper): REOPEN_FORUM_TOPIC = Item() # reopenForumTopic DELETE_FORUM_TOPIC = Item() # deleteForumTopic UNPIN_ALL_FORUM_TOPIC_MESSAGES = Item() # unpinAllForumTopicMessages + EDIT_GENERAL_FORUM_TOPIC = Item() # editGeneralForumTopic + CLOSE_GENERAL_FORUM_TOPIC = Item() # closeGeneralForumTopic + REOPEN_GENERAL_FORUM_TOPIC = Item() # reopenGeneralForumTopic + HIDE_GENERAL_FORUM_TOPIC = Item() # hideGeneralForumTopic + UNHIDE_GENERAL_FORUM_TOPIC = Item() # unhideGeneralForumTopic ANSWER_CALLBACK_QUERY = Item() # answerCallbackQuery SET_MY_COMMANDS = Item() # setMyCommands DELETE_MY_COMMANDS = Item() # deleteMyCommands diff --git a/aiogram/bot/bot.py b/aiogram/bot/bot.py index aabbbfbe..8465fa1e 100644 --- a/aiogram/bot/bot.py +++ b/aiogram/bot/bot.py @@ -498,6 +498,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply, None] = None, + has_spoiler: typing.Optional[base.Boolean] = None, ) -> types.Message: """ Use this method to send photos. @@ -544,6 +545,9 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): :type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply, None]` + :param has_spoiler: Pass True if the photo needs to be covered with a spoiler animation + :type has_spoiler: :obj:`typing.Optional[base.Boolean]` + :return: On success, the sent Message is returned :rtype: :obj:`types.Message` """ @@ -776,6 +780,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply, None] = None, + has_spoiler: typing.Optional[base.Boolean] = None, ) -> types.Message: """ Use this method to send video files, Telegram clients support mp4 videos @@ -838,6 +843,9 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): :type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply, None]` + :param has_spoiler: Pass True if the video needs to be covered with a spoiler animation + :type has_spoiler: :obj:`typing.Optional[base.Boolean]` + :return: On success, the sent Message is returned :rtype: :obj:`types.Message` """ @@ -875,6 +883,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply], None] = None, + has_spoiler: typing.Optional[base.Boolean] = None, ) -> types.Message: """ Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). @@ -940,6 +949,9 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): :type reply_markup: :obj:`typing.Union[typing.Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply], None]` + :param has_spoiler: Pass True if the animation needs to be covered with a spoiler animation + :type has_spoiler: :obj:`typing.Optional[base.Boolean]` + :return: On success, the sent Message is returned :rtype: :obj:`types.Message` """ @@ -1711,7 +1723,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): return types.Message(**result) async def send_chat_action(self, chat_id: typing.Union[base.Integer, base.String], - action: base.String) -> base.Boolean: + action: base.String, message_thread_id: typing.Optional[base.Integer] = None) -> base.Boolean: """ Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or @@ -1743,6 +1755,9 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): `upload_video_note` for video notes. :type action: :obj:`base.String` + :param message_thread_id: Unique identifier for the target message thread; supergroups only + :type message_thread_id: :obj:`typing.Optional[base.Integer]` + :return: Returns True on success :rtype: :obj:`base.Boolean` """ @@ -2458,6 +2473,97 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): return await self.request(api.Methods.UNPIN_ALL_CHAT_MESSAGES, payload) + async def close_general_forum_topic( + self, + chat_id: typing.Union[base.Integer, base.String], + ) -> base.Boolean: + """ + Use this method to close an open 'General' topic in a forum supergroup chat. + The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. + + Returns :code:`True` on success. + + :param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`) + :return: Returns :code:`True` on success. + """ + + payload = generate_payload(**locals()) + + return await self.request(api.Methods.CLOSE_GENERAL_FORUM_TOPIC, payload) + + async def edit_general_forum_topic( + self, + chat_id: typing.Union[base.Integer, base.String], + name: base.String, + ) -> base.Boolean: + """ + Use this method to edit the name of the 'General' topic in a forum supergroup chat. + The bot must be an administrator in the chat for this to work and must have *can_manage_topics* administrator rights. + + Returns :code:`True` on success. + + :param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`) + :param name: New topic name, 1-128 characters + :return: Returns :code:`True` on success. + """ + + payload = generate_payload(**locals()) + + return await self.request(api.Methods.EDIT_GENERAL_FORUM_TOPIC, payload) + + async def hide_general_forum_topic( + self, + chat_id: typing.Union[base.Integer, base.String], + ) -> base.Boolean: + """ + Use this method to hide the 'General' topic in a forum supergroup chat. + The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. + + The topic will be automatically closed if it was open. Returns :code:`True` on success. + + :param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`) + :return: Returns :code:`True` on success. + """ + + payload = generate_payload(**locals()) + + return await self.request(api.Methods.HIDE_GENERAL_FORUM_TOPIC, payload) + + async def reopen_general_forum_topic( + self, + chat_id: typing.Union[base.Integer, base.String], + ) -> base.Boolean: + """ + Use this method to reopen a closed 'General' topic in a forum supergroup chat. + The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. + The topic will be automatically unhidden if it was hidden. Returns :code:`True` on success. + + :param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`) + :return: Returns :code:`True` on success. + """ + + payload = generate_payload(**locals()) + + return await self.request(api.Methods.REOPEN_GENERAL_FORUM_TOPIC, payload) + + async def unhide_general_forum_topic( + self, + chat_id: typing.Union[base.Integer, base.String], + ) -> base.Boolean: + """ + Use this method to unhide the 'General' topic in a forum supergroup chat. + The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. + + Returns :code:`True` on success. + + :param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`) + :return: Returns :code:`True` on success. + """ + + payload = generate_payload(**locals()) + + return await self.request(api.Methods.UNPIN_ALL_CHAT_MESSAGES, payload) + async def leave_chat(self, chat_id: typing.Union[base.Integer, base.String]) -> base.Boolean: """ Use this method for your bot to leave a group, supergroup or channel. @@ -2631,7 +2737,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin): return types.ForumTopic(**result) async def edit_forum_topic(self, chat_id: typing.Union[int, str], - name: base.String, + name: typing.Optional[base.String] = None, message_thread_id: typing.Optional[base.Integer] = None, icon_custom_emoji_id: typing.Optional[base.String] = None) -> base.Boolean: """ diff --git a/aiogram/types/__init__.py b/aiogram/types/__init__.py index cb87afa0..a75b76c0 100644 --- a/aiogram/types/__init__.py +++ b/aiogram/types/__init__.py @@ -32,9 +32,12 @@ from .force_reply import ForceReply from .forum_topic import ForumTopic from .forum_topic_closed import ForumTopicClosed from .forum_topic_created import ForumTopicCreated +from .forum_topic_edited import ForumTopicEdited from .forum_topic_reopened import ForumTopicReopened from .game import Game from .game_high_score import GameHighScore +from .general_forum_topic_hidden import GeneralForumTopicHidden +from .general_forum_topic_unhidden import GeneralForumTopicUnhidden from .inline_keyboard import InlineKeyboardButton, InlineKeyboardMarkup from .inline_query import InlineQuery from .inline_query_result import InlineQueryResult, InlineQueryResultArticle, InlineQueryResultAudio, \ @@ -95,6 +98,7 @@ from .voice_chat_started import VoiceChatStarted from .web_app_data import WebAppData from .web_app_info import WebAppInfo from .webhook_info import WebhookInfo +from .write_access_allowed import WriteAccessAllowed __all__ = ( 'AllowedUpdates', @@ -248,6 +252,10 @@ __all__ = ( 'ForumTopicCreated', 'ForumTopicClosed', 'ForumTopicReopened', + "ForumTopicEdited", + "GeneralForumTopicHidden", + "GeneralForumTopicUnhidden", + "WriteAccessAllowed", 'base', 'fields', ) diff --git a/aiogram/types/chat.py b/aiogram/types/chat.py index c3a96e59..b6010ca5 100644 --- a/aiogram/types/chat.py +++ b/aiogram/types/chat.py @@ -48,6 +48,8 @@ class Chat(base.TelegramObject): can_set_sticker_set: base.Boolean = fields.Field() linked_chat_id: base.Integer = fields.Field() location: ChatLocation = fields.Field() + has_hidden_members: base.Boolean = fields.Field() + has_aggressive_anti_spam_enabled: base.Boolean = fields.Field() def __hash__(self): return self.id @@ -562,7 +564,7 @@ class Chat(base.TelegramObject): """ return await self.bot.delete_chat_sticker_set(self.id) - async def do(self, action: base.String) -> base.Boolean: + async def do(self, action: base.String, message_thread_id: typing.Optional[base.Integer] = None) -> base.Boolean: """ Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less @@ -575,6 +577,8 @@ class Chat(base.TelegramObject): :param action: Type of action to broadcast. :type action: :obj:`base.String` + :param message_thread_id: Unique identifier for the target message thread; supergroups only + :type message_thread_id: :obj:`typing.Optional[base.Integer]` :return: Returns True on success. :rtype: :obj:`base.Boolean` """ diff --git a/aiogram/types/forum_topic_edited.py b/aiogram/types/forum_topic_edited.py new file mode 100644 index 00000000..b0472853 --- /dev/null +++ b/aiogram/types/forum_topic_edited.py @@ -0,0 +1,14 @@ +import typing + +from . import base +from . import fields + + +class ForumTopicEdited(base.TelegramObject): + """ + This object represents a service message about an edited forum topic. + + https://core.telegram.org/bots/api#forumtopicedited + """ + name: typing.Optional[base.String] = fields.Field() + icon_custom_emoji_id: typing.Optional[base.String] = fields.Field() diff --git a/aiogram/types/general_forum_topic_hidden.py b/aiogram/types/general_forum_topic_hidden.py new file mode 100644 index 00000000..27f4f8e6 --- /dev/null +++ b/aiogram/types/general_forum_topic_hidden.py @@ -0,0 +1,9 @@ +from . import base + + +class GeneralForumTopicHidden(base.TelegramObject): + """ + This object represents a service message about General forum topic hidden in the chat. Currently holds no information. + + https://core.telegram.org/bots/api#generalforumtopichidden + """ diff --git a/aiogram/types/general_forum_topic_unhidden.py b/aiogram/types/general_forum_topic_unhidden.py new file mode 100644 index 00000000..7fce1a7c --- /dev/null +++ b/aiogram/types/general_forum_topic_unhidden.py @@ -0,0 +1,9 @@ +from . import base + + +class GeneralForumTopicUnhidden(base.TelegramObject): + """ + This object represents a service message about General forum topic unhidden in the chat. Currently holds no information. + + https://core.telegram.org/bots/api#generalforumtopicunhidden + """ diff --git a/aiogram/types/input_media.py b/aiogram/types/input_media.py index 6804b460..876a8f41 100644 --- a/aiogram/types/input_media.py +++ b/aiogram/types/input_media.py @@ -107,6 +107,7 @@ class InputMediaAnimation(InputMedia): width: base.Integer = fields.Field() height: base.Integer = fields.Field() duration: base.Integer = fields.Field() + has_spoiler: typing.Optional[base.Boolean] = fields.Field() def __init__( self, @@ -118,12 +119,13 @@ class InputMediaAnimation(InputMedia): duration: base.Integer = None, parse_mode: base.String = None, caption_entities: typing.Optional[typing.List[MessageEntity]] = None, + has_spoiler: typing.Optional[base.Boolean] = None, **kwargs, ): super().__init__( type='animation', media=media, thumb=thumb, caption=caption, width=width, height=height, duration=duration, parse_mode=parse_mode, - caption_entities=caption_entities, conf=kwargs, + caption_entities=caption_entities, has_spoiler=has_spoiler, conf=kwargs, ) @@ -188,6 +190,7 @@ class InputMediaPhoto(InputMedia): https://core.telegram.org/bots/api#inputmediaphoto """ + has_spoiler: typing.Optional[base.Boolean] = fields.Field() def __init__( self, @@ -195,11 +198,12 @@ class InputMediaPhoto(InputMedia): caption: base.String = None, parse_mode: base.String = None, caption_entities: typing.Optional[typing.List[MessageEntity]] = None, + has_spoiler: typing.Optional[base.Boolean] = None, **kwargs, ): super().__init__( type='photo', media=media, caption=caption, parse_mode=parse_mode, - caption_entities=caption_entities, conf=kwargs, + caption_entities=caption_entities, has_spoiler=has_spoiler, conf=kwargs, ) @@ -213,6 +217,7 @@ class InputMediaVideo(InputMedia): height: base.Integer = fields.Field() duration: base.Integer = fields.Field() supports_streaming: base.Boolean = fields.Field() + has_spoiler: typing.Optional[base.Boolean] = fields.Field() def __init__( self, @@ -225,13 +230,14 @@ class InputMediaVideo(InputMedia): parse_mode: base.String = None, caption_entities: typing.Optional[typing.List[MessageEntity]] = None, supports_streaming: base.Boolean = None, + has_spoiler: typing.Optional[base.Boolean] = None, **kwargs, ): super().__init__( type='video', media=media, thumb=thumb, caption=caption, width=width, height=height, duration=duration, parse_mode=parse_mode, caption_entities=caption_entities, - supports_streaming=supports_streaming, conf=kwargs + supports_streaming=supports_streaming, has_spoiler=has_spoiler, conf=kwargs ) diff --git a/aiogram/types/message.py b/aiogram/types/message.py index b191b827..e8051169 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -12,7 +12,13 @@ from .contact import Contact from .dice import Dice from .document import Document from .force_reply import ForceReply +from .forum_topic_closed import ForumTopicClosed +from .forum_topic_created import ForumTopicCreated +from .forum_topic_edited import ForumTopicEdited +from .forum_topic_reopened import ForumTopicReopened from .game import Game +from .general_forum_topic_hidden import GeneralForumTopicHidden +from .general_forum_topic_unhidden import GeneralForumTopicUnhidden from .inline_keyboard import InlineKeyboardMarkup from .input_media import InputMedia, MediaGroup from .invoice import Invoice @@ -41,9 +47,7 @@ from .voice_chat_participants_invited import VoiceChatParticipantsInvited from .voice_chat_scheduled import VoiceChatScheduled from .voice_chat_started import VoiceChatStarted from .web_app_data import WebAppData -from .forum_topic_created import ForumTopicCreated -from .forum_topic_closed import ForumTopicClosed -from .forum_topic_reopened import ForumTopicReopened +from .write_access_allowed import WriteAccessAllowed from ..utils import helper from ..utils import markdown as md from ..utils.text_decorations import html_decoration, markdown_decoration @@ -124,6 +128,11 @@ class Message(base.TelegramObject): video_chat_started: VideoChatStarted = fields.Field(base=VideoChatStarted) video_chat_ended: VideoChatEnded = fields.Field(base=VideoChatEnded) video_chat_participants_invited: VideoChatParticipantsInvited = fields.Field(base=VideoChatParticipantsInvited) + forum_topic_edited: ForumTopicEdited = fields.Field(base=ForumTopicEdited) + general_forum_topic_hidden: GeneralForumTopicHidden = fields.Field(base=GeneralForumTopicHidden) + general_forum_topic_unhidden: GeneralForumTopicUnhidden = fields.Field(base=GeneralForumTopicUnhidden) + write_access_allowed: WriteAccessAllowed = fields.Field(base=WriteAccessAllowed) + has_media_spoiler: base.Boolean = fields.Field() @property @functools.lru_cache() @@ -212,6 +221,14 @@ class Message(base.TelegramObject): return ContentType.VIDEO_CHAT_ENDED if self.video_chat_participants_invited: return ContentType.VIDEO_CHAT_PARTICIPANTS_INVITED + if self.forum_topic_edited: + return ContentType.FORUM_TOPIC_EDITED + if self.general_forum_topic_hidden: + return ContentType.GENERAL_FORUM_TOPIC_HIDDEN + if self.general_forum_topic_unhidden: + return ContentType.GENERAL_FORUM_TOPIC_UNHIDDEN + if self.write_access_allowed: + return ContentType.WRITE_ACCESS_ALLOWED return ContentType.UNKNOWN @@ -1578,7 +1595,7 @@ class Message(base.TelegramObject): async def answer_chat_action( self, - action: base.String, + action: base.String, message_thread_id: typing.Optional[base.Integer] = None ) -> base.Boolean: """ Use this method when you need to tell the user that something is happening on the bot's side. @@ -1592,6 +1609,8 @@ class Message(base.TelegramObject): :param action: Type of action to broadcast :type action: :obj:`base.String` + :param message_thread_id: Unique identifier for the target message thread; supergroups only + :type message_thread_id: :obj:`typing.Optional[base.Integer]` :return: Returns True on success :rtype: :obj:`base.Boolean` """ @@ -3245,9 +3264,9 @@ class Message(base.TelegramObject): reply_to_message_id: typing.Optional[base.Integer] = None, allow_sending_without_reply: typing.Optional[base.Boolean] = None, reply_markup: typing.Union[InlineKeyboardMarkup, - ReplyKeyboardMarkup, - ReplyKeyboardRemove, - ForceReply, None] = None, + ReplyKeyboardMarkup, + ReplyKeyboardRemove, + ForceReply, None] = None, ) -> MessageId: return await self.bot.copy_message( chat_id=chat_id, @@ -3343,7 +3362,10 @@ class ContentType(helper.Helper): VIDEO_CHAT_STARTED = helper.Item() # video_chat_started VIDEO_CHAT_ENDED = helper.Item() # video_chat_ended VIDEO_CHAT_PARTICIPANTS_INVITED = helper.Item() # video_chat_participants_invited - + FORUM_TOPIC_EDITED = helper.Item() # forum_topic_edited + GENERAL_FORUM_TOPIC_HIDDEN = helper.Item() # general_forum_topic_hidden + GENERAL_FORUM_TOPIC_UNHIDDEN = helper.Item() # general_forum_topic_unhidden + WRITE_ACCESS_ALLOWED = helper.Item() # write_access_allowed UNKNOWN = helper.Item() # unknown ANY = helper.Item() # any @@ -3417,6 +3439,10 @@ class ContentTypes(helper.Helper): VIDEO_CHAT_STARTED = helper.Item() # video_chat_started VIDEO_CHAT_ENDED = helper.Item() # video_chat_ended VIDEO_CHAT_PARTICIPANTS_INVITED = helper.Item() # video_chat_participants_invited + FORUM_TOPIC_EDITED = helper.Item() # forum_topic_edited + GENERAL_FORUM_TOPIC_HIDDEN = helper.Item() # general_forum_topic_hidden + GENERAL_FORUM_TOPIC_UNHIDDEN = helper.Item() # general_forum_topic_unhidden + WRITE_ACCESS_ALLOWED = helper.Item() # write_access_allowed UNKNOWN = helper.ListItem() # unknown ANY = helper.ListItem() # any diff --git a/aiogram/types/reply_keyboard.py b/aiogram/types/reply_keyboard.py index 1a8609be..c4b70480 100644 --- a/aiogram/types/reply_keyboard.py +++ b/aiogram/types/reply_keyboard.py @@ -30,6 +30,7 @@ class ReplyKeyboardMarkup(base.TelegramObject): one_time_keyboard: base.Boolean = fields.Field() input_field_placeholder: base.String = fields.Field() selective: base.Boolean = fields.Field() + is_persistent: base.Boolean = fields.Field() def __init__(self, keyboard: 'typing.List[typing.List[KeyboardButton]]' = None, resize_keyboard: base.Boolean = None, diff --git a/aiogram/types/write_access_allowed.py b/aiogram/types/write_access_allowed.py new file mode 100644 index 00000000..16fd6909 --- /dev/null +++ b/aiogram/types/write_access_allowed.py @@ -0,0 +1,9 @@ +from . import base + + +class WriteAccessAllowed(base.TelegramObject): + """ + This object represents a service message about a user allowing a bot added to the attachment menu to write messages. Currently holds no information. + + https://core.telegram.org/bots/api#writeaccessallowed + """ diff --git a/docs/source/index.rst b/docs/source/index.rst index c5cb2055..3b618877 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -22,7 +22,7 @@ Welcome to aiogram's documentation! :target: https://pypi.python.org/pypi/aiogram :alt: Supported python versions - .. image:: https://img.shields.io/badge/Telegram%20Bot%20API-6.3-blue.svg?style=flat-square&logo=telegram + .. image:: https://img.shields.io/badge/Telegram%20Bot%20API-6.4-blue.svg?style=flat-square&logo=telegram :target: https://core.telegram.org/bots/api :alt: Telegram Bot API