How can I make the inline button work/respond only 1 time? Telebot

Viewed 23

Here is my code:

import telebot
from telebot import types
import config

bot = telebot.TeleBot(config.token)

@bot.message_handler(commands=['start'], chat_types=['private'])
def start(message):
  keyboard = types.InlineKeyboardMarkup()
  keyboard.add(types.InlineKeyboardButton('Join', callback_data='join'))
  bot.send_message(message.chat.id, '''Press "<b>Join</b>" button to continue...''', parse_mode='html', reply_markup=keyboard)

@bot.callback_query_handler(func=lambda call: True)
def all(call):
  if call.data == 'join':
        bot.send_message(call.message.chat.id, '''Welcome''')

bot.polling()

I want the 'join' button to work/respond only 1 time. Also, I used delete_message and it gives me error when I click the button multiple times very fast before it gets deleted.

0 Answers
Related