tdlib / telegram-bot-api

Telegram Bot API server
https://core.telegram.org/bots
Boost Software License 1.0
3.1k stars 590 forks source link

How would you edit a message with lots of entites ? #44

Closed foremtehan closed 3 years ago

foremtehan commented 3 years ago

Let say i want to edit a message with bunch of entities (href, bold,...). So the first step is to useforwardMessage and get info about body of post, The problem is the api doesnt provide full text of the message with raw entites (<b>text</b>) so we have to build the message with offsets in the entities array, Is there any method that provides full and raw text and we could easily edit a message just like telegram clients ?

levlam commented 3 years ago

It is a bad idea to use forwardMessage to get message content. Why do you need to edit a message with unknown content?

Is there any method that provides full and raw text and we could easily edit a message just like telegram clients ?

Telegram clients don't use anything like "the message with raw entites". They use WYSIWIG input fields, where you can change formatting of some text from context menu.

Is there any method that provides full and raw text ...?

Bot API frameworks in different languages have this functionality, but it should be rarely needed. Since Bot API 5.0 you can pass entities to sendMessage method in exactly the same format they are received from Bot API. You don't need to use Markdown or HTML parse modes for that.

foremtehan commented 3 years ago

Since Bot API 5.0 you can pass entities to sendMessage method

I didnt know that thanks!