Мне нужно чтобы только при вводе ключа находящийся в переменной key начинал работать код. Помогите пожалуйста выполнить данную задачу. Код:
import telebot
from telebot import types
from telebot import types
import time
from urllib.request import urlopen
Key=120301021012234125
bot = telebot.TeleBot('http api')
@bot.message_handler(commands = ['start'])
def start(message):
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
btn1 = types.KeyboardButton("Руссикй язык")
btn2 = types.KeyboardButton('История')
btn3 = types.KeyboardButton("Обществознание")
btn4 = types.KeyboardButton('Геометрия')
btn5 = types.KeyboardButton("Алгебра",)
btn6 = types.KeyboardButton('Физика')
btn7 = types.KeyboardButton("Литература")
btn8 = types.KeyboardButton('География')
markup.add(btn1, btn2,btn3,btn4,btn5,btn6,btn7,btn8)
bot.send_message(message.from_user.id, "Выберите предмет", reply_markup=markup)
@bot.message_handler(func=lambda msg: msg.text == 'Алгебра')
def get_user_photo(message: types.Message):
bot.send_photo(message.chat.id, "https://i.imgur.com/ofwPfHE.png")
@bot.message_handler(func=lambda msg: msg.text == 'Руссикй язык')
def get_user_photo(message: types.Message):
bot.send_photo(message.chat.id, "https://i.imgur.com/ofwPfHE.png")
@bot.message_handler(func=lambda msg: msg.text == 'Литература')
def get_user_photo(message: types.Message):
bot.send_photo(message.chat.id, "https://i.imgur.com/ofwPfHE.png")
@bot.message_handler(func=lambda msg: msg.text == 'Обществознание')
def get_user_photo(message: types.Message):
bot.send_photo(message.chat.id, "https://i.imgur.com/ofwPfHE.png")
@bot.message_handler(func=lambda msg: msg.text == 'Геометрия')
def get_user_photo(message: types.Message):
bot.send_photo(message.chat.id, "https://i.imgur.com/ofwPfHE.png")
@bot.message_handler(func=lambda msg: msg.text == 'Физика')
def get_user_photo(message: types.Message):
bot.send_photo(message.chat.id, "https://i.imgur.com/ofwPfHE.png")
bot.polling(none_stop=True, interval=0)