def read_from_subject(update: Update, context: CallbackContext): def choose_option(update, context, data, reply): if data == _(tr.BACK, context): main_reply(reply, context) return State.FIRST_NODE context.user_data['subject'] = data reply(_(tr.START_INPUTING_NAMES, context)) return State.READ_T return handle_list_keyboard_query(update, context, show_subjects, choose_option)
def handle_subjects_list(update, context): def choose_option(update, context, data, reply): if data == utils.ANSWER_NOT_IN_LIST: reply(_(tr.INPUT_SUBJ_NAME, context)) return State.FDBK_ADD_NEW_SUBJECT context.user_data[SUBJECT] = data reply(_(tr.START_INPUTING_NAMES, context)) return State.FDBK_GET_TEACHER_INFO return utils.handle_list_keyboard_query(update, context, utils.show_subjects, choose_option)
def read_t_inline(update, context): def choose_option(update, context, data, reply): if data == ANSWER_TYPE_AGAIN: reply(_(tr.START_INPUTING_NAMES, context)) return State.READ_T else: show_teacher_feedback(reply, data, context) main_reply(update.effective_user.send_message, context) return State.FIRST_NODE return handle_list_keyboard_query(update, context, show_teachers, choose_option)
def add_t_inline(update, context): def choose_option(update, context, data, reply): if data == ANSWER_NOT_IN_LIST: reply(_(tr.INPUT_ALL_FIO, context)) return State.ADDICTIONAL_ADD else: context.user_data['teacher_name'] = data reply(_(tr.OTZYV, context)) return State.ADD_DESC return handle_list_keyboard_query(update, context, show_teachers, choose_option)
def add_to_subject(update: Update, context: CallbackContext): def choose_option(update, context, data, reply): if data == _(tr.BACK, context): main_reply(reply, context) return State.FIRST_NODE elif data == ANSWER_NOT_IN_LIST: reply(_(tr.INPUT_SUBJ_NAME, context)) return State.ADD_NEW_SUBJECT context.user_data['subject'] = data reply(_(tr.INPUT_FIO, context)) return State.ADD_T return handle_list_keyboard_query(update, context, show_subjects, choose_option)
def handle_teachers_list(update, context): def choose_option(update, context, data, reply): if data == utils.ANSWER_TYPE_AGAIN: reply(_(tr.START_INPUTING_NAMES, context)) return State.FDBK_GET_TEACHER_INFO else: context.user_data[TEACHER] = data context.user_data[ANSWERS] = [] context.user_data[POLL_INDEX] = 0 poll = POLLS[context.user_data.get('lang', 'ru')][0] poll.send_poll(reply) return State.FDBK_POLLS return utils.handle_list_keyboard_query(update, context, utils.show_teachers, choose_option)