Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

telegram bot prefill text for user to edit

Telegram bot sends me a message with a text snippet, which I want to edit, and send back to the bot for further processing.

Copy and paste takes time. Typing message anew takes time.

Ideally I'd like to press an inline button "Edit" on the bot's message and get the message text appear in my reply input box for editing.(A message id attached to my reply somehow would be a plus).

I tried to use deep linking with parameters other than /start*, but that doesn't seem to work.

Can I use bot API (or any other telegram API) to have text ready for editing in my input box?

like image 280
horsh Avatar asked Jul 28 '17 00:07

horsh


People also ask

Can a Telegram bot send message to user?

In order to send a message to "@Username", you will need them to start your bot, and then store the username with the user_id. Then, you can input the username to find the correct user_id each time you want to send them a message.

What is inline query in Telegram bot?

With inline queries, users can search for, browse, and send content suggested by your bot in any chat, even if it is not a member there. To do this, they start a message with @your_bot_name and choose one of the results. Enable Inline Mode.

Can a Telegram bot initiate a conversation?

Telegram Bots can't initiate a conversation with a user. In your case, you can ask the user to start the bot before asking questions in the channel, for example by attaching a button containing the bot URL (https://t.me/bot_username).


1 Answers

It's impossible in official apps yet. Your question is about working with drafts - there are no methods in both API to create them or clear.


Nevertheless, you could fork any official app stored on GiHub and implement what you need if you would prefer a hard way, but compared to that copy/past solution seems much more easier, isn't it?


UPD

I can offer to you a new idea how to solve your problem - hope it will be helpful.

This is about switch_inline_query_current_chat field of InlineKeyboardButton. Just attach an inline button to messages you need to edit. Set a text for this field gotten from recieved message and after pressing you will get this text to your input area. All seems good, but you will take bot's username before the text also.

like image 122
anatol Avatar answered Sep 18 '22 15:09

anatol