Easy task, but I can't figure out how to do it.
I'd like to check if user press the button 'Add variants' to add next messages from user to list variants. I tried to do it using if message.text == 'Add variants', but it just adds to the
list text 'Add variants' one time and that's it. Is there any way to check if user click the button and after that add next messages from user to list?
variants = []
@bot.message_handler(commands=['start', 'welcome'])
def start(message):
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
item_1 = types.KeyboardButton('Random')
item_2 = types.KeyboardButton('TradingView')
item_3 = types.KeyboardButton('Weather')
item_4 = types.KeyboardButton('Other')
item_5 = types.KeyboardButton('Back')
markup.add(item_1, item_2, item_3, item_4, item_5)
bot.send_message(message.chat.id, 'Choose', reply_markup = markup)
@bot.message_handler(content_types=['text'])
def bot_message(message):
if message.chat.type == 'private':
if message.text == 'Random':
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
item_1 = types.KeyboardButton('Add variants')
item_2 = types.KeyboardButton('Back')
markup.add(item_1, item_2)
bot.send_message(message.chat.id, 'Choose', reply_markup = markup)