-1

I am Creating a telegram bot using python and using the python-telegram-bot library for sending the response but how do I take Input from the input using this library?

Have a great Day ahead Programmers

1 Answers1

0

With python-telegram-bot v12.0.0b1 you can do it like this:

def do_something(user_input):
    answer = "You have wrote me " + user_input
    return answer

def reply(update, context):
    user_input = update.message.text
    update.message.reply_text(do_something(user_input))

def main():
    updater = Updater("TOKEN", use_context=True)
    dp = updater.dispatcher
    dp.add_handler(MessageHandler(Filters.text, reply))
    updater.start_polling()
    updater.idle()
Omar KASMI
  • 26
  • 2