def send_welcome(message): user = User(telegram_id=message.chat.id, username=message.chat.username) if user.not_in_base(): user.add_user_in_db() message = user.get_welcome_message() bot.send_message(chat_id=user.user_id, text=message, reply_markup=START_TEST_BUTTON)
def any_msg(message): user = User(telegram_id=message.chat.id, username=message.chat.username) if user.not_in_base(): send_welcome(message) else: user = get_user(message.chat.id) if "@" in message.text: user.add_email(message.text) bot.send_message(chat_id=user.user_id, text=content.service_msg['email'] + message.text) elif "+7" in message.text or message.text.isdigit(): user.add_phone_number(message.text) bot.send_message(chat_id=user.user_id, text=content.service_msg['number'] + message.text) else: user.add_name(message.text) bot.send_message(chat_id=user.user_id, text=content.service_msg['name'] + message.text) user.rewrite_user_info()
def send_contacts(message): user = User(telegram_id=message.chat.id, username=message.chat.username) if user.not_in_base(): user.add_user_in_db() message = content.service_msg['contacts'] bot.send_message(chat_id=user.user_id, text=message)