Hide navigation sidebar
Hide table of contents sidebar
PTB has undergone significant changes in v20. Please read the documentation carefully and also check out the transition guide in the wiki.
Back to top
Toggle table of contents sidebar

# InputTextMessageContent

class telegram.InputTextMessageContent(message_text, parse_mode=None, disable_web_page_preview=None, entities=None, link_preview_options=None, *, api_kwargs=None)

  Bases: `telegram.InputMessageContent`

  Represents the content of a text message to be sent as the result of an inline query.

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `message_text` is equal.

  Examples

  Inline Bot

  Parameters:

    - message_text (`str`) – Text of the message to be sent, `1`- `4096` characters after entities parsing.

    - parse_mode (`str`, optional) – Mode for parsing entities. See `telegram.constants.ParseMode` and formatting options for more details.

    - entities (Sequence[`telegram.MessageEntity`], optional) –

      Sequence of special entities that appear in the caption, which can be specified instead of `parse_mode`.

      Changed in version 20.0: Accepts any `collections.abc.Sequence` as input instead of just a list. The input is converted to a tuple.

    - disable_web_page_preview (`bool`, optional) –

      Disables link previews for links in the sent message. Mutually exclusive with `link_preview_options`.

      Changed in version 20.8: Bot API 7.0 introduced `link_preview_options` replacing this argument. PTB will automatically convert this argument to that one, but for advanced options, please use `link_preview_options` directly.

      Deprecated since version 20.8: In future versions, this argument will become keyword only.

    - link_preview_options (`LinkPreviewOptions`, optional) –

      Link preview generation options for the message. Mutually exclusive with `disable_web_page_preview`.

      New in version 20.8.

  message_text

    Text of the message to be sent, `1`- `4096` characters after entities parsing.

    Type:

      `str`

  parse_mode

    Optional. Mode for parsing entities. See `telegram.constants.ParseMode` and formatting options for more details.

    Type:

      `str`

  entities

    Optional. Tuple of special entities that appear in the caption, which can be specified instead of `parse_mode`.

    Changed in version 20.0:

    - This attribute is now an immutable tuple.

    - This attribute is now always a tuple, that may be empty.

    Type:

      Tuple[`telegram.MessageEntity`]

  link_preview_options

    Optional. Link preview generation options for the message. Mutually exclusive with `disable_web_page_preview`.

    New in version 20.8.

    Type:

      `LinkPreviewOptions`

  Available In

  - `telegram.InlineQueryResultArticle.input_message_content`

  - `telegram.InlineQueryResultAudio.input_message_content`

  - `telegram.InlineQueryResultCachedAudio.input_message_content`

  - `telegram.InlineQueryResultCachedDocument.input_message_content`

  - `telegram.InlineQueryResultCachedGif.input_message_content`

  - `telegram.InlineQueryResultCachedMpeg4Gif.input_message_content`

  - `telegram.InlineQueryResultCachedPhoto.input_message_content`

  - `telegram.InlineQueryResultCachedSticker.input_message_content`

  - `telegram.InlineQueryResultCachedVideo.input_message_content`

  - `telegram.InlineQueryResultCachedVoice.input_message_content`

  - `telegram.InlineQueryResultContact.input_message_content`

  - `telegram.InlineQueryResultDocument.input_message_content`

  - `telegram.InlineQueryResultGif.input_message_content`

  - `telegram.InlineQueryResultLocation.input_message_content`

  - `telegram.InlineQueryResultMpeg4Gif.input_message_content`

  - `telegram.InlineQueryResultPhoto.input_message_content`

  - `telegram.InlineQueryResultVenue.input_message_content`

  - `telegram.InlineQueryResultVideo.input_message_content`

  - `telegram.InlineQueryResultVoice.input_message_content`

  property disable_web_page_preview

    Disables link previews for links in the sent message.

    Deprecated since version 20.8.

    Type:

      Optional[`bool`]