Skip to content

editMessageText

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

Edits the text of a message (or a text of a game message).
Non-bot users can edit messages for a limited period of time.
Returns the edited message after the edit is completed on the server side.

editMessageText(chat_id, message_id, text, parse_mode, disable_web_page_preview, clear_draft, reply_markup, callback, data)
Field Type Description
chat_id int53 The chat the message belongs to.
message_id int53 Identifier of the message.
text string New text content of the message.
parse_mode string Text parse mode.
reply_markup ReplyMarkup The new message reply markup; for bots only.
disable_web_page_preview Bool True, if rich web page previews for URLs in the message text should be disabled.
clear_draft Bool True, if a chat message draft should be deleted.

Example

  • Edits the text of message 234 in chat 1234567890.

    editMessageText(1234567890, 234, '<b>Test</b> <code>editMessageText</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"] = "messageText",
        text = {
          ["@type"] = "formattedText",
          entities = {
            {
              ["@type"] = "textEntity",
              length = 4,
              offset = 0,
              type = {
                ["@type"] = "textEntityTypeBold"
              }
            },
            {
              ["@type"] = "textEntity",
              length = 15,
              offset = 5,
              type = {
                ["@type"] = "textEntityTypeCode"
              }
            }
          },
          text = "Test editMessageText"
        }
      },
      date = 1530511006,
      edit_date = 1530511028,
      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