So I am making a trading bot the user first have to type "/BUY" for the first command. And every user have some settings saved up in files so I want them to choose to buy with old settings or new ones. I tried to put a command instead of a text but that was impractical because anyone can use it without having to go the first one This is my code for now:
from telebot import types
import telebot
from decouple import config
BOT_TOKEN = config('BOT_TOKEN')
bot = telebot.TeleBot(BOT_TOKEN)
@bot.message_handler(commands=['Start'])
def msg_hndl(message):
print(message)
markup =types.ReplyKeyboardMarkup(one_time_keyboard=True,selective=True)
markup.row_width = 2
button1 =types.InlineKeyboardButton(text="/BUY",callback_data="test",selective=True)
markup.add(button1)
bot.send_message(message.chat.id,"Choose @"+message.from_user.username, reply_markup=markup)
@bot.message_handler(commands=['BUY'])
def msg_hndl(message):
markup2 = types.ReplyKeyboardMarkup(one_time_keyboard=True,selective=True)
markup2.row_width = 2
button1 = types.InlineKeyboardButton(text="/New_settings", callback_data="test")
button2 = types.InlineKeyboardButton(text="/Old_settings", callback_data="test")
markup2.add(button1,button2)
bot.send_message(message.chat.id,"Choose @"+message.from_user.username, reply_markup=markup2)
@bot.message_handler(commands=['New_settings'])
def msg_hndl(message):
#do something
bot.polling()
So I did the research myself and saw the only solution is to save messages and have a message handler that saves the user id and compare it everytime.