Log in here to report bugs or suggest features. Please enter your phone number in the international format and we will send a confirmation message to your account via Telegram.
We've just sent you a message.
Please confirm access via Telegram
I want to suggest an improvement for #TelegramBotApi.
Now we have a problem:
TelegramBotApi does not have an optimal way to handle (in the BOT) user actions from link in (HTML or Markdown) format.
I suggest to create possibility to handle (in the BOT) user actions from link in (HTML or Markdown) format.
This is the same that can be done with callback_data from inline_keyboard, but in a more compact and comfortable way.
Example of text:
item1 (action11, action12)
item2 (action21, action22)
where actionX can be in one of the formats:
action11 = [action11](https://t.me/<THIS_BOT_ID>?start=action11)
(we already have this possibility, but TelegramClient MUST not show START button when bot sends command to itself, condition1 is TRUE)
action12 = [action12](tg://<THIS_BOT_ID>/action?callback_data=action12)
color image
condition1:
This link was generated by this bot itself. This condition can be checked with:
(message?.from?.id === <THIS_BOT_ID>) or (message?.forward_from?.id === <THIS_BOT_ID>)
Related article:
https://stackoverflow.com/questions/46319157/link-in-telegram-bot-so-the-user-can-call-a-bot-command
INLINE BOT URL ~ INLINE BUTTON
ACTION ~ CALLBACK
URL Spec:
tg://<BOT_ID>?data=<ENCODED_DATA>
Where:
BOT_ID - self-descriptive, bot identifier, not the name, because bot may not know its name and there is extra step to get and set it.
ENCODED_DATA - same as callback data described in the Bot API, have to be encoded somehow, to preserve correctness
Why:
As you can see in the image, i've posted and, according to the major bot update 2.0:
"Since inline keyboards don‘t send additional messages to the chat, it made sense to give bots a way of manipulating their existing messages, so that they don’t have to send a new message each time they need to update something. This helps reduce clutter and build more fluid interfaces."
Additional control source in the message text may improve usability.