0

I want my bot to edit a message it wrote by appending some text to the original message. I don't want to store the message I sent so I would like to save the message identifier only and use it to get the message, append the text and edit the message but I can't find a way to get the message from telegram.

How could I do this?

Damaru
  • 155
  • 1
  • 8

1 Answers1

0

When posting your message to the telegram server, the server will return an object which contains the message, as well as the corresponding message_id.

Possible response:

{   
    "ok":true,
    "result": {
        "message_id": 123,
        "from": {"id": 98765, "first_name": "...", "username": "..."},
        "chat": {"id": 12345, "first_name": "...", "username": "...", "type": "private"},
        "date": 1475274917, "text": "Message Text"
    }
}

Later on you can edit the message with editMessageText.

Maak
  • 4,720
  • 3
  • 28
  • 39
  • yes, but what I want to is to edit the message and append some characters to the original text. I don't want to store the original text in memory and I haven't found a way to get the original text or to make this kind of edition – Damaru Oct 01 '16 at 11:53
  • You'll have to use [editMessageText](https://core.telegram.org/bots/api#editmessagetext) to edit the message. – Maak Oct 01 '16 at 12:08
  • but that method requires the whole text for the message. I want to append some text and I don't know how to retrieve the original text (or perform the appending) – Damaru Oct 01 '16 at 12:49
  • 1
    You can't append to the message / get the text from telegram. You either need to store it yourself and append manually, or just write a new text. – Maak Oct 01 '16 at 12:52