Skip to content

editMessageCaption

Sahri Riza Umami edited this page Jul 2, 2018 · 3 revisions

Edits the message content caption.
Non-bots can edit messages for a limited period of time.
Returns the edited message after the edit is completed server-side.

editMessageCaption(chat_id, message_id, caption, parse_mode, reply_markup, callback, data)
Field Type Description
chat_id int53 The chat the message belongs to.
message_id int53 Identifier of the message.
reply_markup ReplyMarkup The new message reply markup; for bots only.
caption string New message content caption; 0-200 characters.
parse_mode string Text parse mode.

Example

  • Edit caption of message 234 in chat 1234567890 to HTML formatted text: <b>Test</b> <code>editMessageCaption</code>.

    editMessageCaption(1234567890, 234, '<b>Test</b> <code>editMessageCaption</code>', 'html')

    Response:

    {
      ["@type"] = "message",
      author_signature = "",
      can_be_deleted_for_all_users = true,
      can_be_deleted_only_for_self = false,
      can_be_edited = true,
      can_be_forwarded = true,
      chat_id = 1234567890,
      contains_unread_mention = false,
      content = {
        ["@type"] = "messagePhoto",
        caption = {
          ["@type"] = "formattedText",
          entities = {
            {
              ["@type"] = "textEntity",
              length = 4,
              offset = 0,
              type = {
                ["@type"] = "textEntityTypeBold"
              }
            },
            {
              ["@type"] = "textEntity",
              length = 18,
              offset = 5,
              type = {
                ["@type"] = "textEntityTypeCode"
              }
            }
          },
          text = "Test editMessageCaption"
        },
        is_secret = false,
        photo = {
          ["@type"] = "photo",
          has_stickers = false,
          id = "6181279381960370137",
          sizes = {
            {
              ["@type"] = "photoSize",
              height = 90,
              photo = {
                ["@type"] = "file",
                expected_size = 1893,
                id = 5,
                ["local"] = {
                  ["@type"] = "localFile",
                  can_be_deleted = true,
                  can_be_downloaded = true,
                  downloaded_prefix_size = 1893,
                  downloaded_size = 1893,
                  is_downloading_active = false,
                  is_downloading_completed = true,
                  path = "/home/iza/.config/.telegram-bot/files/photos/852925746_10036.jpg"
                },
                remote = {
                  ["@type"] = "remoteFile",
                  id = "AgADBQAD2acxG9lQyFXEIoG5BCYeBTKd1jIABGzVgbDtKDIBNCcAAgI",
                  is_uploading_active = false,
                  is_uploading_completed = true,
                  uploaded_size = 1893
                },
                size = 1893
              },
              type = "s",
              width = 90
            },
            {
              ["@type"] = "photoSize",
              height = 320,
              photo = {
                ["@type"] = "file",
                expected_size = 14485,
                id = 6,
                ["local"] = {
                  ["@type"] = "localFile",
                  can_be_deleted = false,
                  can_be_downloaded = true,
                  downloaded_prefix_size = 0,
                  downloaded_size = 0,
                  is_downloading_active = false,
                  is_downloading_completed = false,
                  path = ""
                },
                remote = {
                  ["@type"] = "remoteFile",
                  id = "AgADBQAD2acxG9lQyFXEIoG5BCYeBTKd1jIABJRgZcaMRjz1NScAAgI",
                  is_uploading_active = false,
                  is_uploading_completed = true,
                  uploaded_size = 14485
                },
                size = 14485
              },
              type = "m",
              width = 320
            },
            {
              ["@type"] = "photoSize",
              height = 491,
              photo = {
                ["@type"] = "file",
                expected_size = 24183,
                id = 7,
                ["local"] = {
                  ["@type"] = "localFile",
                  can_be_deleted = false,
                  can_be_downloaded = true,
                  downloaded_prefix_size = 0,
                  downloaded_size = 0,
                  is_downloading_active = false,
                  is_downloading_completed = false,
                  path = ""
                },
                remote = {
                  ["@type"] = "remoteFile",
                  id = "AgADBQAD2acxG9lQyFXEIoG5BCYeBTKd1jIABPYzlsOTfsPdMycAAgI",
                  is_uploading_active = false,
                  is_uploading_completed = true,
                  uploaded_size = 24183
                },
                size = 24183
              },
              type = "x",
              width = 491
            }
          }
        }
      },
      date = 1530514521,
      edit_date = 1530514796,
      id = 234,
      is_channel_post = false,
      is_outgoing = true,
      media_album_id = "0",
      reply_to_message_id = 0,
      sender_user_id = 133780085,
      ttl = 0,
      ttl_expires_in = 0,
      via_bot_user_id = 0,
      views = 0
    }

Frequently Asked Questions
The Functions

Clone this wiki locally