Пишу бота на python с библиотекой PyTelegramBotAPI и столкнулся с проблемой что при нажатии на первые кнопки все работает а вторые не обрабатывает, хотя ошибок программа не видит.
from typing import Text
import telebot
import config
from telebot import types
bot = telebot.TeleBot(config.TOKEN)
@bot.message_handler(commands=['start'])
def start_command(message):
markup = types.InlineKeyboardMarkup(row_width=1)
item1 = types.InlineKeyboardButton('CV', callback_data = 'CV')
item2 = types.InlineKeyboardButton('Vacancy', callback_data= 'Vacancy')
markup.add(item1)
markup.add(item2)
bot.send_message(message.chat.id, "What would you like to create:", reply_markup=markup)
@bot.callback_query_handler(func=lambda call:True)
def callback(call):
if call.message:
if call.data == 'CV':
markup = types.InlineKeyboardMarkup(row_width=4)
item1 = types.InlineKeyboardButton('Development (Frontend, backend, full-stack, mobile, web, gamedev)', callback_data = '1')
item2 = types.InlineKeyboardButton('Testing', callback_data = '2')
item3 = types.InlineKeyboardButton('DevOps/Admin', callback_data = 'DevOps/Admin')
item4 = types.InlineKeyboardButton('Data Science', callback_data = 'Data Science')
item5 = types.InlineKeyboardButton('TOP Management (CTO, CIO, Director)', callback_data = 'TOP Management')
item6 = types.InlineKeyboardButton('Support, Helpdesk', callback_data = 'Support, Helpdesk')
item7 = types.InlineKeyboardButton('PR, marketing, advertising. ', callback_data = 'PR')
item8 = types.InlineKeyboardButton('Project/Product manager,HR', callback_data = 'Project')
item9 = types.InlineKeyboardButton('Design', callback_data = 'Design')
markup.add(item1)
markup.add(item2,item3,item4)
markup.add(item5)
markup.add(item6,item8)
markup.add(item7,item9)
bot.send_message(call.message.chat.id, "CV - Choose a specialization :", reply_markup=markup)
elif call.data == 'Vacancy':
markup = types.InlineKeyboardMarkup(row_width=1)
item1 = types.InlineKeyboardButton('less then $1000', callback_data = 'less')
item2 = types.InlineKeyboardButton('$1000-$3000', callback_data = 'less')
item3 = types.InlineKeyboardButton('$3000-$6000', callback_data = 'less')
item4 = types.InlineKeyboardButton('more then $6000', callback_data = 'less')
markup.add(item1)
markup.add(item2)
markup.add(item3)
markup.add(item4)
bot.send_message(call.message.chat.id,"Your budget($):", reply_markup=markup)
#Блок ниже не обрабатывает кнопки
@bot.callback_query_handler(func=lambda call_1:True)
def callback(call):
if call.message:
if call.data == '1':
markup = types.InlineKeyboardMarkup(row_width=4)
item_1 = types.InlineKeyboardButton('Development (Frontend, backend, full-stack, mobile, web, gamedev)', callback_data = 'Development')
markup.add(item_1)
bot.send_message(call.message.chat.id, "CV - Choose a specialization :", reply_markup=markup)
elif call.data == '2':
markup = types.InlineKeyboardMarkup(row_width=1)
item_1 = types.InlineKeyboardButton('less then $1000', callback_data = 'less')
markup.add(item_1)
bot.send_message(call.message.chat.id,"Your budget($):", reply_markup=markup)
bot.polling(none_stop=True) ```