Added full support of Bot API 6.4

This commit is contained in:
Alex Root Junior 2022-12-31 00:10:51 +02:00
parent 64eb41db96
commit 6e70371c14
No known key found for this signature in database
GPG key ID: 074C1D455EBEA4AC
15 changed files with 216 additions and 19 deletions

View file

@ -6,7 +6,7 @@
[![PyPi status](https://img.shields.io/pypi/status/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) [![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) [![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) [![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) [![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) [![MIT License](https://img.shields.io/pypi/l/aiogram.svg?style=flat-square)](https://opensource.org/licenses/MIT)

View file

@ -21,7 +21,7 @@ aiogram
:target: https://pypi.python.org/pypi/aiogram :target: https://pypi.python.org/pypi/aiogram
:alt: Supported python versions :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 :target: https://core.telegram.org/bots/api
:alt: Telegram Bot API :alt: Telegram Bot API

View file

@ -43,5 +43,5 @@ __all__ = (
'utils', 'utils',
) )
__version__ = '2.23.1' __version__ = '2.24'
__api_version__ = '6.3' __api_version__ = '6.4'

View file

@ -259,6 +259,11 @@ class Methods(Helper):
REOPEN_FORUM_TOPIC = Item() # reopenForumTopic REOPEN_FORUM_TOPIC = Item() # reopenForumTopic
DELETE_FORUM_TOPIC = Item() # deleteForumTopic DELETE_FORUM_TOPIC = Item() # deleteForumTopic
UNPIN_ALL_FORUM_TOPIC_MESSAGES = Item() # unpinAllForumTopicMessages 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 ANSWER_CALLBACK_QUERY = Item() # answerCallbackQuery
SET_MY_COMMANDS = Item() # setMyCommands SET_MY_COMMANDS = Item() # setMyCommands
DELETE_MY_COMMANDS = Item() # deleteMyCommands DELETE_MY_COMMANDS = Item() # deleteMyCommands

View file

@ -498,6 +498,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
types.ReplyKeyboardMarkup, types.ReplyKeyboardMarkup,
types.ReplyKeyboardRemove, types.ReplyKeyboardRemove,
types.ForceReply, None] = None, types.ForceReply, None] = None,
has_spoiler: typing.Optional[base.Boolean] = None,
) -> types.Message: ) -> types.Message:
""" """
Use this method to send photos. Use this method to send photos.
@ -544,6 +545,9 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
:type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup, :type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup,
types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply, None]` 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 :return: On success, the sent Message is returned
:rtype: :obj:`types.Message` :rtype: :obj:`types.Message`
""" """
@ -776,6 +780,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
types.ReplyKeyboardMarkup, types.ReplyKeyboardMarkup,
types.ReplyKeyboardRemove, types.ReplyKeyboardRemove,
types.ForceReply, None] = None, types.ForceReply, None] = None,
has_spoiler: typing.Optional[base.Boolean] = None,
) -> types.Message: ) -> types.Message:
""" """
Use this method to send video files, Telegram clients support mp4 videos 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, :type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup,
types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply, None]` 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 :return: On success, the sent Message is returned
:rtype: :obj:`types.Message` :rtype: :obj:`types.Message`
""" """
@ -875,6 +883,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
types.ReplyKeyboardMarkup, types.ReplyKeyboardMarkup,
types.ReplyKeyboardRemove, types.ReplyKeyboardRemove,
types.ForceReply], None] = None, types.ForceReply], None] = None,
has_spoiler: typing.Optional[base.Boolean] = None,
) -> types.Message: ) -> types.Message:
""" """
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). 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, :type reply_markup: :obj:`typing.Union[typing.Union[types.InlineKeyboardMarkup, types.ReplyKeyboardMarkup,
types.ReplyKeyboardRemove, types.ForceReply], None]` 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 :return: On success, the sent Message is returned
:rtype: :obj:`types.Message` :rtype: :obj:`types.Message`
""" """
@ -1711,7 +1723,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
return types.Message(**result) return types.Message(**result)
async def send_chat_action(self, chat_id: typing.Union[base.Integer, base.String], 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 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 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. `upload_video_note` for video notes.
:type action: :obj:`base.String` :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 :return: Returns True on success
:rtype: :obj:`base.Boolean` :rtype: :obj:`base.Boolean`
""" """
@ -2458,6 +2473,97 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
return await self.request(api.Methods.UNPIN_ALL_CHAT_MESSAGES, payload) 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: 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. 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) return types.ForumTopic(**result)
async def edit_forum_topic(self, chat_id: typing.Union[int, str], 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, message_thread_id: typing.Optional[base.Integer] = None,
icon_custom_emoji_id: typing.Optional[base.String] = None) -> base.Boolean: icon_custom_emoji_id: typing.Optional[base.String] = None) -> base.Boolean:
""" """

View file

@ -32,9 +32,12 @@ from .force_reply import ForceReply
from .forum_topic import ForumTopic from .forum_topic import ForumTopic
from .forum_topic_closed import ForumTopicClosed from .forum_topic_closed import ForumTopicClosed
from .forum_topic_created import ForumTopicCreated from .forum_topic_created import ForumTopicCreated
from .forum_topic_edited import ForumTopicEdited
from .forum_topic_reopened import ForumTopicReopened from .forum_topic_reopened import ForumTopicReopened
from .game import Game from .game import Game
from .game_high_score import GameHighScore 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_keyboard import InlineKeyboardButton, InlineKeyboardMarkup
from .inline_query import InlineQuery from .inline_query import InlineQuery
from .inline_query_result import InlineQueryResult, InlineQueryResultArticle, InlineQueryResultAudio, \ 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_data import WebAppData
from .web_app_info import WebAppInfo from .web_app_info import WebAppInfo
from .webhook_info import WebhookInfo from .webhook_info import WebhookInfo
from .write_access_allowed import WriteAccessAllowed
__all__ = ( __all__ = (
'AllowedUpdates', 'AllowedUpdates',
@ -248,6 +252,10 @@ __all__ = (
'ForumTopicCreated', 'ForumTopicCreated',
'ForumTopicClosed', 'ForumTopicClosed',
'ForumTopicReopened', 'ForumTopicReopened',
"ForumTopicEdited",
"GeneralForumTopicHidden",
"GeneralForumTopicUnhidden",
"WriteAccessAllowed",
'base', 'base',
'fields', 'fields',
) )

View file

@ -48,6 +48,8 @@ class Chat(base.TelegramObject):
can_set_sticker_set: base.Boolean = fields.Field() can_set_sticker_set: base.Boolean = fields.Field()
linked_chat_id: base.Integer = fields.Field() linked_chat_id: base.Integer = fields.Field()
location: ChatLocation = 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): def __hash__(self):
return self.id return self.id
@ -562,7 +564,7 @@ class Chat(base.TelegramObject):
""" """
return await self.bot.delete_chat_sticker_set(self.id) 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. 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 The status is set for 5 seconds or less
@ -575,6 +577,8 @@ class Chat(base.TelegramObject):
:param action: Type of action to broadcast. :param action: Type of action to broadcast.
:type action: :obj:`base.String` :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. :return: Returns True on success.
:rtype: :obj:`base.Boolean` :rtype: :obj:`base.Boolean`
""" """

View file

@ -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()

View file

@ -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
"""

View file

@ -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
"""

View file

@ -107,6 +107,7 @@ class InputMediaAnimation(InputMedia):
width: base.Integer = fields.Field() width: base.Integer = fields.Field()
height: base.Integer = fields.Field() height: base.Integer = fields.Field()
duration: base.Integer = fields.Field() duration: base.Integer = fields.Field()
has_spoiler: typing.Optional[base.Boolean] = fields.Field()
def __init__( def __init__(
self, self,
@ -118,12 +119,13 @@ class InputMediaAnimation(InputMedia):
duration: base.Integer = None, duration: base.Integer = None,
parse_mode: base.String = None, parse_mode: base.String = None,
caption_entities: typing.Optional[typing.List[MessageEntity]] = None, caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
has_spoiler: typing.Optional[base.Boolean] = None,
**kwargs, **kwargs,
): ):
super().__init__( super().__init__(
type='animation', media=media, thumb=thumb, caption=caption, width=width, type='animation', media=media, thumb=thumb, caption=caption, width=width,
height=height, duration=duration, parse_mode=parse_mode, 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 https://core.telegram.org/bots/api#inputmediaphoto
""" """
has_spoiler: typing.Optional[base.Boolean] = fields.Field()
def __init__( def __init__(
self, self,
@ -195,11 +198,12 @@ class InputMediaPhoto(InputMedia):
caption: base.String = None, caption: base.String = None,
parse_mode: base.String = None, parse_mode: base.String = None,
caption_entities: typing.Optional[typing.List[MessageEntity]] = None, caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
has_spoiler: typing.Optional[base.Boolean] = None,
**kwargs, **kwargs,
): ):
super().__init__( super().__init__(
type='photo', media=media, caption=caption, parse_mode=parse_mode, 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() height: base.Integer = fields.Field()
duration: base.Integer = fields.Field() duration: base.Integer = fields.Field()
supports_streaming: base.Boolean = fields.Field() supports_streaming: base.Boolean = fields.Field()
has_spoiler: typing.Optional[base.Boolean] = fields.Field()
def __init__( def __init__(
self, self,
@ -225,13 +230,14 @@ class InputMediaVideo(InputMedia):
parse_mode: base.String = None, parse_mode: base.String = None,
caption_entities: typing.Optional[typing.List[MessageEntity]] = None, caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
supports_streaming: base.Boolean = None, supports_streaming: base.Boolean = None,
has_spoiler: typing.Optional[base.Boolean] = None,
**kwargs, **kwargs,
): ):
super().__init__( super().__init__(
type='video', media=media, thumb=thumb, caption=caption, type='video', media=media, thumb=thumb, caption=caption,
width=width, height=height, duration=duration, width=width, height=height, duration=duration,
parse_mode=parse_mode, caption_entities=caption_entities, parse_mode=parse_mode, caption_entities=caption_entities,
supports_streaming=supports_streaming, conf=kwargs supports_streaming=supports_streaming, has_spoiler=has_spoiler, conf=kwargs
) )

View file

@ -12,7 +12,13 @@ from .contact import Contact
from .dice import Dice from .dice import Dice
from .document import Document from .document import Document
from .force_reply import ForceReply 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 .game import Game
from .general_forum_topic_hidden import GeneralForumTopicHidden
from .general_forum_topic_unhidden import GeneralForumTopicUnhidden
from .inline_keyboard import InlineKeyboardMarkup from .inline_keyboard import InlineKeyboardMarkup
from .input_media import InputMedia, MediaGroup from .input_media import InputMedia, MediaGroup
from .invoice import Invoice from .invoice import Invoice
@ -41,9 +47,7 @@ from .voice_chat_participants_invited import VoiceChatParticipantsInvited
from .voice_chat_scheduled import VoiceChatScheduled from .voice_chat_scheduled import VoiceChatScheduled
from .voice_chat_started import VoiceChatStarted from .voice_chat_started import VoiceChatStarted
from .web_app_data import WebAppData from .web_app_data import WebAppData
from .forum_topic_created import ForumTopicCreated from .write_access_allowed import WriteAccessAllowed
from .forum_topic_closed import ForumTopicClosed
from .forum_topic_reopened import ForumTopicReopened
from ..utils import helper from ..utils import helper
from ..utils import markdown as md from ..utils import markdown as md
from ..utils.text_decorations import html_decoration, markdown_decoration 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_started: VideoChatStarted = fields.Field(base=VideoChatStarted)
video_chat_ended: VideoChatEnded = fields.Field(base=VideoChatEnded) video_chat_ended: VideoChatEnded = fields.Field(base=VideoChatEnded)
video_chat_participants_invited: VideoChatParticipantsInvited = fields.Field(base=VideoChatParticipantsInvited) 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 @property
@functools.lru_cache() @functools.lru_cache()
@ -212,6 +221,14 @@ class Message(base.TelegramObject):
return ContentType.VIDEO_CHAT_ENDED return ContentType.VIDEO_CHAT_ENDED
if self.video_chat_participants_invited: if self.video_chat_participants_invited:
return ContentType.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 return ContentType.UNKNOWN
@ -1578,7 +1595,7 @@ class Message(base.TelegramObject):
async def answer_chat_action( async def answer_chat_action(
self, self,
action: base.String, action: base.String, message_thread_id: typing.Optional[base.Integer] = None
) -> base.Boolean: ) -> base.Boolean:
""" """
Use this method when you need to tell the user that something is happening on the bot's side. 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 :param action: Type of action to broadcast
:type action: :obj:`base.String` :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 :return: Returns True on success
:rtype: :obj:`base.Boolean` :rtype: :obj:`base.Boolean`
""" """
@ -3245,9 +3264,9 @@ class Message(base.TelegramObject):
reply_to_message_id: typing.Optional[base.Integer] = None, reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None, allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[InlineKeyboardMarkup, reply_markup: typing.Union[InlineKeyboardMarkup,
ReplyKeyboardMarkup, ReplyKeyboardMarkup,
ReplyKeyboardRemove, ReplyKeyboardRemove,
ForceReply, None] = None, ForceReply, None] = None,
) -> MessageId: ) -> MessageId:
return await self.bot.copy_message( return await self.bot.copy_message(
chat_id=chat_id, chat_id=chat_id,
@ -3343,7 +3362,10 @@ class ContentType(helper.Helper):
VIDEO_CHAT_STARTED = helper.Item() # video_chat_started VIDEO_CHAT_STARTED = helper.Item() # video_chat_started
VIDEO_CHAT_ENDED = helper.Item() # video_chat_ended VIDEO_CHAT_ENDED = helper.Item() # video_chat_ended
VIDEO_CHAT_PARTICIPANTS_INVITED = helper.Item() # video_chat_participants_invited 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 UNKNOWN = helper.Item() # unknown
ANY = helper.Item() # any ANY = helper.Item() # any
@ -3417,6 +3439,10 @@ class ContentTypes(helper.Helper):
VIDEO_CHAT_STARTED = helper.Item() # video_chat_started VIDEO_CHAT_STARTED = helper.Item() # video_chat_started
VIDEO_CHAT_ENDED = helper.Item() # video_chat_ended VIDEO_CHAT_ENDED = helper.Item() # video_chat_ended
VIDEO_CHAT_PARTICIPANTS_INVITED = helper.Item() # video_chat_participants_invited 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 UNKNOWN = helper.ListItem() # unknown
ANY = helper.ListItem() # any ANY = helper.ListItem() # any

View file

@ -30,6 +30,7 @@ class ReplyKeyboardMarkup(base.TelegramObject):
one_time_keyboard: base.Boolean = fields.Field() one_time_keyboard: base.Boolean = fields.Field()
input_field_placeholder: base.String = fields.Field() input_field_placeholder: base.String = fields.Field()
selective: base.Boolean = fields.Field() selective: base.Boolean = fields.Field()
is_persistent: base.Boolean = fields.Field()
def __init__(self, keyboard: 'typing.List[typing.List[KeyboardButton]]' = None, def __init__(self, keyboard: 'typing.List[typing.List[KeyboardButton]]' = None,
resize_keyboard: base.Boolean = None, resize_keyboard: base.Boolean = None,

View file

@ -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
"""

View file

@ -22,7 +22,7 @@ Welcome to aiogram's documentation!
:target: https://pypi.python.org/pypi/aiogram :target: https://pypi.python.org/pypi/aiogram
:alt: Supported python versions :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 :target: https://core.telegram.org/bots/api
:alt: Telegram Bot API :alt: Telegram Bot API