import telebot from telebot import types text = 0 token = '5613697444:AAHiBSiXFdu3k98FBPHoW9ePydOI88Z7Ks0' bot = telebot.TeleBot(token) @bot.message_handler(commands=['start']) def start(message): markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("Начать") btn2 = types.KeyboardButton("help") markup.add(btn1, btn2) answer = bot.send_message(message.chat.id, "Привет, Я Бот для подбора музыкальных нот в зависимости от инструмента и уровня ", reply_markup=markup) bot.register_next_step_handler(answer, greeting) def greeting(message): text = message.text if text == "Начать": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("Флейта") btn2 = types.KeyboardButton("Фортепиано") btn3 = types.KeyboardButton("Скрипка") btn4 = types.KeyboardButton("Хочу другое!!!!") markup.add(btn1, btn2, btn3, btn4) answer = bot.send_message(message.chat.id, "Для начала выбери инструмент. ", reply_markup=markup) bot.register_next_step_handler(answer, instruments) elif text == "help": answer = bot.send_message(message.chat.id, "Напиши что угодно в чат чтобы начать") bot.register_next_step_handler(answer, start) def instruments(message): text = message.text if text == "Флейта": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("Начинающий") btn2 = types.KeyboardButton("Продолжающий") btn4 = types.KeyboardButton("Профи") btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало") markup.add(btn1, btn2, btn4, btn5) answer = bot.send_message(message.chat.id, "Выбери уровень сложности для нот на флейте.", reply_markup=markup) bot.register_next_step_handler(answer, flute_difficulty) elif text == "Фортепиано": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("Начинающий") btn2 = types.KeyboardButton("Продолжающий") btn4 = types.KeyboardButton("Профи") btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало") markup.add(btn1, btn2, btn4, btn5) answer = bot.send_message(message.chat.id, "Выбери уровень сложности для нот на фортепиано.", reply_markup=markup) bot.register_next_step_handler(answer, piano_difficulty) elif text == "Скрипка": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("Начинающий") btn2 = types.KeyboardButton("Продолжающий") btn4 = types.KeyboardButton("Профи") btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало") markup.add(btn1, btn2, btn4, btn5) answer = bot.send_message(message.chat.id , "Выбери уровень сложности для нот на Скрипке.",reply_markup=markup) bot.register_next_step_handler(answer, violin_difficulty) elif text == "Хочу другое!!!!": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("Ок, понял") markup.add(btn1) answer = bot.send_message(message.chat.id, "Мы Всегда стремимся улучшаться, поэтому можете писать @wthtbhidk и он скорее всего вам быстро ответит", reply_markup=markup) bot.register_next_step_handler(answer, start) def flute_difficulty(message): text = message.text if text == "Начинающий": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("A bicycle built for two") btn2 = types.KeyboardButton("Abide with me") btn3 = types.KeyboardButton("Alouette") btn4 = types.KeyboardButton("Amazing Grace") btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало") markup.add(btn1, btn2, btn3, btn4, btn5) answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup) bot.register_next_step_handler(answer, flute_new_files) elif text == "Продолжающий": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("Badinerie") btn2 = types.KeyboardButton("Swan Theme") btn3 = types.KeyboardButton("Sicilienne") btn4 = types.KeyboardButton("Habanera") btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало") markup.add(btn1, btn2, btn3, btn4, btn5) answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup) bot.register_next_step_handler(answer, flute_med_files) elif text == "Профи": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("Flight of the bumblebee") btn2 = types.KeyboardButton("Morning Mood") btn3 = types.KeyboardButton("произведение 3") btn4 = types.KeyboardButton("произведение 4") btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало") markup.add(btn1, btn2, btn3, btn4, btn5) answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup) bot.register_next_step_handler(answer, flute_pro_files) def piano_difficulty(message): text = message.text if text == "Начинающий": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("произведение 1") btn2 = types.KeyboardButton("произведение 2") btn3 = types.KeyboardButton("произведение 3") btn4 = types.KeyboardButton("произведение 4") btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало") markup.add(btn1, btn2, btn3, btn4, btn5) answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup) bot.register_next_step_handler(answer, piano_new_files) elif text == "Продолжающий": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("произведение 1") btn2 = types.KeyboardButton("произведение 2") btn3 = types.KeyboardButton("произведение 3") btn4 = types.KeyboardButton("произведение 4") btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало") markup.add(btn1, btn2, btn3, btn4, btn5) answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup) bot.register_next_step_handler(answer, piano_med_files) elif text == "Профи": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("произведение 1") btn2 = types.KeyboardButton("произведение 2") btn3 = types.KeyboardButton("произведение 3") btn4 = types.KeyboardButton("произведение 4") btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало") markup.add(btn1, btn2, btn3, btn4, btn5) answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup) bot.register_next_step_handler(answer, piano_pro_files) def violin_difficulty(message): text = message.text if text == "Начинающий": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("произведение 1") btn2 = types.KeyboardButton("произведение 2") btn3 = types.KeyboardButton("произведение 3") btn4 = types.KeyboardButton("произведение 4") btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало") markup.add(btn1, btn2, btn3, btn4, btn5) answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup) bot.register_next_step_handler(answer, violin_new_files) elif text == "Продолжающий": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("произведение 1") btn2 = types.KeyboardButton("произведение 2") btn3 = types.KeyboardButton("произведение 3") btn4 = types.KeyboardButton("произведение 4") btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало") markup.add(btn1, btn2, btn3, btn4, btn5) answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup) bot.register_next_step_handler(answer, violin_med_files) elif text == "Профи": markup = types.ReplyKeyboardMarkup(resize_keyboard=True) btn1 = types.KeyboardButton("произведение 1") btn2 = types.KeyboardButton("произведение 2") btn3 = types.KeyboardButton("произведение 3") btn4 = types.KeyboardButton("произведение 4") btn5 = types.KeyboardButton("Так, я тут что-то напутал, пожалуй вернусь в начало") markup.add(btn1, btn2, btn3, btn4, btn5) answer = bot.send_message(message.chat.id, "Выбери произведение", reply_markup=markup) bot.register_next_step_handler(answer, violin_pro_files) def flute_new_files(message): text = message.text if text == "A bicycle built for two": with open('data/Flute_beginner1.pdf', 'rb') as f: bot.send_document(message.chat.id, f) elif text == "Abide with me": with open('data/Flute_beginner2.pdf', 'rb') as f: bot.send_document(message.chat.id, f) elif text == "Alouette": with open('data/Flute_beginner3.pdf', 'rb') as f: bot.send_document(message.chat.id, f) elif text == "Amazing Grace": with open('data/Flute_beginner4.pdf', 'rb') as f: bot.send_document(message.chat.id, f) elif text == "Так, я тут что-то напутал, пожалуй вернусь в начало": bot.register_next_step_handler(start) def flute_med_files(message): text = message.text if text == "Badinerie": with open('data/Flute_med1.pdf', 'rb') as f: bot.send_document(message.chat.id, f) elif text == "Swan Theme": with open('data/Flute_med2.pdf', 'rb') as f: bot.send_document(message.chat.id, f) elif text == "Sicilienne": with open('data/Flute_beginner3.pdf', 'rb') as f: bot.send_document(message.chat.id, f) elif text == "Habanera": with open('data/Flute_beginner4.pdf', 'rb') as f: bot.send_document(message.chat.id, f) elif text == "Так, я тут что-то напутал, пожалуй вернусь в начало": bot.register_next_step_handler(start) def flute_pro_files(message): text = message.text if text == "Flight of the bumblebee": with open('data/Flute_pro1.pdf', 'rb') as f: bot.send_document(message.chat.id, f) elif text == "Morning Mood": with open('data/Flute_pro2.pdf', 'rb') as f: bot.send_document(message.chat.id, f) elif text == "Alouette": with open('data/Flute_pro3.pdf', 'rb') as f: bot.send_document(message.chat.id, f) elif text == "Amazing Grace": with open('data/Flute_pro4.pdf', 'rb') as f: bot.send_document(message.chat.id, f) elif text == "Так, я тут что-то напутал, пожалуй вернусь в начало": bot.register_next_step_handler(start) bot.infinity_polling()