Merge pull request #801 from aiogram/dev-2.x-api-5.6

Bot API v5.6 support
This commit is contained in:
Oleg A 2022-01-02 21:59:34 +03:00 committed by GitHub
commit 61fe788355
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 381 additions and 26 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)
[![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-5.5-blue.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api)
[![Telegram Bot API](https://img.shields.io/badge/Telegram%20Bot%20API-5.6-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)

View file

@ -43,5 +43,5 @@ __all__ = (
'utils',
)
__version__ = '2.17.1'
__api_version__ = '5.5'
__version__ = '2.18'
__api_version__ = '5.6'

View file

@ -189,7 +189,7 @@ class Methods(Helper):
"""
Helper for Telegram API Methods listed on https://core.telegram.org/bots/api
List is updated to Bot API 5.5
List is updated to Bot API 5.6
"""
mode = HelperMode.lowerCamelCase

View file

@ -270,6 +270,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
entities: typing.Optional[typing.List[types.MessageEntity]] = None,
disable_web_page_preview: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
@ -302,6 +303,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -327,22 +332,38 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
result = await self.request(api.Methods.SEND_MESSAGE, payload)
return types.Message(**result)
async def forward_message(self, chat_id: typing.Union[base.Integer, base.String],
from_chat_id: typing.Union[base.Integer, base.String], message_id: base.Integer,
disable_notification: typing.Optional[base.Boolean] = None) -> types.Message:
async def forward_message(self,
chat_id: typing.Union[base.Integer, base.String],
from_chat_id: typing.Union[base.Integer, base.String],
message_id: base.Integer,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
) -> types.Message:
"""
Use this method to forward messages of any kind.
Source: https://core.telegram.org/bots/api#forwardmessage
:param chat_id: Unique identifier for the target chat or username of the target channel
:param chat_id: Unique identifier for the target chat or
username of the target channel
:type chat_id: :obj:`typing.Union[base.Integer, base.String]`
:param from_chat_id: Unique identifier for the chat where the original message was sent
:param from_chat_id: Unique identifier for the chat where the
original message was sent
:type from_chat_id: :obj:`typing.Union[base.Integer, base.String]`
: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 message_id: Message identifier in the chat specified in from_chat_id
:param protect_content: Protects the contents of the forwarded
message from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param message_id: Message identifier in the chat specified in
from_chat_id
:type message_id: :obj:`base.Integer`
:return: On success, the sent Message is returned
:rtype: :obj:`types.Message`
"""
@ -359,6 +380,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
parse_mode: typing.Optional[base.String] = None,
caption_entities: typing.Optional[typing.List[types.MessageEntity]] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
@ -401,6 +423,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original
message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -436,6 +462,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
parse_mode: typing.Optional[base.String] = None,
caption_entities: typing.Optional[typing.List[types.MessageEntity]] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
@ -468,6 +495,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -506,6 +537,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
title: typing.Optional[base.String] = None,
thumb: typing.Union[base.InputFile, base.String, None] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
@ -553,6 +585,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -590,6 +626,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
caption_entities: typing.Optional[typing.List[types.MessageEntity]] = None,
disable_content_type_detection: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
@ -635,6 +672,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original
message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -677,12 +718,14 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
caption_entities: typing.Optional[typing.List[types.MessageEntity]] = None,
supports_streaming: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
types.ReplyKeyboardMarkup,
types.ReplyKeyboardRemove,
types.ForceReply, None] = None) -> types.Message:
types.ForceReply, None] = None,
) -> types.Message:
"""
Use this method to send video files, Telegram clients support mp4 videos
(other formats may be sent as Document).
@ -724,6 +767,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -763,6 +810,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
parse_mode: typing.Optional[base.String] = None,
caption_entities: typing.Optional[typing.List[types.MessageEntity]] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[typing.Union[types.InlineKeyboardMarkup,
@ -814,6 +862,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -850,6 +902,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
caption_entities: typing.Optional[typing.List[types.MessageEntity]] = None,
duration: typing.Optional[base.Integer] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
@ -889,6 +942,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -922,12 +979,14 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
length: typing.Optional[base.Integer] = None,
thumb: typing.Union[base.InputFile, base.String, None] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
types.ReplyKeyboardMarkup,
types.ReplyKeyboardRemove,
types.ForceReply, None] = None) -> types.Message:
types.ForceReply, None] = None,
) -> types.Message:
"""
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long.
Use this method to send video messages.
@ -952,6 +1011,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -980,6 +1043,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
chat_id: typing.Union[base.Integer, base.String],
media: typing.Union[types.MediaGroup, typing.List],
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
) -> typing.List[types.Message]:
@ -1003,6 +1067,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the messages are a reply, ID of the original
message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -1037,12 +1105,14 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
heading: typing.Optional[base.Integer] = None,
proximity_alert_radius: typing.Optional[base.Integer] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
types.ReplyKeyboardMarkup,
types.ReplyKeyboardRemove,
types.ForceReply, None] = None) -> types.Message:
types.ForceReply, None] = None,
) -> types.Message:
"""
Use this method to send point on the map.
@ -1076,6 +1146,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -1201,6 +1275,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
google_place_id: typing.Optional[base.String] = None,
google_place_type: typing.Optional[base.String] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
@ -1246,6 +1321,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original
message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -1275,12 +1354,14 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
last_name: typing.Optional[base.String] = None,
vcard: typing.Optional[base.String] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
types.ReplyKeyboardMarkup,
types.ReplyKeyboardRemove,
types.ForceReply, None] = None) -> types.Message:
types.ForceReply, None] = None,
) -> types.Message:
"""
Use this method to send phone contacts.
@ -1304,6 +1385,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -1344,6 +1429,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
None] = None,
is_closed: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
@ -1411,6 +1497,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
a notification with no sound.
:type disable_notification: :obj:`typing.Optional[Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original
message
:type reply_to_message_id: :obj:`typing.Optional[Integer]`
@ -1443,6 +1533,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
async def send_dice(self,
chat_id: typing.Union[base.Integer, base.String],
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
emoji: typing.Optional[base.String] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
@ -1471,6 +1562,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -2730,12 +2825,14 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
async def send_sticker(self, chat_id: typing.Union[base.Integer, base.String],
sticker: typing.Union[base.InputFile, base.String],
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[types.InlineKeyboardMarkup,
types.ReplyKeyboardMarkup,
types.ReplyKeyboardRemove,
types.ForceReply, None] = None) -> types.Message:
types.ForceReply, None] = None,
) -> types.Message:
"""
Use this method to send .webp stickers.
@ -2750,6 +2847,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -3046,6 +3147,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
send_email_to_provider: typing.Optional[base.Boolean] = None,
is_flexible: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Optional[types.InlineKeyboardMarkup] = None,
@ -3145,6 +3247,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
@ -3265,6 +3371,7 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
chat_id: base.Integer,
game_short_name: base.String,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Optional[types.InlineKeyboardMarkup] = None,
@ -3284,6 +3391,10 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_to_message_id: If the message is a reply, ID of the original message
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`

View file

@ -315,6 +315,7 @@ class Message(base.TelegramObject):
entities: typing.Optional[typing.List[MessageEntity]] = None,
disable_web_page_preview: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -345,6 +346,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -367,6 +372,7 @@ class Message(base.TelegramObject):
entities=entities,
disable_web_page_preview=disable_web_page_preview,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -379,6 +385,7 @@ class Message(base.TelegramObject):
parse_mode: typing.Optional[base.String] = None,
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -411,6 +418,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -433,6 +444,7 @@ class Message(base.TelegramObject):
parse_mode=parse_mode,
caption_entities=caption_entities,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -449,6 +461,7 @@ class Message(base.TelegramObject):
title: typing.Optional[base.String] = None,
thumb: typing.Union[typing.Union[base.InputFile, base.String], None] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -497,6 +510,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -523,6 +540,7 @@ class Message(base.TelegramObject):
title=title,
thumb=thumb,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -539,6 +557,7 @@ class Message(base.TelegramObject):
parse_mode: typing.Optional[base.String] = None,
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -589,6 +608,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -615,6 +638,7 @@ class Message(base.TelegramObject):
parse_mode=parse_mode,
caption_entities=caption_entities,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -629,6 +653,7 @@ class Message(base.TelegramObject):
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
disable_content_type_detection: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -672,6 +697,10 @@ class Message(base.TelegramObject):
notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -698,6 +727,7 @@ class Message(base.TelegramObject):
caption_entities=caption_entities,
disable_content_type_detection=disable_content_type_detection,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -715,6 +745,7 @@ class Message(base.TelegramObject):
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
supports_streaming: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -764,6 +795,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -791,6 +826,7 @@ class Message(base.TelegramObject):
caption_entities=caption_entities,
supports_streaming=supports_streaming,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -804,6 +840,7 @@ class Message(base.TelegramObject):
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
duration: typing.Optional[base.Integer] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -843,6 +880,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -866,6 +907,7 @@ class Message(base.TelegramObject):
caption_entities=caption_entities,
duration=duration,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -878,6 +920,7 @@ class Message(base.TelegramObject):
length: typing.Optional[base.Integer] = None,
thumb: typing.Union[typing.Union[base.InputFile, base.String], None] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -910,6 +953,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -932,6 +979,7 @@ class Message(base.TelegramObject):
length=length,
thumb=thumb,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -941,6 +989,7 @@ class Message(base.TelegramObject):
self,
media: typing.Union[MediaGroup, typing.List],
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply: base.Boolean = False,
) -> typing.List[Message]:
@ -959,6 +1008,10 @@ class Message(base.TelegramObject):
a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -973,6 +1026,7 @@ class Message(base.TelegramObject):
self.chat.id,
media=media,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
)
@ -983,6 +1037,7 @@ class Message(base.TelegramObject):
longitude: base.Float,
live_period: typing.Optional[base.Integer] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
horizontal_accuracy: typing.Optional[base.Float] = None,
heading: typing.Optional[base.Integer] = None,
@ -1026,6 +1081,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -1050,6 +1109,7 @@ class Message(base.TelegramObject):
heading=heading,
proximity_alert_radius=proximity_alert_radius,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -1066,6 +1126,7 @@ class Message(base.TelegramObject):
google_place_id: typing.Optional[base.String] = None,
google_place_type: typing.Optional[base.String] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -1110,6 +1171,10 @@ class Message(base.TelegramObject):
a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -1138,6 +1203,7 @@ class Message(base.TelegramObject):
google_place_id=google_place_id,
google_place_type=google_place_type,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -1149,6 +1215,7 @@ class Message(base.TelegramObject):
first_name: base.String,
last_name: typing.Optional[base.String] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -1176,6 +1243,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -1197,6 +1268,7 @@ class Message(base.TelegramObject):
first_name=first_name,
last_name=last_name,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -1206,6 +1278,7 @@ class Message(base.TelegramObject):
self,
sticker: typing.Union[base.InputFile, base.String],
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -1227,6 +1300,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -1246,6 +1323,7 @@ class Message(base.TelegramObject):
chat_id=self.chat.id,
sticker=sticker,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -1266,6 +1344,7 @@ class Message(base.TelegramObject):
close_date: typing.Union[base.Integer, datetime.datetime, datetime.timedelta, None] = None,
is_closed: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -1332,6 +1411,10 @@ class Message(base.TelegramObject):
a notification with no sound.
:type disable_notification: :obj:`typing.Optional[Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -1364,6 +1447,7 @@ class Message(base.TelegramObject):
close_date=close_date,
is_closed=is_closed,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -1373,6 +1457,7 @@ class Message(base.TelegramObject):
self,
emoji: typing.Optional[base.String] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -1399,6 +1484,10 @@ class Message(base.TelegramObject):
a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -1420,6 +1509,7 @@ class Message(base.TelegramObject):
chat_id=self.chat.id,
emoji=emoji,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -1456,6 +1546,7 @@ class Message(base.TelegramObject):
entities: typing.Optional[typing.List[MessageEntity]] = None,
disable_web_page_preview: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -1486,6 +1577,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -1508,6 +1603,7 @@ class Message(base.TelegramObject):
entities=entities,
disable_web_page_preview=disable_web_page_preview,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -1520,6 +1616,7 @@ class Message(base.TelegramObject):
parse_mode: typing.Optional[base.String] = None,
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -1552,6 +1649,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -1574,6 +1675,7 @@ class Message(base.TelegramObject):
parse_mode=parse_mode,
caption_entities=caption_entities,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -1590,6 +1692,7 @@ class Message(base.TelegramObject):
title: typing.Optional[base.String] = None,
thumb: typing.Union[typing.Union[base.InputFile, base.String], None] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -1638,6 +1741,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -1664,6 +1771,7 @@ class Message(base.TelegramObject):
title=title,
thumb=thumb,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -1680,6 +1788,7 @@ class Message(base.TelegramObject):
parse_mode: typing.Optional[base.String] = None,
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -1730,6 +1839,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -1756,6 +1869,7 @@ class Message(base.TelegramObject):
parse_mode=parse_mode,
caption_entities=caption_entities,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -1770,6 +1884,7 @@ class Message(base.TelegramObject):
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
disable_content_type_detection: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -1813,6 +1928,10 @@ class Message(base.TelegramObject):
notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -1839,6 +1958,7 @@ class Message(base.TelegramObject):
caption_entities=caption_entities,
disable_content_type_detection=disable_content_type_detection,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -1856,6 +1976,7 @@ class Message(base.TelegramObject):
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
supports_streaming: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -1905,6 +2026,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -1932,6 +2057,7 @@ class Message(base.TelegramObject):
caption_entities=caption_entities,
supports_streaming=supports_streaming,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -1945,6 +2071,7 @@ class Message(base.TelegramObject):
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
duration: typing.Optional[base.Integer] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -1984,6 +2111,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -2007,6 +2138,7 @@ class Message(base.TelegramObject):
caption_entities=caption_entities,
duration=duration,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -2019,6 +2151,7 @@ class Message(base.TelegramObject):
length: typing.Optional[base.Integer] = None,
thumb: typing.Union[typing.Union[base.InputFile, base.String], None] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -2051,6 +2184,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -2073,6 +2210,7 @@ class Message(base.TelegramObject):
length=length,
thumb=thumb,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -2082,6 +2220,7 @@ class Message(base.TelegramObject):
self,
media: typing.Union[MediaGroup, typing.List],
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply: base.Boolean = True,
) -> typing.List[Message]:
@ -2100,6 +2239,10 @@ class Message(base.TelegramObject):
a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -2114,6 +2257,7 @@ class Message(base.TelegramObject):
self.chat.id,
media=media,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
)
@ -2124,6 +2268,7 @@ class Message(base.TelegramObject):
longitude: base.Float,
live_period: typing.Optional[base.Integer] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
horizontal_accuracy: typing.Optional[base.Float] = None,
heading: typing.Optional[base.Integer] = None,
proximity_alert_radius: typing.Optional[base.Integer] = None,
@ -2166,6 +2311,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:param reply_markup: 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
:type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup,
@ -2186,6 +2335,7 @@ class Message(base.TelegramObject):
heading=heading,
proximity_alert_radius=proximity_alert_radius,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
reply_markup=reply_markup,
)
@ -2201,6 +2351,7 @@ class Message(base.TelegramObject):
google_place_id: typing.Optional[base.String] = None,
google_place_type: typing.Optional[base.String] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -2245,6 +2396,10 @@ class Message(base.TelegramObject):
a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -2273,6 +2428,7 @@ class Message(base.TelegramObject):
google_place_id=google_place_id,
google_place_type=google_place_type,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -2284,6 +2440,7 @@ class Message(base.TelegramObject):
first_name: base.String,
last_name: typing.Optional[base.String] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -2311,6 +2468,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -2332,6 +2493,7 @@ class Message(base.TelegramObject):
first_name=first_name,
last_name=last_name,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -2352,6 +2514,7 @@ class Message(base.TelegramObject):
close_date: typing.Union[base.Integer, datetime.datetime, datetime.timedelta, None] = None,
is_closed: typing.Optional[base.Boolean] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -2418,6 +2581,10 @@ class Message(base.TelegramObject):
a notification with no sound.
:type disable_notification: :obj:`typing.Optional[Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -2450,6 +2617,7 @@ class Message(base.TelegramObject):
close_date=close_date,
is_closed=is_closed,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -2459,6 +2627,7 @@ class Message(base.TelegramObject):
self,
sticker: typing.Union[base.InputFile, base.String],
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -2480,6 +2649,10 @@ class Message(base.TelegramObject):
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -2499,6 +2672,7 @@ class Message(base.TelegramObject):
chat_id=self.chat.id,
sticker=sticker,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -2508,6 +2682,7 @@ class Message(base.TelegramObject):
self,
emoji: typing.Optional[base.String] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[
InlineKeyboardMarkup,
@ -2534,6 +2709,10 @@ class Message(base.TelegramObject):
a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of sent messages
from forwarding and saving
:type protect_content: :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]`
@ -2555,6 +2734,7 @@ class Message(base.TelegramObject):
chat_id=self.chat.id,
emoji=emoji,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=self.message_id if reply else None,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup,
@ -2564,6 +2744,7 @@ class Message(base.TelegramObject):
self,
chat_id: typing.Union[base.Integer, base.String],
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
) -> Message:
"""
Forward this message
@ -2572,13 +2753,23 @@ class Message(base.TelegramObject):
:param chat_id: Unique identifier for the target chat or username of the target channel
:type chat_id: :obj:`typing.Union[base.Integer, base.String]`
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
:param protect_content: Protects the contents of the forwarded
message from forwarding and saving
:type protect_content: :obj:`typing.Optional[base.Boolean]`
:return: On success, the sent Message is returned
:rtype: :obj:`types.Message`
"""
return await self.bot.forward_message(
chat_id, self.chat.id, self.message_id, disable_notification
chat_id=chat_id,
from_chat_id=self.chat.id,
message_id=self.message_id,
disable_notification=disable_notification,
protect_content=protect_content,
)
async def edit_text(
@ -2795,7 +2986,8 @@ class Message(base.TelegramObject):
return await self.bot.delete_message(self.chat.id, self.message_id)
async def pin(
self, disable_notification: typing.Optional[base.Boolean] = None,
self,
disable_notification: typing.Optional[base.Boolean] = None,
) -> base.Boolean:
"""
Use this method to add a message to the list of pinned messages in a chat.
@ -2813,7 +3005,10 @@ class Message(base.TelegramObject):
:return: Returns True on success
:rtype: :obj:`base.Boolean`
"""
return await self.chat.pin_message(self.message_id, disable_notification)
return await self.chat.pin_message(
message_id=self.message_id,
disable_notification=disable_notification,
)
async def unpin(self) -> base.Boolean:
"""
@ -2836,6 +3031,7 @@ class Message(base.TelegramObject):
self: Message,
chat_id: typing.Union[str, int],
disable_notification: typing.Optional[bool] = None,
protect_content: typing.Optional[base.Boolean] = None,
disable_web_page_preview: typing.Optional[bool] = None,
reply_to_message_id: typing.Optional[int] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
@ -2848,6 +3044,7 @@ class Message(base.TelegramObject):
:param chat_id:
:param disable_notification:
:param protect_content:
:param disable_web_page_preview: for text messages only
:param reply_to_message_id:
:param allow_sending_without_reply:
@ -2860,6 +3057,7 @@ class Message(base.TelegramObject):
"reply_markup": reply_markup or self.reply_markup,
"parse_mode": ParseMode.HTML,
"disable_notification": disable_notification,
"protect_content": protect_content,
"reply_to_message_id": reply_to_message_id,
}
text = self.html_text if (self.text or self.caption) else None
@ -2956,6 +3154,7 @@ class Message(base.TelegramObject):
parse_mode: typing.Optional[base.String] = None,
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
disable_notification: typing.Optional[base.Boolean] = None,
protect_content: typing.Optional[base.Boolean] = None,
reply_to_message_id: typing.Optional[base.Integer] = None,
allow_sending_without_reply: typing.Optional[base.Boolean] = None,
reply_markup: typing.Union[InlineKeyboardMarkup,
@ -2971,6 +3170,7 @@ class Message(base.TelegramObject):
parse_mode=parse_mode,
caption_entities=caption_entities,
disable_notification=disable_notification,
protect_content=protect_content,
reply_to_message_id=reply_to_message_id,
allow_sending_without_reply=allow_sending_without_reply,
reply_markup=reply_markup

View file

@ -77,6 +77,9 @@ class MessageEntity(base.TelegramObject):
if self.type == MessageEntityType.ITALIC:
method = markdown.hitalic if as_html else markdown.italic
return method(entity_text)
if self.type == MessageEntityType.SPOILER:
method = markdown.spoiler if as_html else markdown.hspoiler
return method(entity_text)
if self.type == MessageEntityType.PRE:
method = markdown.hpre if as_html else markdown.pre
return method(entity_text)
@ -108,10 +111,11 @@ class MessageEntityType(helper.Helper):
:key: PHONE_NUMBER
:key: BOLD
:key: ITALIC
:key: CODE
:key: PRE
:key: UNDERLINE
:key: STRIKETHROUGH
:key: SPOILER
:key: CODE
:key: PRE
:key: TEXT_LINK
:key: TEXT_MENTION
"""
@ -127,9 +131,10 @@ class MessageEntityType(helper.Helper):
PHONE_NUMBER = helper.Item() # phone_number
BOLD = helper.Item() # bold - bold text
ITALIC = helper.Item() # italic - italic text
CODE = helper.Item() # code - monowidth string
PRE = helper.Item() # pre - monowidth block
UNDERLINE = helper.Item() # underline
STRIKETHROUGH = helper.Item() # strikethrough
SPOILER = helper.Item() # spoiler
CODE = helper.Item() # code - monowidth string
PRE = helper.Item() # pre - monowidth block
TEXT_LINK = helper.Item() # text_link - for clickable text URLs
TEXT_MENTION = helper.Item() # text_mention - for users without usernames

View file

@ -7,10 +7,13 @@ MD_SYMBOLS = (
(LIST_MD_SYMBOLS[1], LIST_MD_SYMBOLS[1]),
(LIST_MD_SYMBOLS[2], LIST_MD_SYMBOLS[2]),
(LIST_MD_SYMBOLS[2] * 3 + "\n", "\n" + LIST_MD_SYMBOLS[2] * 3),
("||", "||"),
("<b>", "</b>"),
("<i>", "</i>"),
("<code>", "</code>"),
("<pre>", "</pre>"),
('<span class="tg-spoiler">', "</span>"),
("<tg-spoiler>", "</tg-spoiler>"),
)
HTML_QUOTES_MAP = {"<": "&lt;", ">": "&gt;", "&": "&amp;", '"': "&quot;"}
@ -113,6 +116,32 @@ def hitalic(*content, sep=" ") -> str:
)
def spoiler(*content, sep=" ") -> str:
"""
Make spoiler text (Markdown)
:param content:
:param sep:
:return:
"""
return markdown_decoration.spoiler(
value=markdown_decoration.quote(_join(*content, sep=sep))
)
def hspoiler(*content, sep=" ") -> str:
"""
Make spoiler text (HTML)
:param content:
:param sep:
:return:
"""
return html_decoration.spoiler(
value=html_decoration.quote(_join(*content, sep=sep))
)
def code(*content, sep=" ") -> str:
"""
Make mono-width text (Markdown)

View file

@ -27,9 +27,9 @@ class TextDecoration(ABC):
:return:
"""
if entity.type in {"bot_command", "url", "mention", "phone_number"}:
# This entities should not be changed
# These entities should not be changed
return text
if entity.type in {"bold", "italic", "code", "underline", "strikethrough"}:
if entity.type in {"bold", "italic", "spoiler", "code", "underline", "strikethrough"}:
return cast(str, getattr(self, entity.type)(value=text))
if entity.type == "pre":
return (
@ -115,6 +115,10 @@ class TextDecoration(ABC):
def italic(self, value: str) -> str: # pragma: no cover
pass
@abstractmethod
def spoiler(self, value: str) -> str: # pragma: no cover
pass
@abstractmethod
def code(self, value: str) -> str: # pragma: no cover
pass
@ -150,6 +154,9 @@ class HtmlDecoration(TextDecoration):
def italic(self, value: str) -> str:
return f"<i>{value}</i>"
def spoiler(self, value: str) -> str:
return f'<span class="tg-spoiler">{value}</span>'
def code(self, value: str) -> str:
return f"<code>{value}</code>"
@ -181,6 +188,9 @@ class MarkdownDecoration(TextDecoration):
def italic(self, value: str) -> str:
return f"_\r{value}_\r"
def spoiler(self, value: str) -> str:
return f"||{value}||"
def code(self, value: str) -> str:
return f"`{value}`"

View file

@ -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-5.5-blue.svg?style=flat-square&logo=telegram
.. image:: https://img.shields.io/badge/Telegram%20Bot%20API-5.6-blue.svg?style=flat-square&logo=telegram
:target: https://core.telegram.org/bots/api
:alt: Telegram Bot API