import telebot
import time
from telebot import types
bot = telebot.TeleBot('5496671448:AAGS-ORYxWXczkFuosaI73YLp2fsLRI5ZSo')
@bot.message_handler(commands=['start'])
def captcha(message):
markup = types.InlineKeyboardMarkup(row_width=3)
item1 = types.InlineKeyboardButton("2VVK", callback_data='error')
item2 = types.InlineKeyboardButton("2YYk", callback_data='error')
item3 = types.InlineKeyboardButton("2VYK", callback_data='start')
markup.add(item1, item2, item3)
photo = open('captcha/cap.jpg','rb')
bot.send_photo(message.chat.id, photo, caption="Please enter the captcha:", parse_mode='html', reply_markup=markup)
@bot.callback_query_handler(func= lambda call: True)
def exchange(call):
if call.data == 'error':
bot.answer_callback_query(callback_query_id=call.id, show_alert=True, text="Error. Try again")
if call.data == 'start':
markup = types.InlineKeyboardMarkup(row_width=3)
item1 = types.InlineKeyboardButton("Кнопка", callback_data='ex')
item2 = types.InlineKeyboardButton("Кнопка", callback_data = 'course')
item3 = types.InlineKeyboardButton("Кнопка", url='https://t.me/силка')
markup.add(item1)
markup.add(item2)
markup.add(item3)
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text="Привет", parse_mode='html', reply_markup=markup)
bot.polling(none_stop=True)
Нужно удалить только фото, так как текст меняется через edit.message