import telebot
from config import TOKEN
from telebot import types
bot = telebot.TeleBot(TOKEN)
users = {}
@bot.message_handler(commands=['start'])
def welcome(message):
chat_id = message.chat.id
keyboard = telebot.types.ReplyKeyboardMarkup()
markup = types.InlineKeyboardMarkup()
button1 = types.InlineKeyboardButton('Start1', callback_data='1')
button2 = types.InlineKeyboardButton('Start2', url = 'asfon.com')
button3 = types.InlineKeyboardButton('Site', url ='asgag.com')
button4 = types.InlineKeyboardButton('Instagram', url = 'instagram.com')
markup.add(button1, button2, button3, button4, row_width=1)
button_save = telebot.types.InlineKeyboardButton(
text="Send info")
keyboard.add(button_save)
bot.send_message(chat_id,
'Hello',
reply_markup=markup)
@bot.message_handler(
func=lambda message: message.text == 'Send info')
def write_to_support(message):
chat_id = message.chat.id
bot.send_message(chat_id, 'surname')
users[chat_id] = {}
bot.register_next_step_handler(message, save_surname)
def save_surname(message):
chat_id = message.chat.id
surname = message.text
users[chat_id]['surname'] = surname
bot.send_message(chat_id, f'{surname}. name')
bot.register_next_step_handler(message, save_username)
def save_username(message):
chat_id = message.chat.id
username = message.text
users[chat_id]['username'] = username
bot.send_message(chat_id, f'{username}. lastname')
bot.register_next_step_handler(message, save_lastname)
def save_lastname(message):
chat_id = message.chat.id
lastname = message.text
users[chat_id]['lastname'] = lastname
bot.send_message(chat_id, f'{lastname}. age')
bot.register_next_step_handler(message, save_age)
def save_age(message):
chat_id = message.chat.id
age = message.text
users[chat_id]['age'] = age
bot.send_message(chat_id, f'{age}. number')
bot.register_next_step_handler(message, save_phone)
def save_portf(message):
chat_id = message.chat.id
portf = message.text
users[chat_id]['portf'] = portf
keyboard = telebot.types.InlineKeyboardMarkup()
button_save = telebot.types.InlineKeyboardButton(text="save",
callback_data='save_data')
button_change = telebot.types.InlineKeyboardButton(text="change",
callback_data='change_data')
keyboard.add(button_save, button_change)
bot.send_message(chat_id, f'save?', reply_markup=keyboard)