import telebot
bot = telebot.TeleBot(' - - - ')
data = []
def main():
@bot.message_handler(commands = ['start'])
def foo(message):
msg = bot.send_message(message.chat.id,'введите имя')
bot.register_next_step_handler(msg,name)
def name(message):
name = message.text
data.append(name)
msg = bot.send_message(message.chat.id,'введите возраст')
bot.register_next_step_handler(msg,age)
def age(message):
data.append(message.age)
return data
if __name__ == '__main__':
print(main())
bot.enable_save_next_step_handlers(delay=2)
bot.load_next_step_handlers()
bot.polling()
@bot.message_handler(commands = ['info'])
def send_info(message):
bot.send_message(message.chat.id, f'data={data}')