Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. @bot.callback_query_handler(func=lambda call: True)
  2. def callback(call):
  3. if call.data == 'game':
  4. #Inline markup | game type choose
  5. gameType = types.InlineKeyboardMarkup(row_width=1)
  6. item1 = types.InlineKeyboardButton(text = 'Тест', callback_data = 'testGame')
  7. item2 = types.InlineKeyboardButton(text = 'Бесконечные игра', callback_data = 'infinityGame')
  8. gameType.add(item1,item2)
  9. #send message with choos type game
  10. bot.edit_message_text('Игра',call.message.chat.id, call.message.message_id,reply_markup=gameType)
  11.  
  12. if call.data == 'testGame':
  13. #generate message and markup
  14. numberQuiz = random.randint(1,57)
  15. #send message with question
  16. bot.edit_message_text('1-ый вопрос',call.message.chat.id, call.message.message_id,reply_markup=logic.generateMarkup(2))
  17.  
  18.  
  19. @bot.callback_query_handler(func=lambda call: True)
  20. def call(call):
  21. if call.data == 'infinityGame':
  22. bot.edit_message_text('Игра',call.message.chat.id, call.message.message_id)
  23.  
  24. if __name__ == "__main__":
  25. print("Good luck!")
  26. bot.infinity_polling()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement