Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. updater = Updater(TOKEN)
  2.  
  3. def bottom(bot, update):
  4. global command
  5. print("botoom function called")
  6. counter = 0
  7. keyboard_list = [[KeyboardButton("about us")],
  8. [KeyboardButton("MBTI test")]]
  9. markup = ReplyKeyboardMarkup(keyboard_list)
  10. chat_id = update.message.chat_id
  11. bot.sendMessage(chat_id=chat_id,text='Hi welcome to my bot',reply_markup=markup)
  12.  
  13. def news(bot,update):
  14. option = update.message.text
  15. chat_id = update.message.chat_id
  16. print ("new function run")
  17. print (option)
  18. if option == 'about us':
  19. keyboard_list = [[KeyboardButton("return")]]
  20. markup = ReplyKeyboardMarkup(keyboard_list)
  21. if option == 'return':
  22. updater.dispatcher.add_handler(MessageHandler([Filters.text],bottom))
  23.  
  24. bot.sendMessage(chat_id,text='you chose about us',reply_markup=markup)
  25.  
  26. elif option == 'MBTI test':
  27. bot.sendMessage(chat_id,'you chose mbti test')
  28.  
  29. updater.dispatcher.add_handler(CommandHandler('start',bottom))
  30. updater.dispatcher.add_handler(MessageHandler([Filters.text], news))
  31. updater.start_polling()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement