Ejemplo n.º 1
0
def tsn_streets(message):
    message_menu = menu.all_street("SELECT name FROM street")
    tsn_keyboard = types.InlineKeyboardMarkup(row_width=1)
    tsn_button = types.InlineKeyboardButton(text="Вернуться в меню ТСН", callback_data="/tsn")
    tsn_keyboard.add(tsn_button)
    keyboards.main_menu_key(tsn_keyboard)
    bot.send_message(message.chat.id, message_menu, reply_markup=tsn_keyboard)
Ejemplo n.º 2
0
def tsn_requisites(message):
    message_menu = menu.get_menu("SELECT text FROM tsn_info WHERE name LIKE 'requisites'")
    tsn_keyboard = types.InlineKeyboardMarkup(row_width=1)
    tsn_button = types.InlineKeyboardButton(text="Вернуться в меню ТСН", callback_data="/tsn")
    tsn_keyboard.add(tsn_button)
    keyboards.main_menu_key(tsn_keyboard)
    bot.send_message(message.chat.id, message_menu, reply_markup=tsn_keyboard)
Ejemplo n.º 3
0
def tsn(message):
    tsn_keyboard = types.InlineKeyboardMarkup(row_width=1)
    userinfo_button = types.InlineKeyboardButton(text="Ваши данные в ТСН", callback_data="/userinfo")
    requisites_button = types.InlineKeyboardButton(text="реквизиты ТСН", callback_data="/requisites")
    contacts_button = types.InlineKeyboardButton(text="полезные телефоны", callback_data="/contacts")
    street_button = types.InlineKeyboardButton(text="список улиц", callback_data="/street")
    tsn_keyboard.add(userinfo_button, requisites_button, contacts_button, street_button)
    keyboards.main_menu_key(tsn_keyboard)
    bot.send_message(message.chat.id, "Выберите раздел\n", reply_markup=tsn_keyboard)
Ejemplo n.º 4
0
def tsn_userinfo(message, user_info):
    if security.check_user_id(user_info):
        message_menu = menu.get_user_info("SELECT * from users WHERE telegram_id={};".format(user_info))
        tsn_keyboard = types.InlineKeyboardMarkup(row_width=1)
        tsn_button = types.InlineKeyboardButton(text="Вернуться в меню ТСН", callback_data="/tsn")
        tsn_keyboard.add(tsn_button)
        keyboards.main_menu_key(tsn_keyboard)
        bot.send_message(message.chat.id, message_menu + str(user_info), reply_markup=tsn_keyboard)
    else:
        message_menu = menu.get_menu("SELECT text FROM menu_text WHERE name LIKE 'tsn_access_deny'")
        tsn_keyboard = types.InlineKeyboardMarkup(row_width=1)
        get_id_button = types.InlineKeyboardButton(text="Получить Telegram ID", callback_data="/getid")
        tsn_keyboard.add(get_id_button)
        keyboards.main_menu_key(tsn_keyboard)
        bot.send_message(message.chat.id, message_menu, reply_markup=tsn_keyboard)
Ejemplo n.º 5
0
def services(message):
    services_keyboard = types.InlineKeyboardMarkup(row_width=2)

    build_button = types.InlineKeyboardButton(text="Строительство",
                                              callback_data="build")
    inside_build_button = types.InlineKeyboardButton(
        text="Внутренняя отделка", callback_data="inside_build")
    bulk_button = types.InlineKeyboardButton(text="Сыпучие материалы",
                                             callback_data="bulk")
    land_button = types.InlineKeyboardButton(text="Ландшафт, геодезия",
                                             callback_data="land")
    well_button = types.InlineKeyboardButton(text="Колодцы, скважины",
                                             callback_data="well")
    water_button = types.InlineKeyboardButton(text="Вода доставка",
                                              callback_data="water")
    warm_button = types.InlineKeyboardButton(text="Отопление",
                                             callback_data="warm")
    electric_button = types.InlineKeyboardButton(text="Электрика",
                                                 callback_data="electric")
    windows_button = types.InlineKeyboardButton(text="Окна, остекление",
                                                callback_data="windows")
    tractor_button = types.InlineKeyboardButton(text="Трактор, экскаватор",
                                                callback_data="tractor")
    plumbing_button = types.InlineKeyboardButton(text="Сантехника",
                                                 callback_data="plumbing")
    sewerage_button = types.InlineKeyboardButton(text="Канализация",
                                                 callback_data="sewerage")
    clean_watter_button = types.InlineKeyboardButton(
        text="Очистка воды", callback_data="clean_water")
    air_button = types.InlineKeyboardButton(text="Кондиционеры и тд",
                                            callback_data="air")
    auto_button = types.InlineKeyboardButton(text="Автосервисы",
                                             callback_data="auto")

    services_keyboard.add(build_button, inside_build_button, bulk_button,
                          tractor_button, well_button, warm_button,
                          water_button, land_button, electric_button,
                          plumbing_button, clean_watter_button,
                          sewerage_button, windows_button, air_button,
                          auto_button)
    keyboards.main_menu_key(services_keyboard)

    bot.send_message(message.chat.id,
                     "Выберите раздел с услугой:\n",
                     reply_markup=services_keyboard)
Ejemplo n.º 6
0
def services_build(message, user_info):
    if security.check_user_id(user_info):
        services_keyboard = types.InlineKeyboardMarkup(row_width=2)
        house_button = types.InlineKeyboardButton(text="Дома",
                                                  callback_data="build_house")
        roof_button = types.InlineKeyboardButton(text="Кровля",
                                                 callback_data="build_roof")
        facade_button = types.InlineKeyboardButton(
            text="Фасадные работы", callback_data="build_facade")
        other_button = types.InlineKeyboardButton(text="Разное",
                                                  callback_data="build_other")
        service_button = types.InlineKeyboardButton(
            text="Вернуться в меню услуг", callback_data="/services")
        services_keyboard.add(house_button, roof_button, facade_button,
                              other_button)
        services_keyboard.add(service_button)
        keyboards.main_menu_key(services_keyboard)
        bot.send_message(message.chat.id,
                         "Выберите подраздел в разделе Строительство:\n",
                         reply_markup=services_keyboard)
Ejemplo n.º 7
0
def government_message(message):
    government_keyboard = types.InlineKeyboardMarkup(row_width=1)
    keyboards.main_menu_key(government_keyboard)
    bot.send_message(message.chat.id,
                     'К сожалению в данный момент раздел в разработке',
                     reply_markup=government_keyboard)
Ejemplo n.º 8
0
def default_text(message):
    default_keyboard = types.InlineKeyboardMarkup(row_width=1)
    keyboards.main_menu_key(default_keyboard)
    bot.send_message(message.chat.id,
                     'К сожалению я не знаю такой команды',
                     reply_markup=default_keyboard)
Ejemplo n.º 9
0
def get_id(message, user_info):
    get_id_keyboard = types.InlineKeyboardMarkup(row_width=1)
    keyboards.main_menu_key(get_id_keyboard)
    bot.send_message(message.chat.id,
                     "Ваш telegram ID: " + str(user_info),
                     reply_markup=get_id_keyboard)
Ejemplo n.º 10
0
def get_servises(message, user_info, service_group):
    if security.check_user_id(user_info):
        con = psycopg2.connect(database=os.environ['DB_NAME'],
                               user=os.environ['DB_USER'],
                               password=os.environ['DB_PASS'],
                               host=os.environ['DB_HOST'],
                               port=os.environ['DB_PORT'])
        services_keyboard = types.InlineKeyboardMarkup(row_width=1)

        with con.cursor() as cur:
            cur.execute(
                " SELECT description, contact, first_tel, second_tel, email, url, vk, instagram, other_contact"
                " FROM services WHERE service_group='{}';".format(
                    service_group))
            rows = cur.fetchall()
            print(len(rows))
            if len(rows) == 0:
                service_button = types.InlineKeyboardButton(
                    text="Вернуться в меню услуг", callback_data="/services")
                services_keyboard.add(service_button)
                keyboards.main_menu_key(services_keyboard)
                bot.send_message(
                    message.chat.id,
                    "К сожалению в данном разделе пока нет записей",
                    reply_markup=services_keyboard)
            else:
                for row in rows:
                    bot_message = ""
                    if row[0]:
                        bot_message = bot_message + row[0] + "\n\n"
                    if row[1]:
                        bot_message = bot_message + "Контактное лицо: " + row[
                            1] + "\n\n"
                    if row[2]:
                        bot_message = bot_message + "Тел: " + row[2] + "\n\n"
                    if row[3]:
                        bot_message = bot_message + "Тел: " + row[3] + "\n\n"
                    if row[4]:
                        bot_message = bot_message + "email: " + row[4] + "\n\n"
                    if row[5]:
                        bot_message = bot_message + "сайт: " + row[5] + "\n\n"
                    if row[6]:
                        bot_message = bot_message + "VK:\n" + row[6] + "\n\n"
                    if row[7]:
                        bot_message = bot_message + "Instagram:\n" + row[
                            7] + "\n\n"
                    if row[8]:
                        bot_message = bot_message + "Дополнительная информация:\n" + row[
                            8] + "\n\n"

                    time.sleep(1)
                    bot.send_message(message.chat.id, bot_message)

                service_button = types.InlineKeyboardButton(
                    text="Вернуться в меню услуг", callback_data="/services")
                services_keyboard.add(service_button)
                keyboards.main_menu_key(services_keyboard)
                bot.send_message(
                    message.chat.id,
                    "Запрос выполнен успешно найдено {} записи(ей)".format(
                        len(rows)),
                    reply_markup=services_keyboard)
    else:
        message_menu = menu.get_menu(
            "SELECT text FROM menu_text WHERE name LIKE 'tsn_access_deny'")
        services_keyboard = types.InlineKeyboardMarkup(row_width=1)
        get_id_button = types.InlineKeyboardButton(text="Получить Telegram ID",
                                                   callback_data="/getid")
        services_keyboard.add(get_id_button)
        keyboards.main_menu_key(services_keyboard)
        bot.send_message(message.chat.id,
                         message_menu,
                         reply_markup=services_keyboard)