Как вариант - создать переменную-флаг, которая будет игнорировать двойные нажатия на кнопку.
Пример кода:
import telebot
from telebot import types
bot = telebot.TeleBot('token')
is_processing_command = False
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
item1 = types.KeyboardButton("click")
markup.row(item1)
@bot.message_handler(func=lambda message: message.text == "/start")
def notification(message):
bot.send_message(message.chat.id, "click on button", reply_markup=markup)
@bot.message_handler(func=lambda message: message.text == "click" and message.chat.type == 'private')
def par(message):
global is_processing_command
if not is_processing_command:
is_processing_command = True
bot.send_message(message.chat.id, "enter text!", reply_markup=markup)
bot.register_next_step_handler(message, send)
def send(message):
global mess, is_processing_command
mess = message.text
bot.send_message(message.chat.id, "you wrote: " + mess, reply_markup=markup)
is_processing_command = False
bot.infinity_polling()