Change MAX_CAPTION_LENGTH to 1024 (#1262)

* update MAX_CAPTION_LENGTH

Telegram silently changed the max length for captions to 1024 chars.

* Update test_constants.py

* change docstrings to reflect new length

* remove message

* clear message and proper match
This commit is contained in:
Eldinnie 2018-10-16 19:51:57 +02:00 committed by Jasmin Bom
parent eca0ccf6b3
commit 9d99660ba9
18 changed files with 52 additions and 49 deletions

View file

@ -369,7 +369,7 @@ class Bot(TelegramObject):
Internet, or upload a new photo using multipart/form-data. Lastly you can pass Internet, or upload a new photo using multipart/form-data. Lastly you can pass
an existing :class:`telegram.PhotoSize` object to send. an existing :class:`telegram.PhotoSize` object to send.
caption (:obj:`str`, optional): Photo caption (may also be used when resending photos caption (:obj:`str`, optional): Photo caption (may also be used when resending photos
by file_id), 0-200 characters. by file_id), 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to 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 show bold, italic, fixed-width text or inline URLs in the media caption. See the
constants in :class:`telegram.ParseMode` for the available modes. constants in :class:`telegram.ParseMode` for the available modes.
@ -442,7 +442,7 @@ class Bot(TelegramObject):
(recommended), pass an HTTP URL as a String for Telegram to get an audio file from (recommended), pass an HTTP URL as a String for Telegram to get an audio file from
the Internet, or upload a new one using multipart/form-data. Lastly you can pass the Internet, or upload a new one using multipart/form-data. Lastly you can pass
an existing :class:`telegram.Audio` object to send. an existing :class:`telegram.Audio` object to send.
caption (:obj:`str`, optional): Audio caption, 0-200 characters. caption (:obj:`str`, optional): Audio caption, 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to 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 show bold, italic, fixed-width text or inline URLs in the media caption. See the
constants in :class:`telegram.ParseMode` for the available modes. constants in :class:`telegram.ParseMode` for the available modes.
@ -527,7 +527,7 @@ class Bot(TelegramObject):
filename (:obj:`str`, optional): File name that shows in telegram message (it is useful filename (:obj:`str`, optional): File name that shows in telegram message (it is useful
when you send file generated by temp module, for example). Undocumented. when you send file generated by temp module, for example). Undocumented.
caption (:obj:`str`, optional): Document caption (may also be used when resending caption (:obj:`str`, optional): Document caption (may also be used when resending
documents by file_id), 0-200 characters. documents by file_id), 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to 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 show bold, italic, fixed-width text or inline URLs in the media caption. See the
constants in :class:`telegram.ParseMode` for the available modes. constants in :class:`telegram.ParseMode` for the available modes.
@ -661,7 +661,7 @@ class Bot(TelegramObject):
width (:obj:`int`, optional): Video width. width (:obj:`int`, optional): Video width.
height (:obj:`int`, optional): Video height. height (:obj:`int`, optional): Video height.
caption (:obj:`str`, optional): Video caption (may also be used when resending videos caption (:obj:`str`, optional): Video caption (may also be used when resending videos
by file_id), 0-200 characters. by file_id), 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to 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 show bold, italic, fixed-width text or inline URLs in the media caption. See the
constants in :class:`telegram.ParseMode` for the available modes. constants in :class:`telegram.ParseMode` for the available modes.
@ -821,7 +821,7 @@ class Bot(TelegramObject):
A thumbnail's width and height should not exceed 90. Ignored if the file is not A thumbnail's width and height should not exceed 90. Ignored if the file is not
is passed as a string or file_id. is passed as a string or file_id.
caption (:obj:`str`, optional): Animation caption (may also be used when resending caption (:obj:`str`, optional): Animation caption (may also be used when resending
animations by file_id), 0-200 characters. animations by file_id), 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to 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 show bold, italic, fixed-width text or inline URLs in the media caption. See the
constants in :class:`telegram.ParseMode` for the available modes. constants in :class:`telegram.ParseMode` for the available modes.
@ -898,7 +898,7 @@ class Bot(TelegramObject):
(recommended), pass an HTTP URL as a String for Telegram to get an voice file from (recommended), pass an HTTP URL as a String for Telegram to get an voice file from
the Internet, or upload a new one using multipart/form-data. Lastly you can pass the Internet, or upload a new one using multipart/form-data. Lastly you can pass
an existing :class:`telegram.Voice` object to send. an existing :class:`telegram.Voice` object to send.
caption (:obj:`str`, optional): Voice message caption, 0-200 characters. caption (:obj:`str`, optional): Voice message caption, 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to 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 show bold, italic, fixed-width text or inline URLs in the media caption. See the
constants in :class:`telegram.ParseMode` for the available modes. constants in :class:`telegram.ParseMode` for the available modes.

View file

@ -21,7 +21,7 @@ The following constants were extracted from the
Attributes: Attributes:
MAX_MESSAGE_LENGTH (:obj:`int`): 4096 MAX_MESSAGE_LENGTH (:obj:`int`): 4096
MAX_CAPTION_LENGTH (:obj:`int`): 200 MAX_CAPTION_LENGTH (:obj:`int`): 1024
SUPPORTED_WEBHOOK_PORTS (List[:obj:`int`]): [443, 80, 88, 8443] SUPPORTED_WEBHOOK_PORTS (List[:obj:`int`]): [443, 80, 88, 8443]
MAX_FILESIZE_DOWNLOAD (:obj:`int`): In bytes (20MB) MAX_FILESIZE_DOWNLOAD (:obj:`int`): In bytes (20MB)
MAX_FILESIZE_UPLOAD (:obj:`int`): In bytes (50MB) MAX_FILESIZE_UPLOAD (:obj:`int`): In bytes (50MB)
@ -40,7 +40,7 @@ Attributes:
""" """
MAX_MESSAGE_LENGTH = 4096 MAX_MESSAGE_LENGTH = 4096
MAX_CAPTION_LENGTH = 200 MAX_CAPTION_LENGTH = 1024
# constants above this line are tested # constants above this line are tested

View file

@ -44,7 +44,7 @@ class InputMediaAnimation(InputMedia):
file sent. The thumbnail should be in JPEG format and less than 200 kB in size. file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
A thumbnail's width and height should not exceed 90. Ignored if the file is not A thumbnail's width and height should not exceed 90. Ignored if the file is not
is passed as a string or file_id. is passed as a string or file_id.
caption (:obj:`str`): Optional. Caption of the animation to be sent, 0-200 characters. caption (:obj:`str`): Optional. Caption of the animation to be sent, 0-1024 characters.
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -61,7 +61,7 @@ class InputMediaAnimation(InputMedia):
file sent. The thumbnail should be in JPEG format and less than 200 kB in size. file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
A thumbnail's width and height should not exceed 90. Ignored if the file is not A thumbnail's width and height should not exceed 90. Ignored if the file is not
is passed as a string or file_id. is passed as a string or file_id.
caption (:obj:`str`, optional): Caption of the animation to be sent, 0-200 characters. caption (:obj:`str`, optional): Caption of the animation to be sent, 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -114,7 +114,7 @@ class InputMediaPhoto(InputMedia):
media (:obj:`str`): File to send. Pass a file_id to send a file that exists on the 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 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. 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. caption (:obj:`str`): Optional. Caption of the photo to be sent, 0-1024 characters.
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -123,7 +123,7 @@ class InputMediaPhoto(InputMedia):
media (:obj:`str`): File to send. Pass a file_id to send a file that exists on the 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 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. 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. caption (:obj:`str`, optional ): Caption of the photo to be sent, 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -153,7 +153,7 @@ class InputMediaVideo(InputMedia):
media (:obj:`str`): File to send. Pass a file_id to send a file that exists on the Telegram 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. 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. 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. caption (:obj:`str`): Optional. Caption of the video to be sent, 0-1024 characters.
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -171,7 +171,7 @@ class InputMediaVideo(InputMedia):
media (:obj:`str`): File to send. Pass a file_id to send a file that exists on the Telegram 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. 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. 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. caption (:obj:`str`, optional): Caption of the video to be sent, 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -232,7 +232,7 @@ class InputMediaAudio(InputMedia):
media (:obj:`str`): File to send. Pass a file_id to send a file that exists on the Telegram 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. servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet.
Lastly you can pass an existing :class:`telegram.Audio` object to send. Lastly you can pass an existing :class:`telegram.Audio` object to send.
caption (:obj:`str`): Optional. Caption of the audio to be sent, 0-200 characters. caption (:obj:`str`): Optional. Caption of the audio to be sent, 0-1024 characters.
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -249,7 +249,7 @@ class InputMediaAudio(InputMedia):
media (:obj:`str`): File to send. Pass a file_id to send a file that exists on the Telegram 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. servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet.
Lastly you can pass an existing :class:`telegram.Document` object to send. Lastly you can pass an existing :class:`telegram.Document` object to send.
caption (:obj:`str`, optional): Caption of the audio to be sent, 0-200 characters. caption (:obj:`str`, optional): Caption of the audio to be sent, 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -307,7 +307,7 @@ class InputMediaDocument(InputMedia):
media (:obj:`str`): File to send. Pass a file_id to send a file that exists on the Telegram 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. servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet.
Lastly you can pass an existing :class:`telegram.Document` object to send. Lastly you can pass an existing :class:`telegram.Document` object to send.
caption (:obj:`str`): Optional. Caption of the document to be sent, 0-200 characters. caption (:obj:`str`): Optional. Caption of the document to be sent, 0-1024 characters.
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -320,7 +320,7 @@ class InputMediaDocument(InputMedia):
media (:obj:`str`): File to send. Pass a file_id to send a file that exists on the Telegram 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. servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet.
Lastly you can pass an existing :class:`telegram.Document` object to send. Lastly you can pass an existing :class:`telegram.Document` object to send.
caption (:obj:`str`, optional): Caption of the document to be sent, 0-200 characters. caption (:obj:`str`, optional): Caption of the document to be sent, 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -31,7 +31,7 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
type (:obj:`str`): 'audio'. type (:obj:`str`): 'audio'.
id (:obj:`str`): Unique identifier for this result, 1-64 bytes. id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
audio_file_id (:obj:`str`): A valid file identifier for the audio file. audio_file_id (:obj:`str`): A valid file identifier for the audio file.
caption (:obj:`str`): Optional. Caption, 0-200 characters caption (:obj:`str`): Optional. Caption, 0-1024 characters
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -43,7 +43,7 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
Args: Args:
id (:obj:`str`): Unique identifier for this result, 1-64 bytes. id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
audio_file_id (:obj:`str`): A valid file identifier for the audio file. audio_file_id (:obj:`str`): A valid file identifier for the audio file.
caption (:obj:`str`, optional): Caption, 0-200 characters caption (:obj:`str`, optional): Caption, 0-1024 characters
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -33,7 +33,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
title (:obj:`str`): Title for the result. title (:obj:`str`): Title for the result.
document_file_id (:obj:`str`): A valid file identifier for the file. document_file_id (:obj:`str`): A valid file identifier for the file.
description (:obj:`str`): Optional. Short description of the result. description (:obj:`str`): Optional. Short description of the result.
caption (:obj:`str`): Optional. Caption, 0-200 characters caption (:obj:`str`): Optional. Caption, 0-1024 characters
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -47,7 +47,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
title (:obj:`str`): Title for the result. title (:obj:`str`): Title for the result.
document_file_id (:obj:`str`): A valid file identifier for the file. document_file_id (:obj:`str`): A valid file identifier for the file.
description (:obj:`str`, optional): Short description of the result. description (:obj:`str`, optional): Short description of the result.
caption (:obj:`str`, optional): Caption, 0-200 characters caption (:obj:`str`, optional): Caption, 0-1024 characters
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -33,7 +33,7 @@ class InlineQueryResultCachedGif(InlineQueryResult):
id (:obj:`str`): Unique identifier for this result, 1-64 bytes. id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
gif_file_id (:obj:`str`): A valid file identifier for the GIF file. gif_file_id (:obj:`str`): A valid file identifier for the GIF file.
title (:obj:`str`): Optional. Title for the result. title (:obj:`str`): Optional. Title for the result.
caption (:obj:`str`): Optional. Caption, 0-200 characters caption (:obj:`str`): Optional. Caption, 0-1024 characters
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -46,7 +46,7 @@ class InlineQueryResultCachedGif(InlineQueryResult):
id (:obj:`str`): Unique identifier for this result, 1-64 bytes. id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
gif_file_id (:obj:`str`): A valid file identifier for the GIF file. 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): title (:obj:`str`, optional): Title for the result.caption (:obj:`str`, optional):
caption (:obj:`str`, optional): Caption, 0-200 characters caption (:obj:`str`, optional): Caption, 0-1024 characters
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -33,7 +33,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
id (:obj:`str`): Unique identifier for this result, 1-64 bytes. id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
mpeg4_file_id (:obj:`str`): A valid file identifier for the MP4 file. mpeg4_file_id (:obj:`str`): A valid file identifier for the MP4 file.
title (:obj:`str`): Optional. Title for the result. title (:obj:`str`): Optional. Title for the result.
caption (:obj:`str`): Optional. Caption, 0-200 characters caption (:obj:`str`): Optional. Caption, 0-1024 characters
parse_mode (:obj:`str`): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -46,7 +46,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
id (:obj:`str`): Unique identifier for this result, 1-64 bytes. id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
mpeg4_file_id (:obj:`str`): A valid file identifier for the MP4 file. mpeg4_file_id (:obj:`str`): A valid file identifier for the MP4 file.
title (:obj:`str`, optional): Title for the result. title (:obj:`str`, optional): Title for the result.
caption (:obj:`str`, optional): Caption, 0-200 characters caption (:obj:`str`, optional): Caption, 0-1024 characters
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -34,7 +34,7 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
photo_file_id (:obj:`str`): A valid file identifier of the photo. photo_file_id (:obj:`str`): A valid file identifier of the photo.
title (:obj:`str`): Optional. Title for the result. title (:obj:`str`): Optional. Title for the result.
description (:obj:`str`): Optional. Short description of the result. description (:obj:`str`): Optional. Short description of the result.
caption (:obj:`str`): Optional. Caption, 0-200 characters caption (:obj:`str`): Optional. Caption, 0-1024 characters
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -48,7 +48,7 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
photo_file_id (:obj:`str`): A valid file identifier of the photo. photo_file_id (:obj:`str`): A valid file identifier of the photo.
title (:obj:`str`, optional): Title for the result. title (:obj:`str`, optional): Title for the result.
description (:obj:`str`, optional): Short description of the result. description (:obj:`str`, optional): Short description of the result.
caption (:obj:`str`, optional): Caption, 0-200 characters caption (:obj:`str`, optional): Caption, 0-1024 characters
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -34,7 +34,7 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
video_file_id (:obj:`str`): A valid file identifier for the video file. video_file_id (:obj:`str`): A valid file identifier for the video file.
title (:obj:`str`): Title for the result. title (:obj:`str`): Title for the result.
description (:obj:`str`): Optional. Short description of the result. description (:obj:`str`): Optional. Short description of the result.
caption (:obj:`str`): Optional. Caption, 0-200 characters. caption (:obj:`str`): Optional. Caption, 0-1024 characters.
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -48,7 +48,7 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
video_file_id (:obj:`str`): A valid file identifier for the video file. video_file_id (:obj:`str`): A valid file identifier for the video file.
title (:obj:`str`): Title for the result. title (:obj:`str`): Title for the result.
description (:obj:`str`, optional): Short description of the result. description (:obj:`str`, optional): Short description of the result.
caption (:obj:`str`, optional): Caption, 0-200 characters. caption (:obj:`str`, optional): Caption, 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -32,7 +32,7 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
id (:obj:`str`): Unique identifier for this result, 1-64 bytes. id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
voice_file_id (:obj:`str`): A valid file identifier for the voice message. voice_file_id (:obj:`str`): A valid file identifier for the voice message.
title (:obj:`str`): Voice message title. title (:obj:`str`): Voice message title.
caption (:obj:`str`): Optional. Caption, 0-200 characters. caption (:obj:`str`): Optional. Caption, 0-1024 characters.
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -45,7 +45,7 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
id (:obj:`str`): Unique identifier for this result, 1-64 bytes. id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
voice_file_id (:obj:`str`): A valid file identifier for the voice message. voice_file_id (:obj:`str`): A valid file identifier for the voice message.
title (:obj:`str`): Voice message title. title (:obj:`str`): Voice message title.
caption (:obj:`str`, optional): Caption, 0-200 characters. caption (:obj:`str`, optional): Caption, 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -32,7 +32,7 @@ class InlineQueryResultDocument(InlineQueryResult):
type (:obj:`str`): 'document'. type (:obj:`str`): 'document'.
id (:obj:`str`): Unique identifier for this result, 1-64 bytes. id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
title (:obj:`str`): Title for the result. title (:obj:`str`): Title for the result.
caption (:obj:`str`): Optional. Caption, 0-200 characters caption (:obj:`str`): Optional. Caption, 0-1024 characters
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -51,7 +51,7 @@ class InlineQueryResultDocument(InlineQueryResult):
Args: Args:
id (:obj:`str`): Unique identifier for this result, 1-64 bytes. id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
title (:obj:`str`): Title for the result. title (:obj:`str`): Title for the result.
caption (:obj:`str`, optional): Caption, 0-200 characters caption (:obj:`str`, optional): Caption, 0-1024 characters
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -36,7 +36,7 @@ class InlineQueryResultGif(InlineQueryResult):
gif_duration (:obj:`int`): Optional. Duration of the GIF. gif_duration (:obj:`int`): Optional. Duration of the GIF.
thumb_url (:obj:`str`): URL of the static thumbnail for the result (jpeg or gif). thumb_url (:obj:`str`): URL of the static thumbnail for the result (jpeg or gif).
title (:obj:`str`): Optional. Title for the result. title (:obj:`str`): Optional. Title for the result.
caption (:obj:`str`): Optional. Caption, 0-200 characters caption (:obj:`str`): Optional. Caption, 0-1024 characters
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -53,7 +53,7 @@ class InlineQueryResultGif(InlineQueryResult):
gif_duration (:obj:`int`, optional): Duration of the GIF gif_duration (:obj:`int`, optional): Duration of the GIF
thumb_url (:obj:`str`): URL of the static thumbnail for the result (jpeg or gif). 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): title (:obj:`str`, optional): Title for the result.caption (:obj:`str`, optional):
caption (:obj:`str`, optional): Caption, 0-200 characters caption (:obj:`str`, optional): Caption, 0-1024 characters
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -37,7 +37,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
mpeg4_duration (:obj:`int`): Optional. Video duration. mpeg4_duration (:obj:`int`): Optional. Video duration.
thumb_url (:obj:`str`): URL of the static thumbnail (jpeg or gif) for the result. thumb_url (:obj:`str`): URL of the static thumbnail (jpeg or gif) for the result.
title (:obj:`str`): Optional. Title for the result. title (:obj:`str`): Optional. Title for the result.
caption (:obj:`str`): Optional. Caption, 0-200 characters caption (:obj:`str`): Optional. Caption, 0-1024 characters
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -54,7 +54,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
mpeg4_duration (:obj:`int`, optional): Video duration. mpeg4_duration (:obj:`int`, optional): Video duration.
thumb_url (:obj:`str`): URL of the static thumbnail (jpeg or gif) for the result. thumb_url (:obj:`str`): URL of the static thumbnail (jpeg or gif) for the result.
title (:obj:`str`, optional): Title for the result. title (:obj:`str`, optional): Title for the result.
caption (:obj:`str`, optional): Caption, 0-200 characters caption (:obj:`str`, optional): Caption, 0-1024 characters
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -37,7 +37,7 @@ class InlineQueryResultPhoto(InlineQueryResult):
photo_height (:obj:`int`): Optional. Height of the photo. photo_height (:obj:`int`): Optional. Height of the photo.
title (:obj:`str`): Optional. Title for the result. title (:obj:`str`): Optional. Title for the result.
description (:obj:`str`): Optional. Short description of the result. description (:obj:`str`): Optional. Short description of the result.
caption (:obj:`str`): Optional. Caption, 0-200 characters caption (:obj:`str`): Optional. Caption, 0-1024 characters
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -55,7 +55,7 @@ class InlineQueryResultPhoto(InlineQueryResult):
photo_height (:obj:`int`, optional): Height of the photo. photo_height (:obj:`int`, optional): Height of the photo.
title (:obj:`str`, optional): Title for the result. title (:obj:`str`, optional): Title for the result.
description (:obj:`str`, optional): Short description of the result. description (:obj:`str`, optional): Short description of the result.
caption (:obj:`str`, optional): Caption, 0-200 characters caption (:obj:`str`, optional): Caption, 0-1024 characters
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -35,7 +35,7 @@ class InlineQueryResultVideo(InlineQueryResult):
mime_type (:obj:`str`): Mime type of the content of video url, "text/html" or "video/mp4". mime_type (:obj:`str`): Mime type of the content of video url, "text/html" or "video/mp4".
thumb_url (:obj:`str`): URL of the thumbnail (jpeg only) for the video. thumb_url (:obj:`str`): URL of the thumbnail (jpeg only) for the video.
title (:obj:`str`): Title for the result. title (:obj:`str`): Title for the result.
caption (:obj:`str`): Optional. Caption, 0-200 characters caption (:obj:`str`): Optional. Caption, 0-1024 characters
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -54,7 +54,7 @@ class InlineQueryResultVideo(InlineQueryResult):
mime_type (:obj:`str`): Mime type of the content of video url, "text/html" or "video/mp4". mime_type (:obj:`str`): Mime type of the content of video url, "text/html" or "video/mp4".
thumb_url (:obj:`str`): URL of the thumbnail (jpeg only) for the video. thumb_url (:obj:`str`): URL of the thumbnail (jpeg only) for the video.
title (:obj:`str`): Title for the result. title (:obj:`str`): Title for the result.
caption (:obj:`str`, optional): Caption, 0-200 characters. caption (:obj:`str`, optional): Caption, 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -33,7 +33,7 @@ class InlineQueryResultVoice(InlineQueryResult):
id (:obj:`str`): Unique identifier for this result, 1-64 bytes. id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
voice_url (:obj:`str`): A valid URL for the voice recording. voice_url (:obj:`str`): A valid URL for the voice recording.
title (:obj:`str`): Voice message title. title (:obj:`str`): Voice message title.
caption (:obj:`str`): Optional. Caption, 0-200 characters. caption (:obj:`str`): Optional. Caption, 0-1024 characters.
parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
@ -47,7 +47,7 @@ class InlineQueryResultVoice(InlineQueryResult):
id (:obj:`str`): Unique identifier for this result, 1-64 bytes. id (:obj:`str`): Unique identifier for this result, 1-64 bytes.
voice_url (:obj:`str`): A valid URL for the voice recording. voice_url (:obj:`str`): A valid URL for the voice recording.
title (:obj:`str`): Voice message title. title (:obj:`str`): Voice message title.
caption (:obj:`str`, optional): Caption, 0-200 characters. caption (:obj:`str`, optional): Caption, 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show 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 bold, italic, fixed-width text or inline URLs in the media caption.. See the constants
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.

View file

@ -73,7 +73,8 @@ class Message(TelegramObject):
video_note (:class:`telegram.VideoNote`): Optional. Information about the video message. video_note (:class:`telegram.VideoNote`): Optional. Information about the video message.
new_chat_members (List[:class:`telegram.User`]): Optional. Information about new members to new_chat_members (List[:class:`telegram.User`]): Optional. Information about new members to
the chat. (the bot itself may be one of these members). the chat. (the bot itself may be one of these members).
caption (:obj:`str`): Optional. Caption for the document, photo or video, 0-200 characters. caption (:obj:`str`): Optional. Caption for the document, photo or video, 0-1024
characters.
contact (:class:`telegram.Contact`): Optional. Information about the contact. contact (:class:`telegram.Contact`): Optional. Information about the contact.
location (:class:`telegram.Location`): Optional. Information about the location. location (:class:`telegram.Location`): Optional. Information about the location.
venue (:class:`telegram.Venue`): Optional. Information about the venue. venue (:class:`telegram.Venue`): Optional. Information about the venue.
@ -154,7 +155,8 @@ class Message(TelegramObject):
new_chat_members (List[:class:`telegram.User`], optional): New members that were added to new_chat_members (List[:class:`telegram.User`], optional): New members that were added to
the group or supergroup and information about them (the bot itself may be one of these the group or supergroup and information about them (the bot itself may be one of these
members). members).
caption (:obj:`str`, optional): Caption for the document, photo or video, 0-200 characters. caption (:obj:`str`, optional): Caption for the document, photo or video, 0-1024
characters.
contact (:class:`telegram.Contact`, optional): Message is a shared contact, information contact (:class:`telegram.Contact`, optional): Message is a shared contact, information
about the contact. about the contact.
location (:class:`telegram.Location`, optional): Message is a shared location, information location (:class:`telegram.Location`, optional): Message is a shared location, information

View file

@ -29,8 +29,8 @@ class TestConstants(object):
def test_max_message_length(self, bot, chat_id): def test_max_message_length(self, bot, chat_id):
bot.send_message(chat_id=chat_id, text='a' * constants.MAX_MESSAGE_LENGTH) bot.send_message(chat_id=chat_id, text='a' * constants.MAX_MESSAGE_LENGTH)
with pytest.raises(BadRequest, message='MAX_MESSAGE_LENGTH is no longer valid', with pytest.raises(BadRequest, match='Message is too long',
match='too long'): message='MAX_MESSAGE_LENGTH is no longer valid'):
bot.send_message(chat_id=chat_id, text='a' * (constants.MAX_MESSAGE_LENGTH + 1)) bot.send_message(chat_id=chat_id, text='a' * (constants.MAX_MESSAGE_LENGTH + 1))
@flaky(3, 1) @flaky(3, 1)
@ -42,6 +42,7 @@ class TestConstants(object):
assert good_msg.caption == good_caption assert good_msg.caption == good_caption
bad_caption = good_caption + 'Z' bad_caption = good_caption + 'Z'
with pytest.raises(BadRequest, message="Media_caption_too_long"): with pytest.raises(BadRequest, match="Media_caption_too_long",
message='MAX_CAPTION_LENGTH is no longer valid'):
with open('tests/data/telegram.png', 'rb') as f: with open('tests/data/telegram.png', 'rb') as f:
bot.send_photo(photo=f, caption=bad_caption, chat_id=chat_id) bot.send_photo(photo=f, caption=bad_caption, chat_id=chat_id)