Почему в этом куске кода не работают кнопки?
Пока что подключена только кнопка brend(в стартовом меню она работает), но в этом куске уже нет
@bot.callback_query_handler(func=lambda call: call.data == "nike")
def nike(callback):
markup = types.InlineKeyboardMarkup()
next = types.InlineKeyboardButton(text='➡️', callback_data='nike1')
back = types.InlineKeyboardButton(text='⬅️', callback_data='net')
back1 = types.InlineKeyboardButton(text='бренд', callback_data='brend')
nike1 = types.InlineKeyboardButton(text='1', callback_data='nike1')
nike2 = types.InlineKeyboardButton(text='2', callback_data='nike2')
nike3 = types.InlineKeyboardButton(text='3', callback_data='nike3')
nike4 = types.InlineKeyboardButton(text='4', callback_data='nike6')
nike5 = types.InlineKeyboardButton(text='5', callback_data='nike5')
markup.row(back, back1, next)
markup.add(nike1, nike2, nike3, nike4, nike5)
bot.delete_message(chat_id=callback.message.chat.id, message_id=callback.message.id)
photo_file_path = 'nikelogo.png'
bot.send_photo(chat_id=callback.message.chat.id, photo=open(photo_file_path, 'rb'),
caption='Выберите нужную вам модель:\n1:Nike TN\n2:Nike Air Max 90\n3:Nike SB Force Premium\n4:Nike Force One\n5:Nike Initiator\n\nДля осмотра каждой пары можете нажать стрелку', reply_markup=markup)
ошибки:
2024-10-05 17:04:33,869 (__init__.py:1241 MainThread) ERROR - TeleBot: "Threaded polling exception: A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: there is no text in the message to edit"
2024-10-05 17:04:33,870 (__init__.py:1243 MainThread) ERROR - TeleBot: "Exception traceback:
Traceback (most recent call last):
File "/Users/artemdrozhzhin/VSCode/ShoesBot/.venv/lib/python3.9/site-packages/telebot/__init__.py", line 1235, in __threaded_polling
self.worker_pool.raise_exceptions()
File "/Users/artemdrozhzhin/VSCode/ShoesBot/.venv/lib/python3.9/site-packages/telebot/util.py", line 150, in raise_exceptions
raise self.exception_info
File "/Users/artemdrozhzhin/VSCode/ShoesBot/.venv/lib/python3.9/site-packages/telebot/util.py", line 93, in run
task(*args, **kwargs)
File "/Users/artemdrozhzhin/VSCode/ShoesBot/.venv/lib/python3.9/site-packages/telebot/__init__.py", line 8945, in _run_middlewares_and_handler
result = handler['function'](message)
File "/Users/artemdrozhzhin/VSCode/ShoesBot/ShoesBot.py", line 48, in brend
bot.edit_message_text(chat_id=callback.message.chat.id, message_id=callback.message.id,
File "/Users/artemdrozhzhin/VSCode/ShoesBot/.venv/lib/python3.9/site-packages/telebot/__init__.py", line 4875, in edit_message_text
result = apihelper.edit_message_text(
File "/Users/artemdrozhzhin/VSCode/ShoesBot/.venv/lib/python3.9/site-packages/telebot/apihelper.py", line 1465, in edit_message_text
return _make_request(token, method_url, params=payload, method='post')
File "/Users/artemdrozhzhin/VSCode/ShoesBot/.venv/lib/python3.9/site-packages/telebot/apihelper.py", line 168, in _make_request
json_result = _check_result(method_name, result)
File "/Users/artemdrozhzhin/VSCode/ShoesBot/.venv/lib/python3.9/site-packages/telebot/apihelper.py", line 195, in _check_result
raise ApiTelegramException(method_name, result, result_json)
telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: there is no text in the message to edit
"