@bot.message_handler(commands=['start'])
def process_start(message):
board = types.InlineKeyboardMarkup()
cancel = types.InlineKeyboardButton(text="Отмена", callback_data="Отмена")
board.add(cancel)
text = 'start'
msg = bot.send_message(message.chat.id, text, reply_markup=board)
bot.register_next_step_handler(msg, process_mid)
def process_mid(message):
board = types.InlineKeyboardMarkup()
cancel = types.InlineKeyboardButton(text="Отмена", callback_data="Отмена")
board.add(cancel)
text = 'mid'
msg = bot.send_message(message.chat.id, text, reply_markup=board)
bot.register_next_step_handler(msg, process_end)
def process_end(message):
text = 'end'
bot.send_message(message.chat.id, text)
@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
if call.message:
if call.data == "Отмена":
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text='Отменено.')
bot.clear_step_handler_by_chat_id(chat_id=call.message.chat.id)
bot.polling(none_stop=True)