def handler_text(message): chat_id = message.chat.id db = PostgresDB() if not db.check_user(chat_id): db.close() handler_start(message) else: bot.send_message(chat_id, 'Введите одну из команд') db.close()
def handler_text(message): chat_id = message.chat.id db = PostgresDB() if not db.check_user(chat_id): db.close() handler_start(message) else: markup_remove = Utils().markup_remove() statDict[message.chat.id] = 'existUser' bot.send_message(chat_id, 'Введите одну из команд', reply_markup=markup_remove) db.close()
def handler_search(message): chat_id = message.chat.id db = PostgresDB() if not db.check_user(chat_id): db.close() handler_start(message) else: db.close() sex_list = ['мужчину', 'женщину'] markup = Utils().gen_markup(sex_list) bot.send_message(message.chat.id, config.searchMsg, reply_markup=markup) statDict[message.chat.id] = 'searchSex' search_info[message.chat.id] = []
def handler_msg_help(message): markup_remove = Utils().markup_remove() bot.send_message(message.chat.id, 'Ваше сообщение отправлено администратору', reply_markup=markup_remove) text = message.chat.first_name + ': ' + message.text bot.send_message(config.admin_id, text) db = PostgresDB() if not db.check_user(message.chat.id): db.close() bot.send_message(message.chat.id, 'Вы не заполнили анкету') handler_start(message) else: db.close() statDict[message.chat.id] = 'existUser'
def handler_start(message): markup_remove = Utils().markup_remove() bot.send_message(message.chat.id, config.start, reply_markup=markup_remove) chat_id = message.chat.id statDict[message.chat.id] = 'new' info[message.chat.id] = [] db = PostgresDB() if not db.check_user(chat_id): db.close() info[message.chat.id].append(chat_id) bot.send_message(chat_id, config.regMsg) sex_list = ['мужчина', 'женщина'] markup = Utils().gen_markup(sex_list) bot.send_message(message.chat.id, config.sexMsg, reply_markup=markup) statDict[message.chat.id] = 'sex' else: db.close() statDict[message.chat.id] = 'existUser'
def handler_black_list(message): db = PostgresDB() if not db.check_user(message.chat.id): db.close() handler_start(message) else: statDict[message.chat.id] = 'existUser' black_str = db.get_black_list(message.chat.id) if black_str != '': black_list = black_str.split() for i in black_list: inline_markup = Utils().gen_inline_markup_for_black_list(i) login = db.get_user_login(int(i)) bot.send_message(message.chat.id, login, reply_markup=inline_markup) db.close() else: bot.send_message(message.chat.id, 'Ваш черный список пуст') db.close()