@bot.message_handler(commands=['add'])
def handle_text (message):
bot.send_message(message.chat.id, f"{message.from_user.first_name}, введите адрес")
@bot.message_handler(content_types=['text'])
def handle_text(message):
db = sqlite3.connect('db.sqlite')
cursor = db.cursor()
txt = message.text
zap = txt.rsplit(' ', 1)
street = zap[0]
house = zap[1]
street_str = zap[0].lower()
cursor.execute("SELECT * FROM tkd WHERE street_str LIKE '%' || ? || '%' AND house = ?", (street_str, house))
res = cursor.fetchone()
if bool(res):
step_2 = res[0]
else:
bot.send_message(message.chat.id, 'Проверьте адрес')
bot.register_next_step_handler(message, step_2)
@bot.message_handler(content_types=['text'])
def step_2(message):
id_k = message.text
bot.send_message(message.chat.id, f'Вы выбрали ID: {id_k}')