From c3d9900158394ba0fc8842938c8c379488aa24b3 Mon Sep 17 00:00:00 2001 From: Oleg A Date: Sun, 8 Nov 2020 14:25:03 +0300 Subject: [PATCH] AIOG-T-93 added allow_sending_without_reply to send_media_group shortcuts --- aiogram/types/message.py | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/aiogram/types/message.py b/aiogram/types/message.py index f3b5b7bb..23af8cec 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -870,19 +870,31 @@ class Message(base.TelegramObject): self, media: typing.Union[MediaGroup, typing.List], disable_notification: typing.Optional[base.Boolean] = None, + allow_sending_without_reply: typing.Optional[base.Boolean] = None, reply: base.Boolean = False, ) -> typing.List[Message]: """ - Use this method to send a group of photos or videos as an album. + Use this method to send a group of photos, videos, documents or audios as + an album. Documents and audio files can be only group in an album with + messages of the same type. On success, an array of Messages that were sent + is returned. Source: https://core.telegram.org/bots/api#sendmediagroup :param media: A JSON-serialized array describing photos and videos to be sent :type media: :obj:`typing.Union[types.MediaGroup, typing.List]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. + + :param disable_notification: Sends the message silently. Users will receive + a notification with no sound. :type disable_notification: :obj:`typing.Optional[base.Boolean]` + + :param allow_sending_without_reply: Pass True, if the message should be sent + even if the specified replied-to message is not found + :type allow_sending_without_reply: :obj:`typing.Optional[base.Boolean]` + :param reply: fill 'reply_to_message_id' :type reply: :obj:`base.Boolean` + :return: On success, an array of the sent Messages is returned. :rtype: typing.List[types.Message] """ @@ -891,6 +903,7 @@ class Message(base.TelegramObject): media=media, disable_notification=disable_notification, reply_to_message_id=self.message_id if reply else None, + allow_sending_without_reply=allow_sending_without_reply, ) async def answer_location( @@ -1887,19 +1900,31 @@ class Message(base.TelegramObject): self, media: typing.Union[MediaGroup, typing.List], disable_notification: typing.Optional[base.Boolean] = None, + allow_sending_without_reply: typing.Optional[base.Boolean] = None, reply: base.Boolean = True, ) -> typing.List[Message]: """ - Use this method to send a group of photos or videos as an album. + Use this method to send a group of photos, videos, documents or audios as + an album. Documents and audio files can be only group in an album with + messages of the same type. On success, an array of Messages that were sent + is returned. Source: https://core.telegram.org/bots/api#sendmediagroup :param media: A JSON-serialized array describing photos and videos to be sent :type media: :obj:`typing.Union[types.MediaGroup, typing.List]` - :param disable_notification: Sends the message silently. Users will receive a notification with no sound. + + :param disable_notification: Sends the message silently. Users will receive + a notification with no sound. :type disable_notification: :obj:`typing.Optional[base.Boolean]` + + :param allow_sending_without_reply: Pass True, if the message should be sent + even if the specified replied-to message is not found + :type allow_sending_without_reply: :obj:`typing.Optional[base.Boolean]` + :param reply: fill 'reply_to_message_id' :type reply: :obj:`base.Boolean` + :return: On success, an array of the sent Messages is returned. :rtype: typing.List[types.Message] """ @@ -1908,6 +1933,7 @@ class Message(base.TelegramObject): media=media, disable_notification=disable_notification, reply_to_message_id=self.message_id if reply else None, + allow_sending_without_reply=allow_sending_without_reply, ) async def reply_location(