mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-22 14:35:00 +01:00
Support v3.6 API (#1006)
* Added support for new field `telegram.Message.connected_message` * Added support for new field `telegram.Message.connected_message` * Added support for parse_mode in captions * Added parse_mode parameter for captions in InlineQueryResult* * Added supports_streaming parameter in telegram.Bot.send_video and telegram.InputMediaVideo Fixed Docstrings for parse_mode in captions * pypy3.5 unitests are now running with a new version due internal errors on travis. closes #1005
This commit is contained in:
parent
9338dc4697
commit
c152d6583e
44 changed files with 379 additions and 30 deletions
|
@ -5,7 +5,7 @@ python:
|
|||
- "3.5"
|
||||
- "3.6"
|
||||
- "pypy-5.7.1"
|
||||
- "pypy3.5-5.8.0"
|
||||
- "pypy3.5-5.10.0"
|
||||
|
||||
dist: trusty
|
||||
sudo: false
|
||||
|
@ -35,4 +35,4 @@ script:
|
|||
|
||||
after_success:
|
||||
- coverage combine
|
||||
- codecov -F Travis
|
||||
- codecov -F Travis
|
||||
|
|
|
@ -339,6 +339,7 @@ class Bot(TelegramObject):
|
|||
reply_to_message_id=None,
|
||||
reply_markup=None,
|
||||
timeout=20,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
"""Use this method to send photos.
|
||||
|
||||
|
@ -356,6 +357,9 @@ class Bot(TelegramObject):
|
|||
an existing :class:`telegram.PhotoSize` object to send.
|
||||
caption (:obj:`str`, optional): Photo caption (may also be used when resending photos
|
||||
by file_id), 0-200 characters.
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to
|
||||
show bold, italic, fixed-width text or inline URLs in the media caption. See the
|
||||
constants in :class:`telegram.ParseMode` for the available modes.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
|
@ -382,6 +386,8 @@ class Bot(TelegramObject):
|
|||
|
||||
if caption:
|
||||
data['caption'] = caption
|
||||
if parse_mode:
|
||||
data['parse_mode'] = parse_mode
|
||||
|
||||
return url, data
|
||||
|
||||
|
@ -398,6 +404,7 @@ class Bot(TelegramObject):
|
|||
reply_to_message_id=None,
|
||||
reply_markup=None,
|
||||
timeout=20,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
"""
|
||||
Use this method to send audio files, if you want Telegram clients to display them in the
|
||||
|
@ -420,6 +427,9 @@ class Bot(TelegramObject):
|
|||
the Internet, or upload a new one using multipart/form-data. Lastly you can pass
|
||||
an existing :class:`telegram.Audio` object to send.
|
||||
caption (:obj:`str`, optional): Audio caption, 0-200 characters.
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to
|
||||
show bold, italic, fixed-width text or inline URLs in the media caption. See the
|
||||
constants in :class:`telegram.ParseMode` for the available modes.
|
||||
duration (:obj:`int`, optional): Duration of sent audio in seconds.
|
||||
performer (:obj:`str`, optional): Performer.
|
||||
title (:obj:`str`, optional): Track name.
|
||||
|
@ -455,6 +465,8 @@ class Bot(TelegramObject):
|
|||
data['title'] = title
|
||||
if caption:
|
||||
data['caption'] = caption
|
||||
if parse_mode:
|
||||
data['parse_mode'] = parse_mode
|
||||
|
||||
return url, data
|
||||
|
||||
|
@ -469,6 +481,7 @@ class Bot(TelegramObject):
|
|||
reply_to_message_id=None,
|
||||
reply_markup=None,
|
||||
timeout=20,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
"""Use this method to send general files.
|
||||
|
||||
|
@ -488,6 +501,9 @@ class Bot(TelegramObject):
|
|||
when you send file generated by temp module, for example). Undocumented.
|
||||
caption (:obj:`str`, optional): Document caption (may also be used when resending
|
||||
documents by file_id), 0-200 characters.
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to
|
||||
show bold, italic, fixed-width text or inline URLs in the media caption. See the
|
||||
constants in :class:`telegram.ParseMode` for the available modes.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
|
@ -516,6 +532,8 @@ class Bot(TelegramObject):
|
|||
data['filename'] = filename
|
||||
if caption:
|
||||
data['caption'] = caption
|
||||
if parse_mode:
|
||||
data['parse_mode'] = parse_mode
|
||||
|
||||
return url, data
|
||||
|
||||
|
@ -582,6 +600,8 @@ class Bot(TelegramObject):
|
|||
timeout=20,
|
||||
width=None,
|
||||
height=None,
|
||||
parse_mode=None,
|
||||
supports_streaming=None,
|
||||
**kwargs):
|
||||
"""
|
||||
Use this method to send video files, Telegram clients support mp4 videos
|
||||
|
@ -604,6 +624,11 @@ class Bot(TelegramObject):
|
|||
height (:obj:`int`, optional): Video height.
|
||||
caption (:obj:`str`, optional): Video caption (may also be used when resending videos
|
||||
by file_id), 0-200 characters.
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to
|
||||
show bold, italic, fixed-width text or inline URLs in the media caption. See the
|
||||
constants in :class:`telegram.ParseMode` for the available modes.
|
||||
supports_streaming (:obj:`bool`, optional): Pass True, if the uploaded video is
|
||||
suitable for streaming.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
|
@ -632,6 +657,10 @@ class Bot(TelegramObject):
|
|||
data['duration'] = duration
|
||||
if caption:
|
||||
data['caption'] = caption
|
||||
if parse_mode:
|
||||
data['parse_mode'] = parse_mode
|
||||
if supports_streaming:
|
||||
data['supports_streaming'] = supports_streaming
|
||||
if width:
|
||||
data['width'] = width
|
||||
if height:
|
||||
|
@ -650,6 +679,7 @@ class Bot(TelegramObject):
|
|||
reply_to_message_id=None,
|
||||
reply_markup=None,
|
||||
timeout=20,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
"""
|
||||
Use this method to send audio files, if you want Telegram clients to display the file
|
||||
|
@ -669,6 +699,9 @@ class Bot(TelegramObject):
|
|||
the Internet, or upload a new one using multipart/form-data. Lastly you can pass
|
||||
an existing :class:`telegram.Voice` object to send.
|
||||
caption (:obj:`str`, optional): Voice message caption, 0-200 characters.
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to
|
||||
show bold, italic, fixed-width text or inline URLs in the media caption. See the
|
||||
constants in :class:`telegram.ParseMode` for the available modes.
|
||||
duration (:obj:`int`, optional): Duration of the voice message in seconds.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
|
@ -698,6 +731,8 @@ class Bot(TelegramObject):
|
|||
data['duration'] = duration
|
||||
if caption:
|
||||
data['caption'] = caption
|
||||
if parse_mode:
|
||||
data['parse_mode'] = parse_mode
|
||||
|
||||
return url, data
|
||||
|
||||
|
@ -1504,6 +1539,8 @@ class Bot(TelegramObject):
|
|||
parse_mode (:obj:`str`): Send Markdown or HTML, if you want Telegram apps to show bold,
|
||||
italic, fixed-width text or inline URLs in your bot's message. See the constants in
|
||||
:class:`telegram.ParseMode` for the available modes.
|
||||
disable_web_page_preview (:obj:`bool`, optional): Disables link previews for links in
|
||||
this message.
|
||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): 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.
|
||||
|
@ -1546,6 +1583,7 @@ class Bot(TelegramObject):
|
|||
caption=None,
|
||||
reply_markup=None,
|
||||
timeout=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
"""
|
||||
Use this method to edit captions of messages sent by the bot or via the bot
|
||||
|
@ -1559,6 +1597,9 @@ class Bot(TelegramObject):
|
|||
inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not
|
||||
specified. Identifier of the inline message.
|
||||
caption (:obj:`str`, optional): New caption of the message.
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to
|
||||
show bold, italic, fixed-width text or inline URLs in the media caption. See the
|
||||
constants in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.ReplyMarkup`, optional): 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.
|
||||
|
@ -1586,6 +1627,8 @@ class Bot(TelegramObject):
|
|||
|
||||
if caption:
|
||||
data['caption'] = caption
|
||||
if parse_mode:
|
||||
data['parse_mode'] = parse_mode
|
||||
if chat_id:
|
||||
data['chat_id'] = chat_id
|
||||
if message_id:
|
||||
|
|
|
@ -346,13 +346,23 @@ class Filters(object):
|
|||
pinned_message = _PinnedMessage()
|
||||
""":obj:`Filter`: Messages that contain :attr:`telegram.Message.pinned_message`."""
|
||||
|
||||
class _ConnectedWebsite(BaseFilter):
|
||||
name = 'Filters.status_update.connected_website'
|
||||
|
||||
def filter(self, message):
|
||||
return bool(message.connected_website)
|
||||
|
||||
connected_website = _ConnectedWebsite()
|
||||
""":obj:`Filter`: Messages that contain :attr:`telegram.Message.connected_website`."""
|
||||
|
||||
name = 'Filters.status_update'
|
||||
|
||||
def filter(self, message):
|
||||
return bool(self.new_chat_members(message) or self.left_chat_member(message) or
|
||||
self.new_chat_title(message) or self.new_chat_photo(message) or
|
||||
self.delete_chat_photo(message) or self.chat_created(message) or
|
||||
self.migrate(message) or self.pinned_message(message))
|
||||
self.migrate(message) or self.pinned_message(message) or
|
||||
self.connected_website(message))
|
||||
|
||||
status_update = _StatusUpdate()
|
||||
"""Subset for messages containing a status update.
|
||||
|
|
|
@ -29,12 +29,18 @@ class InputMediaPhoto(InputMedia):
|
|||
Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the
|
||||
Internet. Lastly you can pass an existing :class:`telegram.PhotoSize` object to send.
|
||||
caption (:obj:`str`): Optional. Caption of the photo to be sent, 0-200 characters.
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
|
||||
Args:
|
||||
media (:obj:`str`): File to send. Pass a file_id to send a file that exists on the
|
||||
Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the
|
||||
Internet. Lastly you can pass an existing :class:`telegram.PhotoSize` object to send.
|
||||
caption (:obj:`str`, optional ): Caption of the photo to be sent, 0-200 characters.
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
|
||||
Note:
|
||||
At the moment using a new file is not yet supported.
|
||||
|
@ -42,7 +48,7 @@ class InputMediaPhoto(InputMedia):
|
|||
|
||||
# TODO: Make InputMediaPhoto, InputMediaVideo and send_media_group work with new files
|
||||
|
||||
def __init__(self, media, caption=None):
|
||||
def __init__(self, media, caption=None, parse_mode=None):
|
||||
self.type = 'photo'
|
||||
|
||||
if isinstance(media, PhotoSize):
|
||||
|
@ -55,3 +61,5 @@ class InputMediaPhoto(InputMedia):
|
|||
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
|
|
|
@ -29,18 +29,28 @@ class InputMediaVideo(InputMedia):
|
|||
servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet.
|
||||
Lastly you can pass an existing :class:`telegram.Video` object to send.
|
||||
caption (:obj:`str`): Optional. Caption of the video to be sent, 0-200 characters.
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
width (:obj:`int`): Optional. Video width.
|
||||
height (:obj:`int`): Optional. Video height.
|
||||
duration (:obj:`int`): Optional. Video duration.
|
||||
supports_streaming (:obj:`bool`): Optional. Pass True, if the uploaded video is suitable
|
||||
for streaming.
|
||||
|
||||
Args:
|
||||
media (:obj:`str`): File to send. Pass a file_id to send a file that exists on the Telegram
|
||||
servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet.
|
||||
Lastly you can pass an existing :class:`telegram.Video` object to send.
|
||||
caption (:obj:`str`, optional): Caption of the video to be sent, 0-200 characters.
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
width (:obj:`int`, optional): Video width.
|
||||
height (:obj:`int`, optional): Video height.
|
||||
duration (:obj:`int`, optional): Video duration.
|
||||
supports_streaming (:obj:`bool`, optional): Pass True, if the uploaded video is suitable
|
||||
for streaming.
|
||||
|
||||
Note:
|
||||
When using a :class:`telegram.Video` for the :attr:`media` attribute. It will take the
|
||||
|
@ -51,7 +61,8 @@ class InputMediaVideo(InputMedia):
|
|||
|
||||
# TODO: Make InputMediaPhoto, InputMediaVideo and send_media_group work with new files
|
||||
|
||||
def __init__(self, media, caption=None, width=None, height=None, duration=None):
|
||||
def __init__(self, media, caption=None, width=None, height=None, duration=None,
|
||||
supports_streaming=None, parse_mode=None):
|
||||
self.type = 'video'
|
||||
|
||||
if isinstance(media, Video):
|
||||
|
@ -66,9 +77,13 @@ class InputMediaVideo(InputMedia):
|
|||
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if width:
|
||||
self.width = width
|
||||
if height:
|
||||
self.height = height
|
||||
if duration:
|
||||
self.duration = duration
|
||||
if supports_streaming:
|
||||
self.supports_streaming = supports_streaming
|
||||
|
|
|
@ -35,6 +35,9 @@ class InlineQueryResultAudio(InlineQueryResult):
|
|||
performer (:obj:`str`): Optional. Caption, 0-200 characters.
|
||||
audio_duration (:obj:`str`): Optional. Performer.
|
||||
caption (:obj:`str`): Optional. Audio duration in seconds.
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
|
||||
|
@ -47,6 +50,9 @@ class InlineQueryResultAudio(InlineQueryResult):
|
|||
performer (:obj:`str`, optional): Caption, 0-200 characters.
|
||||
audio_duration (:obj:`str`, optional): Performer.
|
||||
caption (:obj:`str`, optional): Audio duration in seconds.
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
|
||||
|
@ -64,6 +70,7 @@ class InlineQueryResultAudio(InlineQueryResult):
|
|||
caption=None,
|
||||
reply_markup=None,
|
||||
input_message_content=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
|
||||
# Required
|
||||
|
@ -78,6 +85,8 @@ class InlineQueryResultAudio(InlineQueryResult):
|
|||
self.audio_duration = audio_duration
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if reply_markup:
|
||||
self.reply_markup = reply_markup
|
||||
if input_message_content:
|
||||
|
|
|
@ -32,6 +32,9 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
|
|||
id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
|
||||
audio_file_id (:obj:`str`): A valid file identifier for the audio file.
|
||||
caption (:obj:`str`): Optional. Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
|
||||
|
@ -41,6 +44,9 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
|
|||
id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
|
||||
audio_file_id (:obj:`str`): A valid file identifier for the audio file.
|
||||
caption (:obj:`str`, optional): Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
|
||||
|
@ -55,6 +61,7 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
|
|||
caption=None,
|
||||
reply_markup=None,
|
||||
input_message_content=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
# Required
|
||||
super(InlineQueryResultCachedAudio, self).__init__('audio', id)
|
||||
|
@ -63,6 +70,8 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
|
|||
# Optionals
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if reply_markup:
|
||||
self.reply_markup = reply_markup
|
||||
if input_message_content:
|
||||
|
|
|
@ -34,6 +34,9 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
|
|||
document_file_id (:obj:`str`): A valid file identifier for the file.
|
||||
description (:obj:`str`): Optional. Short description of the result.
|
||||
caption (:obj:`str`): Optional. Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
|
||||
|
@ -45,6 +48,9 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
|
|||
document_file_id (:obj:`str`): A valid file identifier for the file.
|
||||
description (:obj:`str`, optional): Short description of the result.
|
||||
caption (:obj:`str`, optional): Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
|
||||
|
@ -61,6 +67,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
|
|||
caption=None,
|
||||
reply_markup=None,
|
||||
input_message_content=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
# Required
|
||||
super(InlineQueryResultCachedDocument, self).__init__('document', id)
|
||||
|
@ -72,6 +79,8 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
|
|||
self.description = description
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if reply_markup:
|
||||
self.reply_markup = reply_markup
|
||||
if input_message_content:
|
||||
|
|
|
@ -34,6 +34,9 @@ class InlineQueryResultCachedGif(InlineQueryResult):
|
|||
gif_file_id (:obj:`str`): A valid file identifier for the GIF file.
|
||||
title (:obj:`str`): Optional. Title for the result.
|
||||
caption (:obj:`str`): Optional. Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
|
||||
|
@ -44,6 +47,9 @@ class InlineQueryResultCachedGif(InlineQueryResult):
|
|||
gif_file_id (:obj:`str`): A valid file identifier for the GIF file.
|
||||
title (:obj:`str`, optional): Title for the result.caption (:obj:`str`, optional):
|
||||
caption (:obj:`str`, optional): Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
|
||||
|
@ -59,6 +65,7 @@ class InlineQueryResultCachedGif(InlineQueryResult):
|
|||
caption=None,
|
||||
reply_markup=None,
|
||||
input_message_content=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
# Required
|
||||
super(InlineQueryResultCachedGif, self).__init__('gif', id)
|
||||
|
@ -69,6 +76,8 @@ class InlineQueryResultCachedGif(InlineQueryResult):
|
|||
self.title = title
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if reply_markup:
|
||||
self.reply_markup = reply_markup
|
||||
if input_message_content:
|
||||
|
|
|
@ -34,6 +34,9 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
|
|||
mpeg4_file_id (:obj:`str`): A valid file identifier for the MP4 file.
|
||||
title (:obj:`str`): Optional. Title for the result.
|
||||
caption (:obj:`str`): Optional. Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
|
||||
|
@ -44,6 +47,9 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
|
|||
mpeg4_file_id (:obj:`str`): A valid file identifier for the MP4 file.
|
||||
title (:obj:`str`, optional): Title for the result.
|
||||
caption (:obj:`str`, optional): Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
|
||||
|
@ -59,6 +65,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
|
|||
caption=None,
|
||||
reply_markup=None,
|
||||
input_message_content=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
# Required
|
||||
super(InlineQueryResultCachedMpeg4Gif, self).__init__('mpeg4_gif', id)
|
||||
|
@ -69,6 +76,8 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
|
|||
self.title = title
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if reply_markup:
|
||||
self.reply_markup = reply_markup
|
||||
if input_message_content:
|
||||
|
|
|
@ -35,6 +35,9 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
|
|||
title (:obj:`str`): Optional. Title for the result.
|
||||
description (:obj:`str`): Optional. Short description of the result.
|
||||
caption (:obj:`str`): Optional. Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
|
||||
|
@ -46,6 +49,9 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
|
|||
title (:obj:`str`, optional): Title for the result.
|
||||
description (:obj:`str`, optional): Short description of the result.
|
||||
caption (:obj:`str`, optional): Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
|
||||
|
@ -62,6 +68,7 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
|
|||
caption=None,
|
||||
reply_markup=None,
|
||||
input_message_content=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
# Required
|
||||
super(InlineQueryResultCachedPhoto, self).__init__('photo', id)
|
||||
|
@ -74,6 +81,8 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
|
|||
self.description = description
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if reply_markup:
|
||||
self.reply_markup = reply_markup
|
||||
if input_message_content:
|
||||
|
|
|
@ -35,6 +35,9 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
|
|||
title (:obj:`str`): Title for the result.
|
||||
description (:obj:`str`): Optional. Short description of the result.
|
||||
caption (:obj:`str`): Optional. Caption, 0-200 characters.
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
|
||||
|
@ -46,6 +49,9 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
|
|||
title (:obj:`str`): Title for the result.
|
||||
description (:obj:`str`, optional): Short description of the result.
|
||||
caption (:obj:`str`, optional): Caption, 0-200 characters.
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
|
||||
|
@ -62,6 +68,7 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
|
|||
caption=None,
|
||||
reply_markup=None,
|
||||
input_message_content=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
# Required
|
||||
super(InlineQueryResultCachedVideo, self).__init__('video', id)
|
||||
|
@ -73,6 +80,8 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
|
|||
self.description = description
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if reply_markup:
|
||||
self.reply_markup = reply_markup
|
||||
if input_message_content:
|
||||
|
|
|
@ -33,6 +33,9 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
|
|||
voice_file_id (:obj:`str`): A valid file identifier for the voice message.
|
||||
title (:obj:`str`): Voice message title.
|
||||
caption (:obj:`str`): Optional. Caption, 0-200 characters.
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
|
||||
|
@ -43,6 +46,9 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
|
|||
voice_file_id (:obj:`str`): A valid file identifier for the voice message.
|
||||
title (:obj:`str`): Voice message title.
|
||||
caption (:obj:`str`, optional): Caption, 0-200 characters.
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
|
||||
|
@ -58,6 +64,7 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
|
|||
caption=None,
|
||||
reply_markup=None,
|
||||
input_message_content=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
# Required
|
||||
super(InlineQueryResultCachedVoice, self).__init__('voice', id)
|
||||
|
@ -67,6 +74,8 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
|
|||
# Optionals
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if reply_markup:
|
||||
self.reply_markup = reply_markup
|
||||
if input_message_content:
|
||||
|
|
|
@ -33,6 +33,9 @@ class InlineQueryResultDocument(InlineQueryResult):
|
|||
id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
|
||||
title (:obj:`str`): Title for the result.
|
||||
caption (:obj:`str`): Optional. Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
document_url (:obj:`str`): A valid URL for the file.
|
||||
mime_type (:obj:`str`): Mime type of the content of the file, either "application/pdf"
|
||||
or "application/zip".
|
||||
|
@ -49,6 +52,9 @@ class InlineQueryResultDocument(InlineQueryResult):
|
|||
id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
|
||||
title (:obj:`str`): Title for the result.
|
||||
caption (:obj:`str`, optional): Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
document_url (:obj:`str`): A valid URL for the file.
|
||||
mime_type (:obj:`str`): Mime type of the content of the file, either "application/pdf"
|
||||
or "application/zip".
|
||||
|
@ -76,6 +82,7 @@ class InlineQueryResultDocument(InlineQueryResult):
|
|||
thumb_url=None,
|
||||
thumb_width=None,
|
||||
thumb_height=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
# Required
|
||||
super(InlineQueryResultDocument, self).__init__('document', id)
|
||||
|
@ -86,6 +93,8 @@ class InlineQueryResultDocument(InlineQueryResult):
|
|||
# Optionals
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if description:
|
||||
self.description = description
|
||||
if reply_markup:
|
||||
|
|
|
@ -37,6 +37,9 @@ class InlineQueryResultGif(InlineQueryResult):
|
|||
thumb_url (:obj:`str`): URL of the static thumbnail for the result (jpeg or gif).
|
||||
title (:obj:`str`): Optional. Title for the result.
|
||||
caption (:obj:`str`): Optional. Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
|
||||
|
@ -51,6 +54,9 @@ class InlineQueryResultGif(InlineQueryResult):
|
|||
thumb_url (:obj:`str`): URL of the static thumbnail for the result (jpeg or gif).
|
||||
title (:obj:`str`, optional): Title for the result.caption (:obj:`str`, optional):
|
||||
caption (:obj:`str`, optional): Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
|
||||
|
@ -70,6 +76,7 @@ class InlineQueryResultGif(InlineQueryResult):
|
|||
reply_markup=None,
|
||||
input_message_content=None,
|
||||
gif_duration=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
|
||||
# Required
|
||||
|
@ -88,6 +95,8 @@ class InlineQueryResultGif(InlineQueryResult):
|
|||
self.title = title
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if reply_markup:
|
||||
self.reply_markup = reply_markup
|
||||
if input_message_content:
|
||||
|
|
|
@ -38,6 +38,9 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
|||
thumb_url (:obj:`str`): URL of the static thumbnail (jpeg or gif) for the result.
|
||||
title (:obj:`str`): Optional. Title for the result.
|
||||
caption (:obj:`str`): Optional. Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
|
||||
|
@ -52,6 +55,9 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
|||
thumb_url (:obj:`str`): URL of the static thumbnail (jpeg or gif) for the result.
|
||||
title (:obj:`str`, optional): Title for the result.
|
||||
caption (:obj:`str`, optional): Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
|
||||
|
@ -71,6 +77,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
|||
reply_markup=None,
|
||||
input_message_content=None,
|
||||
mpeg4_duration=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
|
||||
# Required
|
||||
|
@ -89,6 +96,8 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
|||
self.title = title
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if reply_markup:
|
||||
self.reply_markup = reply_markup
|
||||
if input_message_content:
|
||||
|
|
|
@ -38,6 +38,9 @@ class InlineQueryResultPhoto(InlineQueryResult):
|
|||
title (:obj:`str`): Optional. Title for the result.
|
||||
description (:obj:`str`): Optional. Short description of the result.
|
||||
caption (:obj:`str`): Optional. Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
|
||||
|
@ -53,6 +56,9 @@ class InlineQueryResultPhoto(InlineQueryResult):
|
|||
title (:obj:`str`, optional): Title for the result.
|
||||
description (:obj:`str`, optional): Short description of the result.
|
||||
caption (:obj:`str`, optional): Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
|
||||
to the message.
|
||||
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
|
||||
|
@ -72,6 +78,7 @@ class InlineQueryResultPhoto(InlineQueryResult):
|
|||
caption=None,
|
||||
reply_markup=None,
|
||||
input_message_content=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
# Required
|
||||
super(InlineQueryResultPhoto, self).__init__('photo', id)
|
||||
|
@ -89,6 +96,8 @@ class InlineQueryResultPhoto(InlineQueryResult):
|
|||
self.description = description
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if reply_markup:
|
||||
self.reply_markup = reply_markup
|
||||
if input_message_content:
|
||||
|
|
|
@ -36,6 +36,9 @@ class InlineQueryResultVideo(InlineQueryResult):
|
|||
thumb_url (:obj:`str`): URL of the thumbnail (jpeg only) for the video.
|
||||
title (:obj:`str`): Title for the result.
|
||||
caption (:obj:`str`): Optional. Caption, 0-200 characters
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
video_width (:obj:`int`): Optional. Video width.
|
||||
video_height (:obj:`int`): Optional. Video height.
|
||||
video_duration (:obj:`int`): Optional. Video duration in seconds.
|
||||
|
@ -52,6 +55,9 @@ class InlineQueryResultVideo(InlineQueryResult):
|
|||
thumb_url (:obj:`str`): URL of the thumbnail (jpeg only) for the video.
|
||||
title (:obj:`str`): Title for the result.
|
||||
caption (:obj:`str`, optional): Caption, 0-200 characters.
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
video_width (:obj:`int`, optional): Video width.
|
||||
video_height (:obj:`int`, optional): Video height.
|
||||
video_duration (:obj:`int`, optional): Video duration in seconds.
|
||||
|
@ -77,6 +83,7 @@ class InlineQueryResultVideo(InlineQueryResult):
|
|||
description=None,
|
||||
reply_markup=None,
|
||||
input_message_content=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
|
||||
# Required
|
||||
|
@ -89,6 +96,8 @@ class InlineQueryResultVideo(InlineQueryResult):
|
|||
# Optional
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if video_width:
|
||||
self.video_width = video_width
|
||||
if video_height:
|
||||
|
|
|
@ -34,6 +34,9 @@ class InlineQueryResultVoice(InlineQueryResult):
|
|||
voice_url (:obj:`str`): A valid URL for the voice recording.
|
||||
title (:obj:`str`): Voice message title.
|
||||
caption (:obj:`str`): Optional. Caption, 0-200 characters.
|
||||
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
voice_duration (:obj:`int`): Optional. Recording duration in seconds.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
|
||||
to the message.
|
||||
|
@ -45,6 +48,9 @@ class InlineQueryResultVoice(InlineQueryResult):
|
|||
voice_url (:obj:`str`): A valid URL for the voice recording.
|
||||
title (:obj:`str`): Voice message title.
|
||||
caption (:obj:`str`, optional): Caption, 0-200 characters.
|
||||
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
|
||||
in :class:`telegram.ParseMode` for the available modes.
|
||||
voice_duration (:obj:`int`, optional): Recording duration in seconds.
|
||||
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
|
||||
to the message.
|
||||
|
@ -62,6 +68,7 @@ class InlineQueryResultVoice(InlineQueryResult):
|
|||
caption=None,
|
||||
reply_markup=None,
|
||||
input_message_content=None,
|
||||
parse_mode=None,
|
||||
**kwargs):
|
||||
|
||||
# Required
|
||||
|
@ -74,6 +81,8 @@ class InlineQueryResultVoice(InlineQueryResult):
|
|||
self.voice_duration = voice_duration
|
||||
if caption:
|
||||
self.caption = caption
|
||||
if parse_mode:
|
||||
self.parse_mode = parse_mode
|
||||
if reply_markup:
|
||||
self.reply_markup = reply_markup
|
||||
if input_message_content:
|
||||
|
|
|
@ -91,6 +91,8 @@ class Message(TelegramObject):
|
|||
invoice (:class:`telegram.Invoice`): Optional. Information about the invoice.
|
||||
successful_payment (:class:`telegram.SuccessfulPayment`): Optional. Information about the
|
||||
payment.
|
||||
connected_website (:obj:`str`): Optional. The domain name of the website on which the user
|
||||
has logged in.
|
||||
forward_signature (:obj:`str`): Optional. Signature of the post author for messages
|
||||
forwarded from channels.
|
||||
author_signature (:obj:`str`): Optional. Signature of the post author for messages
|
||||
|
@ -187,6 +189,8 @@ class Message(TelegramObject):
|
|||
information about the invoice.
|
||||
successful_payment (:class:`telegram.SuccessfulPayment`, optional): Message is a service
|
||||
message about a successful payment, information about the payment.
|
||||
connected_website (:obj:`str`, optional): The domain name of the website on which the user
|
||||
has logged in.
|
||||
forward_signature (:obj:`str`, optional): Signature of the post author for messages
|
||||
forwarded from channels.
|
||||
author_signature (:obj:`str`, optional): Signature of the post author for messages
|
||||
|
@ -246,6 +250,7 @@ class Message(TelegramObject):
|
|||
forward_signature=None,
|
||||
author_signature=None,
|
||||
media_group_id=None,
|
||||
connected_website=None,
|
||||
bot=None,
|
||||
**kwargs):
|
||||
# Required
|
||||
|
@ -289,6 +294,7 @@ class Message(TelegramObject):
|
|||
self.forward_from_message_id = forward_from_message_id
|
||||
self.invoice = invoice
|
||||
self.successful_payment = successful_payment
|
||||
self.connected_website = connected_website
|
||||
self.forward_signature = forward_signature
|
||||
self.author_signature = author_signature
|
||||
self.media_group_id = media_group_id
|
||||
|
|
|
@ -38,7 +38,7 @@ def audio(bot, chat_id):
|
|||
|
||||
|
||||
class TestAudio(object):
|
||||
caption = 'Test audio'
|
||||
caption = 'Test *audio*'
|
||||
performer = 'Leandro Toledo'
|
||||
title = 'Teste'
|
||||
duration = 3
|
||||
|
@ -66,9 +66,10 @@ class TestAudio(object):
|
|||
def test_send_all_args(self, bot, chat_id, audio_file):
|
||||
message = bot.send_audio(chat_id, audio=audio_file, caption=self.caption,
|
||||
duration=self.duration, performer=self.performer,
|
||||
title=self.title, disable_notification=False)
|
||||
title=self.title, disable_notification=False,
|
||||
parse_mode='Markdown')
|
||||
|
||||
assert message.caption == self.caption
|
||||
assert message.caption == self.caption.replace('*', '')
|
||||
|
||||
assert isinstance(message.audio, Audio)
|
||||
assert isinstance(message.audio.file_id, str)
|
||||
|
|
|
@ -258,6 +258,15 @@ class TestBot(object):
|
|||
|
||||
assert message.caption == 'new_caption'
|
||||
|
||||
@flaky(3, 1)
|
||||
@pytest.mark.timeout(10)
|
||||
def test_edit_message_caption_with_parse_mode(self, bot, media_message):
|
||||
message = bot.edit_message_caption(caption='new *caption*', parse_mode='Markdown',
|
||||
chat_id=media_message.chat_id,
|
||||
message_id=media_message.message_id)
|
||||
|
||||
assert message.caption == 'new caption'
|
||||
|
||||
@pytest.mark.xfail(raises=TelegramError) # TODO: remove when #744 is merged
|
||||
def test_edit_message_caption_without_required(self, bot):
|
||||
with pytest.raises(ValueError, match='Both chat_id and message_id are required when'):
|
||||
|
|
|
@ -42,7 +42,6 @@ class TestConstants(object):
|
|||
assert good_msg.caption == good_caption
|
||||
|
||||
bad_caption = good_caption + 'Z'
|
||||
with open('tests/data/telegram.png', 'rb') as f:
|
||||
bad_message = bot.send_photo(photo=f, caption=bad_caption, chat_id=chat_id)
|
||||
assert bad_message.caption != bad_caption
|
||||
assert len(bad_message.caption) == constants.MAX_CAPTION_LENGTH
|
||||
with pytest.raises(BadRequest, message="Media_caption_too_long"):
|
||||
with open('tests/data/telegram.png', 'rb') as f:
|
||||
bad_message = bot.send_photo(photo=f, caption=bad_caption, chat_id=chat_id)
|
||||
|
|
|
@ -38,7 +38,7 @@ def document(bot, chat_id):
|
|||
|
||||
|
||||
class TestDocument(object):
|
||||
caption = 'DocumentTest - Caption'
|
||||
caption = 'DocumentTest - *Caption*'
|
||||
document_file_url = 'https://python-telegram-bot.org/static/testfiles/telegram.gif'
|
||||
file_size = 12948
|
||||
mime_type = 'image/png'
|
||||
|
@ -64,7 +64,8 @@ class TestDocument(object):
|
|||
@pytest.mark.timeout(10)
|
||||
def test_send_all_args(self, bot, chat_id, document_file, document):
|
||||
message = bot.send_document(chat_id, document=document_file, caption=self.caption,
|
||||
disable_notification=False, filename='telegram_custom.png')
|
||||
disable_notification=False, filename='telegram_custom.png',
|
||||
parse_mode='Markdown')
|
||||
|
||||
assert isinstance(message.document, Document)
|
||||
assert isinstance(message.document.file_id, str)
|
||||
|
@ -74,7 +75,7 @@ class TestDocument(object):
|
|||
assert message.document.mime_type == document.mime_type
|
||||
assert message.document.file_size == document.file_size
|
||||
assert message.document.thumb == document.thumb
|
||||
assert message.caption == self.caption
|
||||
assert message.caption == self.caption.replace('*', '')
|
||||
|
||||
@flaky(3, 1)
|
||||
@pytest.mark.timeout(10)
|
||||
|
|
|
@ -162,6 +162,11 @@ class TestFilters(object):
|
|||
assert Filters.status_update.pinned_message(message)
|
||||
message.pinned_message = None
|
||||
|
||||
message.connected_website = 'http://example.com/'
|
||||
assert Filters.status_update(message)
|
||||
assert Filters.status_update.connected_website(message)
|
||||
message.connected_website = None
|
||||
|
||||
def test_filters_forwarded(self, message):
|
||||
assert not Filters.forwarded(message)
|
||||
message.forward_date = 'test'
|
||||
|
|
|
@ -31,6 +31,7 @@ def inline_query_result_audio():
|
|||
performer=TestInlineQueryResultAudio.performer,
|
||||
audio_duration=TestInlineQueryResultAudio.audio_duration,
|
||||
caption=TestInlineQueryResultAudio.caption,
|
||||
parse_mode=TestInlineQueryResultAudio.parse_mode,
|
||||
input_message_content=TestInlineQueryResultAudio.input_message_content,
|
||||
reply_markup=TestInlineQueryResultAudio.reply_markup)
|
||||
|
||||
|
@ -43,6 +44,7 @@ class TestInlineQueryResultAudio(object):
|
|||
performer = 'performer'
|
||||
audio_duration = 'audio_duration'
|
||||
caption = 'caption'
|
||||
parse_mode = 'Markdown'
|
||||
input_message_content = InputTextMessageContent('input_message_content')
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]])
|
||||
|
||||
|
@ -54,6 +56,7 @@ class TestInlineQueryResultAudio(object):
|
|||
assert inline_query_result_audio.performer == self.performer
|
||||
assert inline_query_result_audio.audio_duration == self.audio_duration
|
||||
assert inline_query_result_audio.caption == self.caption
|
||||
assert inline_query_result_audio.parse_mode == self.parse_mode
|
||||
assert inline_query_result_audio.input_message_content.to_dict() == \
|
||||
self.input_message_content.to_dict()
|
||||
assert inline_query_result_audio.reply_markup.to_dict() == self.reply_markup.to_dict()
|
||||
|
@ -70,6 +73,7 @@ class TestInlineQueryResultAudio(object):
|
|||
assert inline_query_result_audio_dict['audio_duration'] == \
|
||||
inline_query_result_audio.audio_duration
|
||||
assert inline_query_result_audio_dict['caption'] == inline_query_result_audio.caption
|
||||
assert inline_query_result_audio_dict['parse_mode'] == inline_query_result_audio.parse_mode
|
||||
assert inline_query_result_audio_dict['input_message_content'] == \
|
||||
inline_query_result_audio.input_message_content.to_dict()
|
||||
assert inline_query_result_audio_dict['reply_markup'] == \
|
||||
|
|
|
@ -28,6 +28,7 @@ def inline_query_result_cached_audio():
|
|||
return InlineQueryResultCachedAudio(TestInlineQueryResultCachedAudio.id,
|
||||
TestInlineQueryResultCachedAudio.audio_file_id,
|
||||
caption=TestInlineQueryResultCachedAudio.caption,
|
||||
parse_mode=TestInlineQueryResultCachedAudio.parse_mode,
|
||||
input_message_content=TestInlineQueryResultCachedAudio.input_message_content,
|
||||
reply_markup=TestInlineQueryResultCachedAudio.reply_markup)
|
||||
|
||||
|
@ -37,6 +38,7 @@ class TestInlineQueryResultCachedAudio(object):
|
|||
type = 'audio'
|
||||
audio_file_id = 'audio file id'
|
||||
caption = 'caption'
|
||||
parse_mode = 'HTML'
|
||||
input_message_content = InputTextMessageContent('input_message_content')
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]])
|
||||
|
||||
|
@ -45,6 +47,7 @@ class TestInlineQueryResultCachedAudio(object):
|
|||
assert inline_query_result_cached_audio.id == self.id
|
||||
assert inline_query_result_cached_audio.audio_file_id == self.audio_file_id
|
||||
assert inline_query_result_cached_audio.caption == self.caption
|
||||
assert inline_query_result_cached_audio.parse_mode == self.parse_mode
|
||||
assert inline_query_result_cached_audio.input_message_content.to_dict() == \
|
||||
self.input_message_content.to_dict()
|
||||
assert inline_query_result_cached_audio.reply_markup.to_dict() == \
|
||||
|
@ -61,6 +64,8 @@ class TestInlineQueryResultCachedAudio(object):
|
|||
inline_query_result_cached_audio.audio_file_id
|
||||
assert inline_query_result_cached_audio_dict['caption'] == \
|
||||
inline_query_result_cached_audio.caption
|
||||
assert inline_query_result_cached_audio_dict['parse_mode'] == \
|
||||
inline_query_result_cached_audio.parse_mode
|
||||
assert inline_query_result_cached_audio_dict['input_message_content'] == \
|
||||
inline_query_result_cached_audio.input_message_content.to_dict()
|
||||
assert inline_query_result_cached_audio_dict['reply_markup'] == \
|
||||
|
|
|
@ -29,6 +29,7 @@ def inline_query_result_cached_document():
|
|||
TestInlineQueryResultCachedDocument.title,
|
||||
TestInlineQueryResultCachedDocument.document_file_id,
|
||||
caption=TestInlineQueryResultCachedDocument.caption,
|
||||
parse_mode=TestInlineQueryResultCachedDocument.parse_mode,
|
||||
description=TestInlineQueryResultCachedDocument.description,
|
||||
input_message_content=TestInlineQueryResultCachedDocument.input_message_content,
|
||||
reply_markup=TestInlineQueryResultCachedDocument.reply_markup)
|
||||
|
@ -40,6 +41,7 @@ class TestInlineQueryResultCachedDocument(object):
|
|||
document_file_id = 'document file id'
|
||||
title = 'title'
|
||||
caption = 'caption'
|
||||
parse_mode = 'Markdown'
|
||||
description = 'description'
|
||||
input_message_content = InputTextMessageContent('input_message_content')
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]])
|
||||
|
@ -50,6 +52,7 @@ class TestInlineQueryResultCachedDocument(object):
|
|||
assert inline_query_result_cached_document.document_file_id == self.document_file_id
|
||||
assert inline_query_result_cached_document.title == self.title
|
||||
assert inline_query_result_cached_document.caption == self.caption
|
||||
assert inline_query_result_cached_document.parse_mode == self.parse_mode
|
||||
assert inline_query_result_cached_document.description == self.description
|
||||
assert inline_query_result_cached_document.input_message_content.to_dict() == \
|
||||
self.input_message_content.to_dict()
|
||||
|
@ -70,6 +73,8 @@ class TestInlineQueryResultCachedDocument(object):
|
|||
inline_query_result_cached_document.title
|
||||
assert inline_query_result_cached_document_dict['caption'] == \
|
||||
inline_query_result_cached_document.caption
|
||||
assert inline_query_result_cached_document_dict['parse_mode'] == \
|
||||
inline_query_result_cached_document.parse_mode
|
||||
assert inline_query_result_cached_document_dict['description'] == \
|
||||
inline_query_result_cached_document.description
|
||||
assert inline_query_result_cached_document_dict['input_message_content'] == \
|
||||
|
|
|
@ -29,6 +29,7 @@ def inline_query_result_cached_gif():
|
|||
TestInlineQueryResultCachedGif.gif_file_id,
|
||||
title=TestInlineQueryResultCachedGif.title,
|
||||
caption=TestInlineQueryResultCachedGif.caption,
|
||||
parse_mode=TestInlineQueryResultCachedGif.parse_mode,
|
||||
input_message_content=TestInlineQueryResultCachedGif.input_message_content,
|
||||
reply_markup=TestInlineQueryResultCachedGif.reply_markup)
|
||||
|
||||
|
@ -39,6 +40,7 @@ class TestInlineQueryResultCachedGif(object):
|
|||
gif_file_id = 'gif file id'
|
||||
title = 'title'
|
||||
caption = 'caption'
|
||||
parse_mode = 'HTML'
|
||||
input_message_content = InputTextMessageContent('input_message_content')
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]])
|
||||
|
||||
|
@ -48,6 +50,7 @@ class TestInlineQueryResultCachedGif(object):
|
|||
assert inline_query_result_cached_gif.gif_file_id == self.gif_file_id
|
||||
assert inline_query_result_cached_gif.title == self.title
|
||||
assert inline_query_result_cached_gif.caption == self.caption
|
||||
assert inline_query_result_cached_gif.parse_mode == self.parse_mode
|
||||
assert inline_query_result_cached_gif.input_message_content.to_dict() == \
|
||||
self.input_message_content.to_dict()
|
||||
assert inline_query_result_cached_gif.reply_markup.to_dict() == self.reply_markup.to_dict()
|
||||
|
@ -63,6 +66,8 @@ class TestInlineQueryResultCachedGif(object):
|
|||
assert inline_query_result_cached_gif_dict['title'] == inline_query_result_cached_gif.title
|
||||
assert inline_query_result_cached_gif_dict['caption'] == \
|
||||
inline_query_result_cached_gif.caption
|
||||
assert inline_query_result_cached_gif_dict['parse_mode'] == \
|
||||
inline_query_result_cached_gif.parse_mode
|
||||
assert inline_query_result_cached_gif_dict['input_message_content'] == \
|
||||
inline_query_result_cached_gif.input_message_content.to_dict()
|
||||
assert inline_query_result_cached_gif_dict['reply_markup'] == \
|
||||
|
|
|
@ -29,6 +29,7 @@ def inline_query_result_cached_mpeg4_gif():
|
|||
TestInlineQueryResultCachedMpeg4Gif.mpeg4_file_id,
|
||||
title=TestInlineQueryResultCachedMpeg4Gif.title,
|
||||
caption=TestInlineQueryResultCachedMpeg4Gif.caption,
|
||||
parse_mode=TestInlineQueryResultCachedMpeg4Gif.parse_mode,
|
||||
input_message_content=TestInlineQueryResultCachedMpeg4Gif.input_message_content,
|
||||
reply_markup=TestInlineQueryResultCachedMpeg4Gif.reply_markup)
|
||||
|
||||
|
@ -39,6 +40,7 @@ class TestInlineQueryResultCachedMpeg4Gif(object):
|
|||
mpeg4_file_id = 'mpeg4 file id'
|
||||
title = 'title'
|
||||
caption = 'caption'
|
||||
parse_mode = 'Markdown'
|
||||
input_message_content = InputTextMessageContent('input_message_content')
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]])
|
||||
|
||||
|
@ -48,6 +50,7 @@ class TestInlineQueryResultCachedMpeg4Gif(object):
|
|||
assert inline_query_result_cached_mpeg4_gif.mpeg4_file_id == self.mpeg4_file_id
|
||||
assert inline_query_result_cached_mpeg4_gif.title == self.title
|
||||
assert inline_query_result_cached_mpeg4_gif.caption == self.caption
|
||||
assert inline_query_result_cached_mpeg4_gif.parse_mode == self.parse_mode
|
||||
assert inline_query_result_cached_mpeg4_gif.input_message_content.to_dict() == \
|
||||
self.input_message_content.to_dict()
|
||||
assert inline_query_result_cached_mpeg4_gif.reply_markup.to_dict() == \
|
||||
|
@ -67,6 +70,8 @@ class TestInlineQueryResultCachedMpeg4Gif(object):
|
|||
inline_query_result_cached_mpeg4_gif.title
|
||||
assert inline_query_result_cached_mpeg4_gif_dict['caption'] == \
|
||||
inline_query_result_cached_mpeg4_gif.caption
|
||||
assert inline_query_result_cached_mpeg4_gif_dict['parse_mode'] == \
|
||||
inline_query_result_cached_mpeg4_gif.parse_mode
|
||||
assert inline_query_result_cached_mpeg4_gif_dict['input_message_content'] == \
|
||||
inline_query_result_cached_mpeg4_gif.input_message_content.to_dict()
|
||||
assert inline_query_result_cached_mpeg4_gif_dict['reply_markup'] == \
|
||||
|
|
|
@ -30,6 +30,7 @@ def inline_query_result_cached_photo():
|
|||
title=TestInlineQueryResultCachedPhoto.title,
|
||||
description=TestInlineQueryResultCachedPhoto.description,
|
||||
caption=TestInlineQueryResultCachedPhoto.caption,
|
||||
parse_mode=TestInlineQueryResultCachedPhoto.parse_mode,
|
||||
input_message_content=TestInlineQueryResultCachedPhoto.input_message_content,
|
||||
reply_markup=TestInlineQueryResultCachedPhoto.reply_markup)
|
||||
|
||||
|
@ -41,6 +42,7 @@ class TestInlineQueryResultCachedPhoto(object):
|
|||
title = 'title'
|
||||
description = 'description'
|
||||
caption = 'caption'
|
||||
parse_mode = 'HTML'
|
||||
input_message_content = InputTextMessageContent('input_message_content')
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]])
|
||||
|
||||
|
@ -51,6 +53,7 @@ class TestInlineQueryResultCachedPhoto(object):
|
|||
assert inline_query_result_cached_photo.title == self.title
|
||||
assert inline_query_result_cached_photo.description == self.description
|
||||
assert inline_query_result_cached_photo.caption == self.caption
|
||||
assert inline_query_result_cached_photo.parse_mode == self.parse_mode
|
||||
assert inline_query_result_cached_photo.input_message_content.to_dict() == \
|
||||
self.input_message_content.to_dict()
|
||||
assert inline_query_result_cached_photo.reply_markup.to_dict() == \
|
||||
|
@ -71,6 +74,8 @@ class TestInlineQueryResultCachedPhoto(object):
|
|||
inline_query_result_cached_photo.description
|
||||
assert inline_query_result_cached_photo_dict['caption'] == \
|
||||
inline_query_result_cached_photo.caption
|
||||
assert inline_query_result_cached_photo_dict['parse_mode'] == \
|
||||
inline_query_result_cached_photo.parse_mode
|
||||
assert inline_query_result_cached_photo_dict['input_message_content'] == \
|
||||
inline_query_result_cached_photo.input_message_content.to_dict()
|
||||
assert inline_query_result_cached_photo_dict['reply_markup'] == \
|
||||
|
|
|
@ -29,6 +29,7 @@ def inline_query_result_cached_video():
|
|||
TestInlineQueryResultCachedVideo.video_file_id,
|
||||
TestInlineQueryResultCachedVideo.title,
|
||||
caption=TestInlineQueryResultCachedVideo.caption,
|
||||
parse_mode=TestInlineQueryResultCachedVideo.parse_mode,
|
||||
description=TestInlineQueryResultCachedVideo.description,
|
||||
input_message_content=TestInlineQueryResultCachedVideo.input_message_content,
|
||||
reply_markup=TestInlineQueryResultCachedVideo.reply_markup)
|
||||
|
@ -40,6 +41,7 @@ class TestInlineQueryResultCachedVideo(object):
|
|||
video_file_id = 'video file id'
|
||||
title = 'title'
|
||||
caption = 'caption'
|
||||
parse_mode = 'Markdown'
|
||||
description = 'description'
|
||||
input_message_content = InputTextMessageContent('input_message_content')
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]])
|
||||
|
@ -51,6 +53,7 @@ class TestInlineQueryResultCachedVideo(object):
|
|||
assert inline_query_result_cached_video.title == self.title
|
||||
assert inline_query_result_cached_video.description == self.description
|
||||
assert inline_query_result_cached_video.caption == self.caption
|
||||
assert inline_query_result_cached_video.parse_mode == self.parse_mode
|
||||
assert inline_query_result_cached_video.input_message_content.to_dict() == \
|
||||
self.input_message_content.to_dict()
|
||||
assert inline_query_result_cached_video.reply_markup.to_dict() == \
|
||||
|
@ -71,6 +74,8 @@ class TestInlineQueryResultCachedVideo(object):
|
|||
inline_query_result_cached_video.description
|
||||
assert inline_query_result_cached_video_dict['caption'] == \
|
||||
inline_query_result_cached_video.caption
|
||||
assert inline_query_result_cached_video_dict['parse_mode'] == \
|
||||
inline_query_result_cached_video.parse_mode
|
||||
assert inline_query_result_cached_video_dict['input_message_content'] == \
|
||||
inline_query_result_cached_video.input_message_content.to_dict()
|
||||
assert inline_query_result_cached_video_dict['reply_markup'] == \
|
||||
|
|
|
@ -29,6 +29,7 @@ def inline_query_result_cached_voice():
|
|||
TestInlineQueryResultCachedVoice.voice_file_id,
|
||||
TestInlineQueryResultCachedVoice.title,
|
||||
caption=TestInlineQueryResultCachedVoice.caption,
|
||||
parse_mode=TestInlineQueryResultCachedVoice.parse_mode,
|
||||
input_message_content=TestInlineQueryResultCachedVoice.input_message_content,
|
||||
reply_markup=TestInlineQueryResultCachedVoice.reply_markup)
|
||||
|
||||
|
@ -39,6 +40,7 @@ class TestInlineQueryResultCachedVoice(object):
|
|||
voice_file_id = 'voice file id'
|
||||
title = 'title'
|
||||
caption = 'caption'
|
||||
parse_mode = 'HTML'
|
||||
input_message_content = InputTextMessageContent('input_message_content')
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]])
|
||||
|
||||
|
@ -48,6 +50,7 @@ class TestInlineQueryResultCachedVoice(object):
|
|||
assert inline_query_result_cached_voice.voice_file_id == self.voice_file_id
|
||||
assert inline_query_result_cached_voice.title == self.title
|
||||
assert inline_query_result_cached_voice.caption == self.caption
|
||||
assert inline_query_result_cached_voice.parse_mode == self.parse_mode
|
||||
assert inline_query_result_cached_voice.input_message_content.to_dict() == \
|
||||
self.input_message_content.to_dict()
|
||||
assert inline_query_result_cached_voice.reply_markup.to_dict() == \
|
||||
|
@ -66,6 +69,8 @@ class TestInlineQueryResultCachedVoice(object):
|
|||
inline_query_result_cached_voice.title
|
||||
assert inline_query_result_cached_voice_dict['caption'] == \
|
||||
inline_query_result_cached_voice.caption
|
||||
assert inline_query_result_cached_voice_dict['parse_mode'] == \
|
||||
inline_query_result_cached_voice.parse_mode
|
||||
assert inline_query_result_cached_voice_dict['input_message_content'] == \
|
||||
inline_query_result_cached_voice.input_message_content.to_dict()
|
||||
assert inline_query_result_cached_voice_dict['reply_markup'] == \
|
||||
|
|
|
@ -30,6 +30,7 @@ def inline_query_result_document():
|
|||
TestInlineQueryResultDocument.title,
|
||||
TestInlineQueryResultDocument.mime_type,
|
||||
caption=TestInlineQueryResultDocument.caption,
|
||||
parse_mode=TestInlineQueryResultDocument.parse_mode,
|
||||
description=TestInlineQueryResultDocument.description,
|
||||
thumb_url=TestInlineQueryResultDocument.thumb_url,
|
||||
thumb_width=TestInlineQueryResultDocument.thumb_width,
|
||||
|
@ -44,6 +45,7 @@ class TestInlineQueryResultDocument(object):
|
|||
document_url = 'document url'
|
||||
title = 'title'
|
||||
caption = 'caption'
|
||||
parse_mode = 'Markdown'
|
||||
mime_type = 'mime type'
|
||||
description = 'description'
|
||||
thumb_url = 'thumb url'
|
||||
|
@ -58,6 +60,7 @@ class TestInlineQueryResultDocument(object):
|
|||
assert inline_query_result_document.document_url == self.document_url
|
||||
assert inline_query_result_document.title == self.title
|
||||
assert inline_query_result_document.caption == self.caption
|
||||
assert inline_query_result_document.parse_mode == self.parse_mode
|
||||
assert inline_query_result_document.mime_type == self.mime_type
|
||||
assert inline_query_result_document.description == self.description
|
||||
assert inline_query_result_document.thumb_url == self.thumb_url
|
||||
|
@ -77,6 +80,8 @@ class TestInlineQueryResultDocument(object):
|
|||
inline_query_result_document.document_url
|
||||
assert inline_query_result_document_dict['title'] == inline_query_result_document.title
|
||||
assert inline_query_result_document_dict['caption'] == inline_query_result_document.caption
|
||||
assert inline_query_result_document_dict['parse_mode'] == \
|
||||
inline_query_result_document.parse_mode
|
||||
assert inline_query_result_document_dict['mime_type'] == \
|
||||
inline_query_result_document.mime_type
|
||||
assert inline_query_result_document_dict['description'] == \
|
||||
|
|
|
@ -33,6 +33,7 @@ def inline_query_result_gif():
|
|||
gif_duration=TestInlineQueryResultGif.gif_duration,
|
||||
title=TestInlineQueryResultGif.title,
|
||||
caption=TestInlineQueryResultGif.caption,
|
||||
parse_mode=TestInlineQueryResultGif.parse_mode,
|
||||
input_message_content=TestInlineQueryResultGif.input_message_content,
|
||||
reply_markup=TestInlineQueryResultGif.reply_markup)
|
||||
|
||||
|
@ -47,6 +48,7 @@ class TestInlineQueryResultGif(object):
|
|||
thumb_url = 'thumb url'
|
||||
title = 'title'
|
||||
caption = 'caption'
|
||||
parse_mode = 'HTML'
|
||||
input_message_content = InputTextMessageContent('input_message_content')
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]])
|
||||
|
||||
|
@ -60,6 +62,7 @@ class TestInlineQueryResultGif(object):
|
|||
assert inline_query_result_gif.thumb_url == self.thumb_url
|
||||
assert inline_query_result_gif.title == self.title
|
||||
assert inline_query_result_gif.caption == self.caption
|
||||
assert inline_query_result_gif.parse_mode == self.parse_mode
|
||||
assert inline_query_result_gif.input_message_content.to_dict() == \
|
||||
self.input_message_content.to_dict()
|
||||
assert inline_query_result_gif.reply_markup.to_dict() == self.reply_markup.to_dict()
|
||||
|
@ -77,6 +80,7 @@ class TestInlineQueryResultGif(object):
|
|||
assert inline_query_result_gif_dict['thumb_url'] == inline_query_result_gif.thumb_url
|
||||
assert inline_query_result_gif_dict['title'] == inline_query_result_gif.title
|
||||
assert inline_query_result_gif_dict['caption'] == inline_query_result_gif.caption
|
||||
assert inline_query_result_gif_dict['parse_mode'] == inline_query_result_gif.parse_mode
|
||||
assert inline_query_result_gif_dict['input_message_content'] == \
|
||||
inline_query_result_gif.input_message_content.to_dict()
|
||||
assert inline_query_result_gif_dict['reply_markup'] == \
|
||||
|
|
|
@ -33,6 +33,7 @@ def inline_query_result_mpeg4_gif():
|
|||
mpeg4_duration=TestInlineQueryResultMpeg4Gif.mpeg4_duration,
|
||||
title=TestInlineQueryResultMpeg4Gif.title,
|
||||
caption=TestInlineQueryResultMpeg4Gif.caption,
|
||||
parse_mode=TestInlineQueryResultMpeg4Gif.parse_mode,
|
||||
input_message_content=TestInlineQueryResultMpeg4Gif.input_message_content,
|
||||
reply_markup=TestInlineQueryResultMpeg4Gif.reply_markup)
|
||||
|
||||
|
@ -47,6 +48,7 @@ class TestInlineQueryResultMpeg4Gif(object):
|
|||
thumb_url = 'thumb url'
|
||||
title = 'title'
|
||||
caption = 'caption'
|
||||
parse_mode = 'Markdown'
|
||||
input_message_content = InputTextMessageContent('input_message_content')
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]])
|
||||
|
||||
|
@ -60,6 +62,7 @@ class TestInlineQueryResultMpeg4Gif(object):
|
|||
assert inline_query_result_mpeg4_gif.thumb_url == self.thumb_url
|
||||
assert inline_query_result_mpeg4_gif.title == self.title
|
||||
assert inline_query_result_mpeg4_gif.caption == self.caption
|
||||
assert inline_query_result_mpeg4_gif.parse_mode == self.parse_mode
|
||||
assert inline_query_result_mpeg4_gif.input_message_content.to_dict() == \
|
||||
self.input_message_content.to_dict()
|
||||
assert inline_query_result_mpeg4_gif.reply_markup.to_dict() == self.reply_markup.to_dict()
|
||||
|
@ -83,6 +86,8 @@ class TestInlineQueryResultMpeg4Gif(object):
|
|||
assert inline_query_result_mpeg4_gif_dict['title'] == inline_query_result_mpeg4_gif.title
|
||||
assert inline_query_result_mpeg4_gif_dict['caption'] == \
|
||||
inline_query_result_mpeg4_gif.caption
|
||||
assert inline_query_result_mpeg4_gif_dict['parse_mode'] == \
|
||||
inline_query_result_mpeg4_gif.parse_mode
|
||||
assert inline_query_result_mpeg4_gif_dict['input_message_content'] == \
|
||||
inline_query_result_mpeg4_gif.input_message_content.to_dict()
|
||||
assert inline_query_result_mpeg4_gif_dict['reply_markup'] == \
|
||||
|
|
|
@ -33,6 +33,7 @@ def inline_query_result_photo():
|
|||
title=TestInlineQueryResultPhoto.title,
|
||||
description=TestInlineQueryResultPhoto.description,
|
||||
caption=TestInlineQueryResultPhoto.caption,
|
||||
parse_mode=TestInlineQueryResultPhoto.parse_mode,
|
||||
input_message_content=TestInlineQueryResultPhoto.input_message_content,
|
||||
reply_markup=TestInlineQueryResultPhoto.reply_markup)
|
||||
|
||||
|
@ -47,6 +48,7 @@ class TestInlineQueryResultPhoto(object):
|
|||
title = 'title'
|
||||
description = 'description'
|
||||
caption = 'caption'
|
||||
parse_mode = 'HTML'
|
||||
input_message_content = InputTextMessageContent('input_message_content')
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]])
|
||||
|
||||
|
@ -60,6 +62,7 @@ class TestInlineQueryResultPhoto(object):
|
|||
assert inline_query_result_photo.title == self.title
|
||||
assert inline_query_result_photo.description == self.description
|
||||
assert inline_query_result_photo.caption == self.caption
|
||||
assert inline_query_result_photo.parse_mode == self.parse_mode
|
||||
assert inline_query_result_photo.input_message_content.to_dict() == \
|
||||
self.input_message_content.to_dict()
|
||||
assert inline_query_result_photo.reply_markup.to_dict() == self.reply_markup.to_dict()
|
||||
|
@ -80,6 +83,7 @@ class TestInlineQueryResultPhoto(object):
|
|||
assert inline_query_result_photo_dict['description'] == \
|
||||
inline_query_result_photo.description
|
||||
assert inline_query_result_photo_dict['caption'] == inline_query_result_photo.caption
|
||||
assert inline_query_result_photo_dict['parse_mode'] == inline_query_result_photo.parse_mode
|
||||
assert inline_query_result_photo_dict['input_message_content'] == \
|
||||
inline_query_result_photo.input_message_content.to_dict()
|
||||
assert inline_query_result_photo_dict['reply_markup'] == \
|
||||
|
|
|
@ -34,6 +34,7 @@ def inline_query_result_video():
|
|||
video_height=TestInlineQueryResultVideo.video_height,
|
||||
video_duration=TestInlineQueryResultVideo.video_duration,
|
||||
caption=TestInlineQueryResultVideo.caption,
|
||||
parse_mode=TestInlineQueryResultVideo.parse_mode,
|
||||
description=TestInlineQueryResultVideo.description,
|
||||
input_message_content=TestInlineQueryResultVideo.input_message_content,
|
||||
reply_markup=TestInlineQueryResultVideo.reply_markup)
|
||||
|
@ -50,6 +51,7 @@ class TestInlineQueryResultVideo(object):
|
|||
thumb_url = 'thumb url'
|
||||
title = 'title'
|
||||
caption = 'caption'
|
||||
parse_mode = 'Markdown'
|
||||
description = 'description'
|
||||
input_message_content = InputTextMessageContent('input_message_content')
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]])
|
||||
|
@ -66,6 +68,7 @@ class TestInlineQueryResultVideo(object):
|
|||
assert inline_query_result_video.title == self.title
|
||||
assert inline_query_result_video.description == self.description
|
||||
assert inline_query_result_video.caption == self.caption
|
||||
assert inline_query_result_video.parse_mode == self.parse_mode
|
||||
assert inline_query_result_video.input_message_content.to_dict() == \
|
||||
self.input_message_content.to_dict()
|
||||
assert inline_query_result_video.reply_markup.to_dict() == self.reply_markup.to_dict()
|
||||
|
@ -89,6 +92,7 @@ class TestInlineQueryResultVideo(object):
|
|||
assert inline_query_result_video_dict['description'] == \
|
||||
inline_query_result_video.description
|
||||
assert inline_query_result_video_dict['caption'] == inline_query_result_video.caption
|
||||
assert inline_query_result_video_dict['parse_mode'] == inline_query_result_video.parse_mode
|
||||
assert inline_query_result_video_dict['input_message_content'] == \
|
||||
inline_query_result_video.input_message_content.to_dict()
|
||||
assert inline_query_result_video_dict['reply_markup'] == \
|
||||
|
|
|
@ -31,6 +31,7 @@ def inline_query_result_voice():
|
|||
title=TestInlineQueryResultVoice.title,
|
||||
voice_duration=TestInlineQueryResultVoice.voice_duration,
|
||||
caption=TestInlineQueryResultVoice.caption,
|
||||
parse_mode=TestInlineQueryResultVoice.parse_mode,
|
||||
input_message_content=TestInlineQueryResultVoice.input_message_content,
|
||||
reply_markup=TestInlineQueryResultVoice.reply_markup)
|
||||
|
||||
|
@ -42,6 +43,7 @@ class TestInlineQueryResultVoice(object):
|
|||
title = 'title'
|
||||
voice_duration = 'voice_duration'
|
||||
caption = 'caption'
|
||||
parse_mode = 'HTML'
|
||||
input_message_content = InputTextMessageContent('input_message_content')
|
||||
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]])
|
||||
|
||||
|
@ -52,6 +54,7 @@ class TestInlineQueryResultVoice(object):
|
|||
assert inline_query_result_voice.title == self.title
|
||||
assert inline_query_result_voice.voice_duration == self.voice_duration
|
||||
assert inline_query_result_voice.caption == self.caption
|
||||
assert inline_query_result_voice.parse_mode == self.parse_mode
|
||||
assert inline_query_result_voice.input_message_content.to_dict() == \
|
||||
self.input_message_content.to_dict()
|
||||
assert inline_query_result_voice.reply_markup.to_dict() == self.reply_markup.to_dict()
|
||||
|
@ -67,6 +70,7 @@ class TestInlineQueryResultVoice(object):
|
|||
assert inline_query_result_voice_dict['voice_duration'] == \
|
||||
inline_query_result_voice.voice_duration
|
||||
assert inline_query_result_voice_dict['caption'] == inline_query_result_voice.caption
|
||||
assert inline_query_result_voice_dict['parse_mode'] == inline_query_result_voice.parse_mode
|
||||
assert inline_query_result_voice_dict['input_message_content'] == \
|
||||
inline_query_result_voice.input_message_content.to_dict()
|
||||
assert inline_query_result_voice_dict['reply_markup'] == \
|
||||
|
|
|
@ -30,13 +30,16 @@ def input_media_video():
|
|||
caption=TestInputMediaVideo.caption,
|
||||
width=TestInputMediaVideo.width,
|
||||
height=TestInputMediaVideo.height,
|
||||
duration=TestInputMediaVideo.duration)
|
||||
duration=TestInputMediaVideo.duration,
|
||||
parse_mode=TestInputMediaVideo.parse_mode,
|
||||
supports_streaming=TestInputMediaVideo.supports_streaming)
|
||||
|
||||
|
||||
@pytest.fixture(scope='class')
|
||||
def input_media_photo():
|
||||
return InputMediaPhoto(media=TestInputMediaPhoto.media,
|
||||
caption=TestInputMediaPhoto.caption)
|
||||
caption=TestInputMediaPhoto.caption,
|
||||
parse_mode=TestInputMediaPhoto.parse_mode)
|
||||
|
||||
|
||||
class TestInputMediaVideo(object):
|
||||
|
@ -46,6 +49,8 @@ class TestInputMediaVideo(object):
|
|||
width = 3
|
||||
height = 4
|
||||
duration = 5
|
||||
parse_mode = 'HTML'
|
||||
supports_streaming = True
|
||||
|
||||
def test_expected_values(self, input_media_video):
|
||||
assert input_media_video.type == self.type
|
||||
|
@ -54,6 +59,8 @@ class TestInputMediaVideo(object):
|
|||
assert input_media_video.width == self.width
|
||||
assert input_media_video.height == self.height
|
||||
assert input_media_video.duration == self.duration
|
||||
assert input_media_video.parse_mode == self.parse_mode
|
||||
assert input_media_video.supports_streaming == self.supports_streaming
|
||||
|
||||
def test_to_dict(self, input_media_video):
|
||||
input_media_video_dict = input_media_video.to_dict()
|
||||
|
@ -63,6 +70,8 @@ class TestInputMediaVideo(object):
|
|||
assert input_media_video_dict['width'] == input_media_video.width
|
||||
assert input_media_video_dict['height'] == input_media_video.height
|
||||
assert input_media_video_dict['duration'] == input_media_video.duration
|
||||
assert input_media_video_dict['parse_mode'] == input_media_video.parse_mode
|
||||
assert input_media_video_dict['supports_streaming'] == input_media_video.supports_streaming
|
||||
|
||||
def test_with_video(self, video):
|
||||
# fixture found in test_video
|
||||
|
@ -84,17 +93,20 @@ class TestInputMediaPhoto(object):
|
|||
type = "photo"
|
||||
media = "NOTAREALFILEID"
|
||||
caption = "My Caption"
|
||||
parse_mode = 'Markdown'
|
||||
|
||||
def test_expected_values(self, input_media_photo):
|
||||
assert input_media_photo.type == self.type
|
||||
assert input_media_photo.media == self.media
|
||||
assert input_media_photo.caption == self.caption
|
||||
assert input_media_photo.parse_mode == self.parse_mode
|
||||
|
||||
def test_to_dict(self, input_media_photo):
|
||||
input_media_photo_dict = input_media_photo.to_dict()
|
||||
assert input_media_photo_dict['type'] == input_media_photo.type
|
||||
assert input_media_photo_dict['media'] == input_media_photo.media
|
||||
assert input_media_photo_dict['caption'] == input_media_photo.caption
|
||||
assert input_media_photo_dict['parse_mode'] == input_media_photo.parse_mode
|
||||
|
||||
def test_with_photo(self, photo):
|
||||
# fixture found in test_photo
|
||||
|
@ -111,7 +123,8 @@ class TestInputMediaPhoto(object):
|
|||
|
||||
@pytest.fixture(scope='function')
|
||||
def media_group(photo, thumb):
|
||||
return [InputMediaPhoto(photo), InputMediaPhoto(thumb)]
|
||||
return [InputMediaPhoto(photo, caption='photo `1`', parse_mode='Markdown'),
|
||||
InputMediaPhoto(thumb, caption='<b>photo</b> 2', parse_mode='HTML')]
|
||||
|
||||
|
||||
class TestSendMediaGroup(object):
|
||||
|
|
|
@ -79,6 +79,7 @@ def message(bot):
|
|||
{'successful_payment': SuccessfulPayment('EUR', 243, 'payload',
|
||||
'charge_id', 'provider_id',
|
||||
order_info={})},
|
||||
{'connected_website': 'http://example.com/'},
|
||||
{'forward_signature': 'some_forward_sign'},
|
||||
{'author_signature': 'some_author_sign'},
|
||||
{'photo': [PhotoSize('photo_id', 50, 50)],
|
||||
|
@ -90,8 +91,8 @@ def message(bot):
|
|||
'voice', 'video_note', 'new_members', 'contact', 'location', 'venue',
|
||||
'left_member', 'new_title', 'new_photo', 'delete_photo', 'group_created',
|
||||
'supergroup_created', 'channel_created', 'migrated_to', 'migrated_from',
|
||||
'pinned', 'invoice', 'successful_payment', 'forward_signature',
|
||||
'author_signature', 'photo_from_media_group'])
|
||||
'pinned', 'invoice', 'successful_payment', 'connected_website',
|
||||
'forward_signature', 'author_signature', 'photo_from_media_group'])
|
||||
def message_params(bot, request):
|
||||
return Message(message_id=TestMessage.id,
|
||||
from_user=TestMessage.from_user,
|
||||
|
|
|
@ -51,7 +51,7 @@ def photo(_photo):
|
|||
class TestPhoto(object):
|
||||
width = 300
|
||||
height = 300
|
||||
caption = u'PhotoTest - Caption'
|
||||
caption = u'<b>PhotoTest</b> - *Caption*'
|
||||
photo_file_url = 'https://python-telegram-bot.org/static/testfiles/telegram.jpg'
|
||||
file_size = 10209
|
||||
|
||||
|
@ -77,7 +77,7 @@ class TestPhoto(object):
|
|||
@pytest.mark.timeout(10)
|
||||
def test_send_photo_all_args(self, bot, chat_id, photo_file, thumb, photo):
|
||||
message = bot.send_photo(chat_id, photo_file, caption=self.caption,
|
||||
disable_notification=False)
|
||||
disable_notification=False, parse_mode='Markdown')
|
||||
|
||||
assert isinstance(message.photo[0], PhotoSize)
|
||||
assert isinstance(message.photo[0].file_id, str)
|
||||
|
@ -93,7 +93,51 @@ class TestPhoto(object):
|
|||
assert message.photo[1].height == photo.height
|
||||
assert message.photo[1].file_size == photo.file_size
|
||||
|
||||
assert message.caption == TestPhoto.caption
|
||||
assert message.caption == TestPhoto.caption.replace('*', '')
|
||||
|
||||
@flaky(3, 1)
|
||||
@pytest.mark.timeout(10)
|
||||
def test_send_photo_parse_mode_markdown(self, bot, chat_id, photo_file, thumb, photo):
|
||||
message = bot.send_photo(chat_id, photo_file, caption=self.caption,
|
||||
parse_mode='Markdown')
|
||||
assert isinstance(message.photo[0], PhotoSize)
|
||||
assert isinstance(message.photo[0].file_id, str)
|
||||
assert message.photo[0].file_id != ''
|
||||
assert message.photo[0].width == thumb.width
|
||||
assert message.photo[0].height == thumb.height
|
||||
assert message.photo[0].file_size == thumb.file_size
|
||||
|
||||
assert isinstance(message.photo[1], PhotoSize)
|
||||
assert isinstance(message.photo[1].file_id, str)
|
||||
assert message.photo[1].file_id != ''
|
||||
assert message.photo[1].width == photo.width
|
||||
assert message.photo[1].height == photo.height
|
||||
assert message.photo[1].file_size == photo.file_size
|
||||
|
||||
assert message.caption == TestPhoto.caption.replace('*', '')
|
||||
assert len(message.caption_entities) == 1
|
||||
|
||||
@flaky(3, 1)
|
||||
@pytest.mark.timeout(10)
|
||||
def test_send_photo_parse_mode_html(self, bot, chat_id, photo_file, thumb, photo):
|
||||
message = bot.send_photo(chat_id, photo_file, caption=self.caption,
|
||||
parse_mode='HTML')
|
||||
assert isinstance(message.photo[0], PhotoSize)
|
||||
assert isinstance(message.photo[0].file_id, str)
|
||||
assert message.photo[0].file_id != ''
|
||||
assert message.photo[0].width == thumb.width
|
||||
assert message.photo[0].height == thumb.height
|
||||
assert message.photo[0].file_size == thumb.file_size
|
||||
|
||||
assert isinstance(message.photo[1], PhotoSize)
|
||||
assert isinstance(message.photo[1].file_id, str)
|
||||
assert message.photo[1].file_id != ''
|
||||
assert message.photo[1].width == photo.width
|
||||
assert message.photo[1].height == photo.height
|
||||
assert message.photo[1].file_size == photo.file_size
|
||||
|
||||
assert message.caption == TestPhoto.caption.replace('<b>', '').replace('</b>', '')
|
||||
assert len(message.caption_entities) == 1
|
||||
|
||||
@flaky(3, 1)
|
||||
@pytest.mark.timeout(10)
|
||||
|
|
|
@ -43,8 +43,9 @@ class TestVideo(object):
|
|||
duration = 5
|
||||
file_size = 326534
|
||||
mime_type = 'video/mp4'
|
||||
supports_streaming = True
|
||||
|
||||
caption = u'VideoTest - Caption'
|
||||
caption = u'<b>VideoTest</b> - *Caption*'
|
||||
video_file_url = 'https://python-telegram-bot.org/static/testfiles/telegram.mp4'
|
||||
|
||||
def test_creation(self, video):
|
||||
|
@ -68,8 +69,9 @@ class TestVideo(object):
|
|||
@pytest.mark.timeout(10)
|
||||
def test_send_all_args(self, bot, chat_id, video_file, video):
|
||||
message = bot.send_video(chat_id, video_file, duration=self.duration,
|
||||
caption=self.caption, disable_notification=False,
|
||||
width=video.width, height=video.height)
|
||||
caption=self.caption, supports_streaming=self.supports_streaming,
|
||||
disable_notification=False, width=video.width,
|
||||
height=video.height, parse_mode='Markdown')
|
||||
|
||||
assert isinstance(message.video, Video)
|
||||
assert isinstance(message.video.file_id, str)
|
||||
|
@ -86,7 +88,7 @@ class TestVideo(object):
|
|||
assert message.video.thumb.height == video.thumb.height
|
||||
assert message.video.thumb.file_size == video.thumb.file_size
|
||||
|
||||
assert message.caption == self.caption
|
||||
assert message.caption == self.caption.replace('*', '')
|
||||
|
||||
@flaky(3, 1)
|
||||
@pytest.mark.timeout(10)
|
||||
|
|
|
@ -42,7 +42,7 @@ class TestVoice(object):
|
|||
mime_type = 'audio/ogg'
|
||||
file_size = 9199
|
||||
|
||||
caption = u'Test voice'
|
||||
caption = u'Test *voice*'
|
||||
voice_file_url = 'https://python-telegram-bot.org/static/testfiles/telegram.ogg'
|
||||
|
||||
def test_creation(self, voice):
|
||||
|
@ -60,7 +60,8 @@ class TestVoice(object):
|
|||
@pytest.mark.timeout(10)
|
||||
def test_send_all_args(self, bot, chat_id, voice_file, voice):
|
||||
message = bot.send_voice(chat_id, voice_file, duration=self.duration,
|
||||
caption=self.caption, disable_notification=False)
|
||||
caption=self.caption, disable_notification=False,
|
||||
parse_mode='Markdown')
|
||||
|
||||
assert isinstance(message.voice, Voice)
|
||||
assert isinstance(message.voice.file_id, str)
|
||||
|
@ -68,7 +69,7 @@ class TestVoice(object):
|
|||
assert message.voice.duration == voice.duration
|
||||
assert message.voice.mime_type == voice.mime_type
|
||||
assert message.voice.file_size == voice.file_size
|
||||
assert message.caption == self.caption
|
||||
assert message.caption == self.caption.replace('*', '')
|
||||
|
||||
@flaky(3, 1)
|
||||
@pytest.mark.timeout(10)
|
||||
|
|
Loading…
Reference in a new issue