Search code examples
pythonpython-3.xtelegramtelegram-botpython-telegram-bot

Press button of telegram bot keyboard but do not send out the message


I would like to have the user press the button of a telegram bot's keyboard but not send out the message. The message will appear in the message box for user to do further editing but it will not be sent out. The purpose is to produce a template message for user to do further editing.

A simple code example for keyboard is here.

https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/inlinekeyboard.py

I am open to using any kind of keyboard besides inline keyboard. The objective is to have a template message for user.

I am using python telegram bot v12.7 and python 3.7.


Solution

  • I gather you want to prefill text field for user, that is possible with switch_inline_query_current_chat as explained in stackoverflow. You have to turn on the inline_mode in botfather for it to work. Additionally, in the text field of user @botusername will be added

    Docs for the python-telegram-bot can be found here