Can I get Telegram bot to enter text in a custom message input field?

I am creating a Telegram bot in which a user sends messages that are then sent to another site. A bot can often give the user a suggestion on what to write, but the user must be able to change that suggestion before publishing it.

I could send this proposal as a message from the bot to the user, and the user could copy and paste it into the message input field. Copying and pasting is a bit cumbersome, however, especially on a touch device. It would be much more convenient if I could put the text directly into the edit box.

Is it possible?

Now I am using the Tgfancy library , but I don't mind using another library if it has this functionality.

Thank!

+3


source to share


2 answers


telegram released their api 3.0 bot on May 18, 2017 and there is no access to access or manipulate the custom chat club.

I don’t know what kind of proposals you want to provide, and what types of texts you want to accept. but there are two things you can try:



  • if your users send some predefined short messages, you can define some commands for them. (e.g. / hello, / howareyou, ...). the telegram itself automatically offers commands to the bot users.

  • you can use inlineKeyboardButtons to display suggested texts. Note that the inlineKeyboardButtons can be updated without sending an additional message to the user. but how? the user can send his first word to the bot, and the bot will send a response message with inlineKeyboardButtons containing the suggested texts, and the user can select the desired completion text (by clicking on the selected option), then the application will update the message and its keyboards showing the new options. Note that your posts must have an additional inlineKeboard button to be used as a sign of the end of the text completion process.

+1


source


switch_inline_query_current_chat InlineKeyboardButton

is what is needed to pre-fill the text area with your inline query parameter



0


source







All Articles