1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Fix commit

This commit is contained in:
_run 2022-01-02 14:58:15 +04:00
parent ed6fb57cb5
commit 034241ba31
2 changed files with 174 additions and 107 deletions

View File

@ -955,11 +955,11 @@ class TeleBot:
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
:param text: Text of the message to be sent
:param parse_mode: Mode for parsing entities in the message text.
:param entities: A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
:param entities: List of special entities that appear in message text, which can be specified instead of parse_mode
:param disable_web_page_preview: Disables link previews for links in this message
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:param protect_content: Protects the contents of the forwarded message from forwarding and saving
:param protect_content: If True, the message content will be hidden for all users except for the target user
:param reply_to_message_id: If the message is a reply, ID of the original message
:param allow_sending_without_reply: Pass True, if the message should be sent even if the specified replied-to message is not found
: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.
@ -1074,18 +1074,19 @@ class TeleBot:
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None,) -> types.Message:
"""
Use this method to send photos.
Use this method to send photos. On success, the sent Message is returned.
:param chat_id:
:param photo:
:param caption:
:param parse_mode:
:param caption_entities:
:param disable_notification:
:param protect_content:
:param reply_to_message_id:
:param allow_sending_without_reply:
:param reply_markup:
:param timeout:
:param caption_entities:
:param allow_sending_without_reply:
:return: API reply.
:return: Message
"""
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
@ -1224,13 +1225,14 @@ class TeleBot:
# TODO: Rewrite this method like in API.
def send_sticker(
self, chat_id: Union[int, str], data: Union[Any, str],
self, chat_id: Union[int, str], sticker: Union[Any, str],
reply_to_message_id: Optional[int]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None,
protect_content:Optional[bool]=None) -> types.Message:
protect_content:Optional[bool]=None,
data: Union[Any, str]=None) -> types.Message:
"""
Use this method to send .webp stickers.
:param chat_id:
@ -1241,8 +1243,12 @@ class TeleBot:
:param timeout: timeout
:param allow_sending_without_reply:
:param protect_content:
:param data: function typo miss compatibility: do not use it
:return: API reply.
"""
if data and not(sticker):
# function typo miss compatibility
sticker = data
return types.Message.de_json(
apihelper.send_data(
self.token, chat_id, data, 'sticker',
@ -1251,7 +1257,7 @@ class TeleBot:
allow_sending_without_reply=allow_sending_without_reply, protect_content=protect_content))
def send_video(
self, chat_id: Union[int, str], data: Union[Any, str],
self, chat_id: Union[int, str], video: Union[Any, str],
duration: Optional[int]=None,
width: Optional[int]=None,
height: Optional[int]=None,
@ -1265,32 +1271,36 @@ class TeleBot:
reply_to_message_id: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None,) -> types.Message:
timeout: Optional[int]=None,
data: Optional[Union[Any, str]]=None) -> types.Message:
"""
Use this method to send video files, Telegram clients support mp4 videos.
:param chat_id: Integer : Unique identifier for the message recipient User or GroupChat id
:param data: InputFile or String : Video to send. You can either pass a file_id as String to resend
a video that is already on the Telegram server
:param duration: Integer : Duration of sent video in seconds
:param caption: String : Video caption (may also be used when resending videos by file_id).
:param parse_mode:
:param supports_streaming:
:param reply_to_message_id:
:param reply_markup:
:param disable_notification:
:param timeout:
:param thumb: InputFile or String : Thumbnail of the file sent
:param width:
:param height:
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
:param video: Video to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.
:param duration: Duration of sent video in seconds
:param width: Video width
:param height: Video height
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
:param caption: Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the video caption
:param caption_entities:
:param supports_streaming: Pass True, if the uploaded video is suitable for streaming
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:param protect_content:
:param reply_to_message_id: If the message is a reply, ID of the original message
:param allow_sending_without_reply:
:return:
:param reply_markup:
:param timeout:
:param data: function typo miss compatibility: do not use it
"""
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
if data and not(video):
# function typo miss compatibility
video = data
return types.Message.de_json(
apihelper.send_video(
self.token, chat_id, data, duration, caption, reply_to_message_id, reply_markup,
self.token, chat_id, video, duration, caption, reply_to_message_id, reply_markup,
parse_mode, supports_streaming, disable_notification, timeout, thumb, width, height,
caption_entities, allow_sending_without_reply, protect_content))

View File

@ -1484,16 +1484,19 @@ class AsyncTeleBot:
result = await asyncio_helper.get_chat_member(self.token, chat_id, user_id)
return types.ChatMember.de_json(result)
async def send_message(
self, chat_id: Union[int, str], text: str,
disable_web_page_preview: Optional[bool]=None,
reply_to_message_id: Optional[int]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
parse_mode: Optional[str]=None,
disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: Optional[bool]=None) -> types.Message:
disable_web_page_preview: Optional[bool]=None,
disable_notification: Optional[bool]=None,
protect_content: Optional[bool]=None,
reply_to_message_id: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None) -> types.Message:
"""
Use this method to send text messages.
@ -1511,6 +1514,7 @@ class AsyncTeleBot:
:param timeout:
:param entities:
:param allow_sending_without_reply:
:param protect_content:
:return: API reply.
"""
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
@ -1519,11 +1523,12 @@ class AsyncTeleBot:
await asyncio_helper.send_message(
self.token, chat_id, text, disable_web_page_preview, reply_to_message_id,
reply_markup, parse_mode, disable_notification, timeout,
entities, allow_sending_without_reply))
entities, allow_sending_without_reply, protect_content))
async def forward_message(
self, chat_id: Union[int, str], from_chat_id: Union[int, str],
message_id: int, disable_notification: Optional[bool]=None,
message_id: int, disable_notification: Optional[bool]=None,
protect_content: Optional[bool]=None,
timeout: Optional[int]=None) -> types.Message:
"""
Use this method to forward messages of any kind.
@ -1531,11 +1536,12 @@ class AsyncTeleBot:
:param chat_id: which chat to forward
:param from_chat_id: which chat message from
:param message_id: message id
:param protect_content:
:param timeout:
:return: API reply.
"""
return types.Message.de_json(
await asyncio_helper.forward_message(self.token, chat_id, from_chat_id, message_id, disable_notification, timeout))
await asyncio_helper.forward_message(self.token, chat_id, from_chat_id, message_id, disable_notification, timeout, protect_content))
async def copy_message(
self, chat_id: Union[int, str],
@ -1545,6 +1551,7 @@ class AsyncTeleBot:
parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
disable_notification: Optional[bool]=None,
protect_content: Optional[bool]=None,
reply_to_message_id: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
@ -1562,12 +1569,13 @@ class AsyncTeleBot:
:param allow_sending_without_reply:
:param reply_markup:
:param timeout:
:param protect_content:
:return: API reply.
"""
return types.MessageID.de_json(
await asyncio_helper.copy_message(self.token, chat_id, from_chat_id, message_id, caption, parse_mode, caption_entities,
disable_notification, reply_to_message_id, allow_sending_without_reply, reply_markup,
timeout))
timeout, protect_content))
async def delete_message(self, chat_id: Union[int, str], message_id: int,
timeout: Optional[int]=None) -> bool:
@ -1586,7 +1594,8 @@ class AsyncTeleBot:
reply_to_message_id: Optional[int]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None) -> types.Message:
allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None) -> types.Message:
"""
Use this method to send dices.
:param chat_id:
@ -1596,22 +1605,25 @@ class AsyncTeleBot:
:param reply_markup:
:param timeout:
:param allow_sending_without_reply:
:param protect_content:
:return: Message
"""
return types.Message.de_json(
await asyncio_helper.send_dice(
self.token, chat_id, emoji, disable_notification, reply_to_message_id,
reply_markup, timeout, allow_sending_without_reply)
reply_markup, timeout, allow_sending_without_reply, protect_content)
)
async def send_photo(
self, chat_id: Union[int, str], photo: Union[Any, str],
caption: Optional[str]=None, reply_to_message_id: Optional[int]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
parse_mode: Optional[str]=None, disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
caption: Optional[str]=None, parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: Optional[bool]=None) -> types.Message:
disable_notification: Optional[bool]=None,
protect_content: Optional[bool]=None,
reply_to_message_id: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None,) -> types.Message:
"""
Use this method to send photos.
:param chat_id:
@ -1624,6 +1636,7 @@ class AsyncTeleBot:
:param timeout:
:param caption_entities:
:param allow_sending_without_reply:
:param protect_content:
:return: API reply.
"""
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
@ -1632,7 +1645,7 @@ class AsyncTeleBot:
await asyncio_helper.send_photo(
self.token, chat_id, photo, caption, reply_to_message_id, reply_markup,
parse_mode, disable_notification, timeout, caption_entities,
allow_sending_without_reply))
allow_sending_without_reply, protect_content))
async def send_audio(
self, chat_id: Union[int, str], audio: Union[Any, str],
@ -1645,7 +1658,8 @@ class AsyncTeleBot:
timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: Optional[bool]=None) -> types.Message:
allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None) -> types.Message:
"""
Use this method to send audio files, if you want Telegram clients to display them in the music player.
Your audio must be in the .mp3 format.
@ -1663,6 +1677,7 @@ class AsyncTeleBot:
:param thumb:
:param caption_entities:
:param allow_sending_without_reply:
:param protect_content:
:return: Message
"""
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
@ -1671,7 +1686,7 @@ class AsyncTeleBot:
await asyncio_helper.send_audio(
self.token, chat_id, audio, caption, duration, performer, title, reply_to_message_id,
reply_markup, parse_mode, disable_notification, timeout, thumb,
caption_entities, allow_sending_without_reply))
caption_entities, allow_sending_without_reply, protect_content))
async def send_voice(
self, chat_id: Union[int, str], voice: Union[Any, str],
@ -1682,7 +1697,8 @@ class AsyncTeleBot:
disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: Optional[bool]=None) -> types.Message:
allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None) -> types.Message:
"""
Use this method to send audio files, if you want Telegram clients to display the file
as a playable voice message.
@ -1697,6 +1713,7 @@ class AsyncTeleBot:
:param timeout:
:param caption_entities:
:param allow_sending_without_reply:
:param protect_content:
:return: Message
"""
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
@ -1705,7 +1722,7 @@ class AsyncTeleBot:
await asyncio_helper.send_voice(
self.token, chat_id, voice, caption, duration, reply_to_message_id, reply_markup,
parse_mode, disable_notification, timeout, caption_entities,
allow_sending_without_reply))
allow_sending_without_reply, protect_content))
async def send_document(
self, chat_id: Union[int, str], document: Union[Any, str],
@ -1720,7 +1737,8 @@ class AsyncTeleBot:
allow_sending_without_reply: Optional[bool]=None,
visible_file_name: Optional[str]=None,
disable_content_type_detection: Optional[bool]=None,
data: Optional[Union[Any, str]]=None) -> types.Message:
data: Optional[Union[Any, str]]=None,
protect_content: Optional[bool]=None) -> types.Message:
"""
Use this method to send general files.
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
@ -1737,6 +1755,7 @@ class AsyncTeleBot:
:param visible_file_name: allows to async define file name that will be visible in the Telegram instead of original file name
:param disable_content_type_detection: Disables automatic server-side content type detection for files uploaded using multipart/form-data
:param data: function typo compatibility: do not use it
:param protect_content:
:return: API reply.
"""
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
@ -1750,7 +1769,7 @@ class AsyncTeleBot:
reply_to_message_id = reply_to_message_id, reply_markup = reply_markup, parse_mode = parse_mode,
disable_notification = disable_notification, timeout = timeout, caption = caption, thumb = thumb,
caption_entities = caption_entities, allow_sending_without_reply = allow_sending_without_reply,
disable_content_type_detection = disable_content_type_detection, visible_file_name = visible_file_name))
disable_content_type_detection = disable_content_type_detection, visible_file_name = visible_file_name, protect_content = protect_content))
async def send_sticker(
self, chat_id: Union[int, str], data: Union[Any, str],
@ -1758,7 +1777,8 @@ class AsyncTeleBot:
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None) -> types.Message:
allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None) -> types.Message:
"""
Use this method to send .webp stickers.
:param chat_id:
@ -1768,6 +1788,7 @@ class AsyncTeleBot:
:param disable_notification: to disable the notification
:param timeout: timeout
:param allow_sending_without_reply:
:param protect_content:
:return: API reply.
"""
return types.Message.de_json(
@ -1775,42 +1796,44 @@ class AsyncTeleBot:
self.token, chat_id, data, 'sticker',
reply_to_message_id=reply_to_message_id, reply_markup=reply_markup,
disable_notification=disable_notification, timeout=timeout,
allow_sending_without_reply=allow_sending_without_reply))
allow_sending_without_reply=allow_sending_without_reply, protect_content=protect_content))
async def send_video(
self, chat_id: Union[int, str], data: Union[Any, str],
duration: Optional[int]=None,
caption: Optional[str]=None,
reply_to_message_id: Optional[int]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
parse_mode: Optional[str]=None,
supports_streaming: Optional[bool]=None,
disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
width: Optional[int]=None,
self, chat_id: Union[int, str], video: Union[Any, str],
duration: Optional[int]=None,
width: Optional[int]=None,
height: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
caption: Optional[str]=None,
parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: Optional[bool]=None) -> types.Message:
supports_streaming: Optional[bool]=None,
disable_notification: Optional[bool]=None,
protect_content: Optional[bool]=None,
reply_to_message_id: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None,
data: Optional[Union[Any, str]]=None) -> types.Message:
"""
Use this method to send video files, Telegram clients support mp4 videos.
:param chat_id: Integer : Unique identifier for the message recipient User or GroupChat id
:param data: InputFile or String : Video to send. You can either pass a file_id as String to resend
a video that is already on the Telegram server
:param duration: Integer : Duration of sent video in seconds
:param caption: String : Video caption (may also be used when resending videos by file_id).
:param parse_mode:
:param supports_streaming:
:param reply_to_message_id:
:param reply_markup:
:param disable_notification:
:param timeout:
:param thumb: InputFile or String : Thumbnail of the file sent
:param width:
:param height:
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
:param video: Video to send. You can either pass a file_id as String to resend a video that is already on the Telegram servers, or upload a new video file using multipart/form-data.
:param duration: Duration of sent video in seconds
:param width: Video width
:param height: Video height
:param thumb: Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass attach://<file_attach_name> if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
:param caption: Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
:param parse_mode: Mode for parsing entities in the video caption
:param caption_entities:
:param supports_streaming: Pass True, if the uploaded video is suitable for streaming
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
:param protect_content:
:param reply_to_message_id: If the message is a reply, ID of the original message
:param allow_sending_without_reply:
:return:
:param reply_markup:
:param timeout:
:param data: function typo miss compatibility: do not use it
"""
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
@ -1818,33 +1841,38 @@ class AsyncTeleBot:
await asyncio_helper.send_video(
self.token, chat_id, data, duration, caption, reply_to_message_id, reply_markup,
parse_mode, supports_streaming, disable_notification, timeout, thumb, width, height,
caption_entities, allow_sending_without_reply))
caption_entities, allow_sending_without_reply, protect_content))
async def send_animation(
self, chat_id: Union[int, str], animation: Union[Any, str],
duration: Optional[int]=None,
caption: Optional[str]=None,
reply_to_message_id: Optional[int]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
parse_mode: Optional[str]=None,
disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
width: Optional[int]=None,
height: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
caption: Optional[str]=None,
parse_mode: Optional[str]=None,
caption_entities: Optional[List[types.MessageEntity]]=None,
allow_sending_without_reply: Optional[bool]=None) -> types.Message:
disable_notification: Optional[bool]=None,
protect_content: Optional[bool]=None,
reply_to_message_id: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None, ) -> types.Message:
"""
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
:param chat_id: Integer : Unique identifier for the message recipient User or GroupChat id
:param animation: InputFile or String : Animation to send. You can either pass a file_id as String to resend an
animation that is already on the Telegram server
:param duration: Integer : Duration of sent video in seconds
:param width: Integer : Video width
:param height: Integer : Video height
:param thumb: InputFile or String : Thumbnail of the file sent
:param caption: String : Animation caption (may also be used when resending animation by file_id).
:param parse_mode:
:param reply_to_message_id:
:param reply_markup:
:param disable_notification:
:param timeout:
:param thumb: InputFile or String : Thumbnail of the file sent
:param caption_entities:
:param allow_sending_without_reply:
:return:
@ -1855,7 +1883,7 @@ class AsyncTeleBot:
await asyncio_helper.send_animation(
self.token, chat_id, animation, duration, caption, reply_to_message_id,
reply_markup, parse_mode, disable_notification, timeout, thumb,
caption_entities, allow_sending_without_reply))
caption_entities, allow_sending_without_reply, width, height, protect_content))
async def send_video_note(
self, chat_id: Union[int, str], data: Union[Any, str],
@ -1866,7 +1894,8 @@ class AsyncTeleBot:
disable_notification: Optional[bool]=None,
timeout: Optional[int]=None,
thumb: Optional[Union[Any, str]]=None,
allow_sending_without_reply: Optional[bool]=None) -> types.Message:
allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=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.
@ -1881,12 +1910,13 @@ class AsyncTeleBot:
:param timeout:
:param thumb: InputFile or String : Thumbnail of the file sent
:param allow_sending_without_reply:
:param protect_content:
:return:
"""
return types.Message.de_json(
await asyncio_helper.send_video_note(
self.token, chat_id, data, duration, length, reply_to_message_id, reply_markup,
disable_notification, timeout, thumb, allow_sending_without_reply))
disable_notification, timeout, thumb, allow_sending_without_reply, protect_content))
async def send_media_group(
self, chat_id: Union[int, str],
@ -1894,6 +1924,7 @@ class AsyncTeleBot:
types.InputMediaAudio, types.InputMediaDocument,
types.InputMediaPhoto, types.InputMediaVideo]],
disable_notification: Optional[bool]=None,
protect_content: Optional[bool]=None,
reply_to_message_id: Optional[int]=None,
timeout: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None) -> List[types.Message]:
@ -1905,11 +1936,12 @@ class AsyncTeleBot:
:param reply_to_message_id:
:param timeout:
:param allow_sending_without_reply:
:param protect_content:
:return:
"""
result = await asyncio_helper.send_media_group(
self.token, chat_id, media, disable_notification, reply_to_message_id, timeout,
allow_sending_without_reply)
allow_sending_without_reply, protect_content)
return [types.Message.de_json(msg) for msg in result]
async def send_location(
@ -1923,7 +1955,8 @@ class AsyncTeleBot:
horizontal_accuracy: Optional[float]=None,
heading: Optional[int]=None,
proximity_alert_radius: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None) -> types.Message:
allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None) -> types.Message:
"""
@ -1940,6 +1973,7 @@ class AsyncTeleBot:
:param heading:
:param proximity_alert_radius:
:param allow_sending_without_reply:
:param protect_content:
:return: API reply.
"""
return types.Message.de_json(
@ -1947,7 +1981,7 @@ class AsyncTeleBot:
self.token, chat_id, latitude, longitude, live_period,
reply_to_message_id, reply_markup, disable_notification, timeout,
horizontal_accuracy, heading, proximity_alert_radius,
allow_sending_without_reply))
allow_sending_without_reply, protect_content))
async def edit_message_live_location(
self, latitude: float, longitude: float,
@ -2011,7 +2045,8 @@ class AsyncTeleBot:
timeout: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None,
google_place_id: Optional[str]=None,
google_place_type: Optional[str]=None) -> types.Message:
google_place_type: Optional[str]=None,
protect_content: Optional[bool]=None) -> types.Message:
"""
Use this method to send information about a venue.
:param chat_id: Integer or String : Unique identifier for the target chat or username of the target channel
@ -2029,13 +2064,14 @@ class AsyncTeleBot:
:param allow_sending_without_reply:
:param google_place_id:
:param google_place_type:
:param protect_content:
:return:
"""
return types.Message.de_json(
await asyncio_helper.send_venue(
self.token, chat_id, latitude, longitude, title, address, foursquare_id, foursquare_type,
disable_notification, reply_to_message_id, reply_markup, timeout,
allow_sending_without_reply, google_place_id, google_place_type)
allow_sending_without_reply, google_place_id, google_place_type, protect_content)
)
async def send_contact(
@ -2046,12 +2082,27 @@ class AsyncTeleBot:
reply_to_message_id: Optional[int]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None) -> types.Message:
allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None) -> types.Message:
"""
Use this method to send phone contacts.
:param chat_id: Integer or String : Unique identifier for the target chat or username of the target channel
:param phone_number: String : Contact's phone number
:param first_name: String : Contact's first name
:param last_name: String : Contact's last name
:param vcard: String : Additional data about the contact in the form of a vCard, 0-2048 bytes
:param disable_notification:
:param reply_to_message_id:
:param reply_markup:
:param timeout:
:param allow_sending_without_reply:
:param protect_content:
"""
return types.Message.de_json(
await asyncio_helper.send_contact(
self.token, chat_id, phone_number, first_name, last_name, vcard,
disable_notification, reply_to_message_id, reply_markup, timeout,
allow_sending_without_reply)
allow_sending_without_reply, protect_content)
)
async def send_chat_action(
@ -2576,7 +2627,8 @@ class AsyncTeleBot:
reply_to_message_id: Optional[int]=None,
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
timeout: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None) -> types.Message:
allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None) -> types.Message:
"""
Used to send the game
:param chat_id:
@ -2586,12 +2638,13 @@ class AsyncTeleBot:
:param reply_markup:
:param timeout:
:param allow_sending_without_reply:
:param protect_content:
:return:
"""
result = await asyncio_helper.send_game(
self.token, chat_id, game_short_name, disable_notification,
reply_to_message_id, reply_markup, timeout,
allow_sending_without_reply)
allow_sending_without_reply, protect_content)
return types.Message.de_json(result)
async def set_game_score(
@ -2651,7 +2704,8 @@ class AsyncTeleBot:
timeout: Optional[int]=None,
allow_sending_without_reply: Optional[bool]=None,
max_tip_amount: Optional[int] = None,
suggested_tip_amounts: Optional[List[int]]=None) -> types.Message:
suggested_tip_amounts: Optional[List[int]]=None,
protect_content: Optional[bool]=None) -> types.Message:
"""
Sends invoice
:param chat_id: Unique identifier for the target private chat
@ -2690,6 +2744,7 @@ class AsyncTeleBot:
:param suggested_tip_amounts: A JSON-serialized array of suggested amounts of tips in the smallest
units of the currency. At most 4 suggested tip amounts can be specified. The suggested tip
amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
:param protect_content:
:return:
"""
result = await asyncio_helper.send_invoice(
@ -2698,7 +2753,7 @@ class AsyncTeleBot:
photo_height, need_name, need_phone_number, need_email, need_shipping_address,
send_phone_number_to_provider, send_email_to_provider, is_flexible, disable_notification,
reply_to_message_id, reply_markup, provider_data, timeout, allow_sending_without_reply,
max_tip_amount, suggested_tip_amounts)
max_tip_amount, suggested_tip_amounts, protect_content)
return types.Message.de_json(result)
# noinspection PyShadowingBuiltins
@ -2717,7 +2772,8 @@ class AsyncTeleBot:
reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
allow_sending_without_reply: Optional[bool]=None,
timeout: Optional[int]=None,
explanation_entities: Optional[List[types.MessageEntity]]=None) -> types.Message:
explanation_entities: Optional[List[types.MessageEntity]]=None,
protect_content: Optional[bool]=None) -> types.Message:
"""
Send polls
:param chat_id:
@ -2738,6 +2794,7 @@ class AsyncTeleBot:
:param reply_markup:
:param timeout:
:param explanation_entities:
:param protect_content:
:return:
"""
@ -2751,7 +2808,7 @@ class AsyncTeleBot:
is_anonymous, type, allows_multiple_answers, correct_option_id,
explanation, explanation_parse_mode, open_period, close_date, is_closed,
disable_notification, reply_to_message_id, allow_sending_without_reply,
reply_markup, timeout, explanation_entities))
reply_markup, timeout, explanation_entities, protect_content))
async def stop_poll(
self, chat_id: Union[int, str], message_id: int,