Facebook
From Иванов Максим, 9 Months ago, written in Python.
Embed
Download Paste or View Raw
Hits: 75
  1. import telebot
  2. from telebot import types
  3.  
  4. text = 0
  5.  
  6. token = '5613697444:AAHiBSiXFdu3k98FBPHoW9ePydOI88Z7Ks0'
  7. bot = telebot.TeleBot(token)
  8.  
  9.  
  10. @bot.message_handler(commands=['start'])
  11. def start(message):
  12.     markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  13.     btn1 = types.KeyboardButton("Начать")
  14.     btn2 = types.KeyboardButton("help")
  15.     markup.add(btn1, btn2)
  16.  
  17.     answer = bot.send_message(message.chat.id, "Привет, Я Бот для подбора музыкальных нот в зависимости от инструмента и уровня ", reply_markup=markup)
  18.     bot.register_next_step_handler(answer, greeting)
  19.  
  20.  
  21.  
  22. def greeting(message):
  23.     text = message.text
  24.     if text == "Начать":
  25.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  26.         btn1 = types.KeyboardButton("Флейта")
  27.         btn2 = types.KeyboardButton("Фортепиано")
  28.         btn3 = types.KeyboardButton("Скрипка")
  29.         btn4 = types.KeyboardButton("Хочу другое!!!!")
  30.         markup.add(btn1, btn2, btn3, btn4)
  31.         answer = bot.send_message(message.chat.id, "Для начала выбери инструмент. ", reply_markup=markup)
  32.         bot.register_next_step_handler(answer, instruments)
  33.     elif text == "help":
  34.         answer = bot.send_message(message.chat.id, "Напиши что угодно в чат чтобы начать")
  35.         bot.register_next_step_handler(answer, start)
  36.  
  37.  
  38. def instruments(message):
  39.     text = message.text
  40.     if text == "Флейта":
  41.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  42.         btn1 = types.KeyboardButton("Начинающий")
  43.         btn2 = types.KeyboardButton("Продолжающий")
  44.         btn4 = types.KeyboardButton("Профи")
  45.         btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало")
  46.         markup.add(btn1, btn2,  btn4, btn5)
  47.         answer = bot.send_message(message.chat.id, "Выбери уровень сложности для нот на флейте.", reply_markup=markup)
  48.         bot.register_next_step_handler(answer, flute_difficulty)
  49.     elif text == "Фортепиано":
  50.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  51.         btn1 = types.KeyboardButton("Начинающий")
  52.         btn2 = types.KeyboardButton("Продолжающий")
  53.  
  54.         btn4 = types.KeyboardButton("Профи")
  55.         btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало")
  56.         markup.add(btn1, btn2,  btn4, btn5)
  57.         answer = bot.send_message(message.chat.id, "Выбери уровень сложности для нот на фортепиано.", reply_markup=markup)
  58.         bot.register_next_step_handler(answer, piano_difficulty)
  59.     elif text == "Скрипка":
  60.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  61.         btn1 = types.KeyboardButton("Начинающий")
  62.         btn2 = types.KeyboardButton("Продолжающий")
  63.         btn4 = types.KeyboardButton("Профи")
  64.         btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало")
  65.         markup.add(btn1, btn2, btn4, btn5)
  66.         answer = bot.send_message(message.chat.id   , "Выбери уровень сложности для нот на Скрипке.",reply_markup=markup)
  67.         bot.register_next_step_handler(answer, violin_difficulty)
  68.     elif text == "Хочу другое!!!!":
  69.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  70.         btn1 = types.KeyboardButton("Ок, понял")
  71.         markup.add(btn1)
  72.         answer = bot.send_message(message.chat.id, "Мы Всегда стремимся улучшаться, поэтому можете писать @wthtbhidk и он скорее всего вам быстро ответит", reply_markup=markup)
  73.         bot.register_next_step_handler(answer, start)
  74.  
  75. def flute_difficulty(message):
  76.     text = message.text
  77.     if text == "Начинающий":
  78.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  79.         btn1 = types.KeyboardButton("A bicycle built for two")
  80.         btn2 = types.KeyboardButton("Abide with me")
  81.         btn3 = types.KeyboardButton("Alouette")
  82.         btn4 = types.KeyboardButton("Amazing Grace")
  83.         btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало")
  84.         markup.add(btn1, btn2, btn3, btn4, btn5)
  85.         answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup)
  86.         bot.register_next_step_handler(answer, flute_new_files)
  87.     elif text == "Продолжающий":
  88.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  89.         btn1 = types.KeyboardButton("Badinerie")
  90.         btn2 = types.KeyboardButton("Swan Theme")
  91.         btn3 = types.KeyboardButton("Sicilienne")
  92.         btn4 = types.KeyboardButton("Habanera")
  93.         btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало")
  94.         markup.add(btn1, btn2, btn3, btn4, btn5)
  95.         answer = bot.send_message(message.chat.id, "Выбери произведение",  reply_markup=markup)
  96.         bot.register_next_step_handler(answer, flute_med_files)
  97.  
  98.     elif text == "Профи":
  99.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  100.         btn1 = types.KeyboardButton("Flight of the bumblebee")
  101.         btn2 = types.KeyboardButton("Morning Mood")
  102.         btn3 = types.KeyboardButton("произведение 3")
  103.         btn4 = types.KeyboardButton("произведение 4")
  104.         btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало")
  105.         markup.add(btn1, btn2, btn3, btn4, btn5)
  106.         answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup)
  107.         bot.register_next_step_handler(answer, flute_pro_files)
  108.  
  109.  
  110.  
  111.  
  112. def piano_difficulty(message):
  113.     text = message.text
  114.     if text == "Начинающий":
  115.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  116.         btn1 = types.KeyboardButton("произведение 1")
  117.         btn2 = types.KeyboardButton("произведение 2")
  118.         btn3 = types.KeyboardButton("произведение 3")
  119.         btn4 = types.KeyboardButton("произведение 4")
  120.         btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало")
  121.         markup.add(btn1, btn2, btn3, btn4, btn5)
  122.         answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup)
  123.         bot.register_next_step_handler(answer, piano_new_files)
  124.     elif text == "Продолжающий":
  125.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  126.         btn1 = types.KeyboardButton("произведение 1")
  127.         btn2 = types.KeyboardButton("произведение 2")
  128.         btn3 = types.KeyboardButton("произведение 3")
  129.         btn4 = types.KeyboardButton("произведение 4")
  130.         btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало")
  131.         markup.add(btn1, btn2, btn3, btn4, btn5)
  132.         answer = bot.send_message(message.chat.id, "Выбери произведение",  reply_markup=markup)
  133.         bot.register_next_step_handler(answer, piano_med_files)
  134.  
  135.     elif text == "Профи":
  136.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  137.         btn1 = types.KeyboardButton("произведение 1")
  138.         btn2 = types.KeyboardButton("произведение 2")
  139.         btn3 = types.KeyboardButton("произведение 3")
  140.         btn4 = types.KeyboardButton("произведение 4")
  141.         btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало")
  142.         markup.add(btn1, btn2, btn3, btn4, btn5)
  143.         answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup)
  144.         bot.register_next_step_handler(answer, piano_pro_files)
  145.  
  146.  
  147. def violin_difficulty(message):
  148.     text = message.text
  149.     if text == "Начинающий":
  150.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  151.         btn1 = types.KeyboardButton("произведение 1")
  152.         btn2 = types.KeyboardButton("произведение 2")
  153.         btn3 = types.KeyboardButton("произведение 3")
  154.         btn4 = types.KeyboardButton("произведение 4")
  155.         btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало")
  156.         markup.add(btn1, btn2, btn3, btn4, btn5)
  157.         answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup)
  158.         bot.register_next_step_handler(answer, violin_new_files)
  159.     elif text == "Продолжающий":
  160.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  161.         btn1 = types.KeyboardButton("произведение 1")
  162.         btn2 = types.KeyboardButton("произведение 2")
  163.         btn3 = types.KeyboardButton("произведение 3")
  164.         btn4 = types.KeyboardButton("произведение 4")
  165.         btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало")
  166.         markup.add(btn1, btn2, btn3, btn4, btn5)
  167.         answer = bot.send_message(message.chat.id, "Выбери произведение",  reply_markup=markup)
  168.         bot.register_next_step_handler(answer, violin_med_files)
  169.  
  170.     elif text == "Профи":
  171.         markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
  172.         btn1 = types.KeyboardButton("произведение 1")
  173.         btn2 = types.KeyboardButton("произведение 2")
  174.         btn3 = types.KeyboardButton("произведение 3")
  175.         btn4 = types.KeyboardButton("произведение 4")
  176.         btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало")
  177.         markup.add(btn1, btn2, btn3, btn4, btn5)
  178.         answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup)
  179.         bot.register_next_step_handler(answer, violin_pro_files)
  180.  
  181.  
  182.  
  183.  
  184. def flute_new_files(message):
  185.     text = message.text
  186.     if text == "A bicycle built for two":
  187.         with open('data/Flute_beginner1.pdf', 'rb') as f:
  188.             bot.send_document(message.chat.id, f)
  189.     elif text == "Abide with me":
  190.         with open('data/Flute_beginner2.pdf', 'rb') as f:
  191.             bot.send_document(message.chat.id, f)
  192.     elif text == "Alouette":
  193.         with open('data/Flute_beginner3.pdf', 'rb') as f:
  194.             bot.send_document(message.chat.id, f)
  195.     elif text == "Amazing Grace":
  196.         with open('data/Flute_beginner4.pdf', 'rb') as f:
  197.             bot.send_document(message.chat.id, f)
  198.     elif text == "Так, я тут что-то напутал, пожалуй вернусь в начало":
  199.         bot.register_next_step_handler(start)
  200.  
  201.  
  202. def flute_med_files(message):
  203.     text = message.text
  204.     if text == "Badinerie":
  205.         with open('data/Flute_med1.pdf', 'rb') as f:
  206.             bot.send_document(message.chat.id, f)
  207.     elif text == "Swan Theme":
  208.         with open('data/Flute_med2.pdf', 'rb') as f:
  209.             bot.send_document(message.chat.id, f)
  210.     elif text == "Sicilienne":
  211.         with open('data/Flute_beginner3.pdf', 'rb') as f:
  212.             bot.send_document(message.chat.id, f)
  213.     elif text == "Habanera":
  214.         with open('data/Flute_beginner4.pdf', 'rb') as f:
  215.             bot.send_document(message.chat.id, f)
  216.     elif text == "Так, я тут что-то напутал, пожалуй вернусь в начало":
  217.         bot.register_next_step_handler(start)
  218.  
  219.  
  220.  
  221.  
  222. def flute_pro_files(message):
  223.     text = message.text
  224.     if text == "Flight of the bumblebee":
  225.         with open('data/Flute_pro1.pdf', 'rb') as f:
  226.             bot.send_document(message.chat.id, f)
  227.     elif text == "Morning Mood":
  228.         with open('data/Flute_pro2.pdf', 'rb') as f:
  229.             bot.send_document(message.chat.id, f)
  230.     elif text == "Alouette":
  231.         with open('data/Flute_pro3.pdf', 'rb') as f:
  232.             bot.send_document(message.chat.id, f)
  233.     elif text == "Amazing Grace":
  234.         with open('data/Flute_pro4.pdf', 'rb') as f:
  235.             bot.send_document(message.chat.id, f)
  236.     elif text == "Так, я тут что-то напутал, пожалуй вернусь в начало":
  237.         bot.register_next_step_handler(start)
  238.  
  239.  
  240. bot.infinity_polling()
  241.