У меня есть код на питоне для отправки сообщений и последующего их редактирования.
Но при изменении текста и кнопок в уже имеющемся сообщении, текст меняется, но кнопки пропадают.
При этом, если я отправлю новое сообщение с теми же кнопками, все будет работать идеально
Этот код не работает
if call.data == "python":
python_markup = telebot.types.InlineKeyboardMarkup(row_width=3)
counter_chapters = 0
for chapter in python_chapters_true:
counter_chapters += 1
if len(chapter) >= 33:
chapter_true = f"{chapter[:33]}"
chapter = chapter_true
chapter_true = f"{chapter_true}.."
else:
chapter_true = f"{chapter}"
button = telebot.types.InlineKeyboardButton(chapter_true,
callback_data=chapter)
python_markup.add(button)
bot.edit_message_text("Выбери главу:", chat_id=call.message.chat.id, message_id=call.message.message_id)
bot.edit_message_reply_markup(chat_id=call.message.chat.id, message_id=call.message.id,
reply_markup=python_markup)
А этот работает
if call.data == "python":
python_markup = telebot.types.InlineKeyboardMarkup(row_width=3)
counter_chapters = 0
for chapter in python_chapters_true:
counter_chapters += 1
if len(chapter) >= 33:
chapter_true = f"{chapter[:33]}"
chapter = chapter_true
chapter_true = f"{chapter_true}.."
else:
chapter_true = f"{chapter}"
button = telebot.types.InlineKeyboardButton(chapter_true,
callback_data=chapter)
python_markup.add(button)
bot.send_message("Выбери главу:", chat_id=call.message.chat.id, reply_markup=python_markup)