示例#1
0
def listen_update():
    try:
        total, passed = fnc.send_notifications('')
        loggerDEBUG.debug(f'/setnew from SERVER')
        return SERVER_GOOD_ANSWER.format(total, passed)
    except:
        return SERVER_BAD_ANSWER
示例#2
0
def choose_way_all_time_table(message: Message):
    loggerDEBUG.debug(f'{message.from_user.username} :: "ВЫВОД ВСЕГО РАСПИСАНИЯ" :: start')
    dataBase.add_user(message.from_user.id, message.chat.id)
    dataBase.set_way(message.chat.id, States.FULL_TIMETABLE)
    dataBase.set_count_parameters(message.chat.id, 0)
    fnc.general_func(message)
    loggerDEBUG.debug(f'{message.from_user.username} :: "ВЫВОД ВСЕГО РАСПИСАНИЯ" :: end')
示例#3
0
def send_list_of_commands(message: Message):
    dataBase.add_user(message.from_user.id, message.chat.id)
    bot.send_message(message.chat.id, strings.INSTROUCTIONS_HELP)
    if message.from_user.username is None:
        loggerDEBUG.debug(f'/help None - {message.from_user.id}')
    else:
        loggerDEBUG.debug(f'/help {message.from_user.username} - {message.from_user.id}')
示例#4
0
def choose_way_search_by_teacher(message: Message):
    loggerDEBUG.debug(f'{message.from_user.username} :: "ПОИСК ПО ПРЕПОДАВАТЕЛЮ" :: start')
    dataBase.add_user(message.from_user.id, message.chat.id)
    dataBase.set_way(message.chat.id, States.TEACHER_SEARCH)
    dataBase.set_count_parameters(message.chat.id, 0)
    bot.send_message(message.chat.id,
                     strings.ENTER_TEACHER,
                     reply_markup=kb.determine_start_keyboard(dataBase.get_group(message.from_user.id)))
    loggerDEBUG.debug(f'{message.from_user.username} :: "ПОИСК ПО ПРЕПОДАВАТЕЛЮ" :: end')
示例#5
0
def choose_way_by_b209(message: Message):
    loggerDEBUG.debug(f'{message.from_user.username} :: "КОГДА СВОБОДНА Б209?" :: start')
    dataBase.add_user(message.from_user.id, message.chat.id)
    dataBase.set_way(message.chat.id, States.BEST_ROOM)
    dataBase.set_count_parameters(message.chat.id, 0)
    bot.send_message(message.chat.id,
                     strings.ENTER_DATE_FOR_CURRENT_GROUP,
                     reply_markup=kb.choiceDateForB209)
    loggerDEBUG.debug(f'{message.from_user.username} :: "КОГДА СВОБОДНА Б209?" :: end')
示例#6
0
def process_start_command(message: Message):
    dataBase.add_user(message.from_user.id, message.chat.id)
    dataBase.set_default_values(message.chat.id)
    bot.send_message(message.from_user.id,
                     strings.MESSAGE_START,
                     reply_markup=kb.determine_start_keyboard(dataBase.get_group(message.chat.id)))
    if message.from_user.username is None:
        loggerDEBUG.debug(f'/start None - {message.from_user.id}')
    else:
        loggerDEBUG.debug(f'/start {message.from_user.username} - {message.from_user.id}')
示例#7
0
def time_table_changed(message: Message):
    user_info = message.from_user
    if dataBase.is_admin(message.from_user.id):
        option = message.text.strip('/setnew ')
        fnc.send_notifications(option)
        loggerDEBUG.debug(
            f'/setnew {user_info.username if user_info.username else ""} - {user_info.id} - {option}'
        )
    else:
        loggerDEBUG.warning(
            '\n'.join(['/setnew ----- ВНИМАНИЕ!!! ',
                       'пользователь, НЕ ЯВЛЯЮЩИЙСЯ АДМИНОМ использовал /setnew',
                       f'chat_id: {user_info.id}',
                       f'username: {user_info.username if user_info.username else "empty username"}'])
        )
示例#8
0
def repeat_message(message: Message):
    loggerDEBUG.debug(f'/text {message.from_user.username} :: start')
    dataBase.add_user(message.from_user.id, message.chat.id)

    # fnc.general_func(message)

    regExp = fnc.text_reg_exp(message.from_user.id)

    if regExp and message.text == regExp:
        bot.send_message(message.chat.id, strings.ENTER_DATE_FOR_CURRENT_GROUP,
                         reply_markup=kb.choiceDateForCurrentGroup)
        dataBase.set_way(message.chat.id, States.CURRENT_GROUP_SEARCH)
    else:
        fnc.general_func(message)

    loggerDEBUG.debug(f'/text {message.from_user.username} - {message.from_user.id} - "{message.text}" :: end')
示例#9
0
def query_text(query):
    loggerDEBUG.debug(f'QUERY: {query.query}')
    strOut = iRz.general_func(query)
    bot.answer_inline_query(query.id, strOut)