feat/code-refactoring #1
@ -49,5 +49,6 @@ const (
|
||||
ErrorResetBotMessage = "Возникли проблемки при сбросе твоего профиля. Пожалуйста, попробуй позже..."
|
||||
CanNotShowProfileBotMessage = "Чтобы посмотреть профиль, необходимо полностью его заполнить."
|
||||
CanNotShowVacanciesBotMessage = "Чтобы посмотреть вакансии, необходимо полностью заполнить профиль."
|
||||
GetVacanciesError = "При вычислении подходящих вакансий возникли технические шоколадки 😅 Попробуй позже..."
|
||||
GetVacanciesErrorBotMessage = "При вычислении подходящих вакансий возникли технические шоколадки 😅 Попробуй позже..."
|
||||
UnknownCommandBotMessage = "Ты ввёл невалидное значение или неизвестную команду. Давай попробуем ещё раз..."
|
||||
)
|
||||
|
||||
@ -127,7 +127,7 @@ func (t *handler) universalTextHandler(ctx tele.Context) error {
|
||||
)
|
||||
|
||||
msg = constants.StartAnswerQuestionsBotMessage
|
||||
} else if user.ActiveStatus == constants.WaitWorkFormatStatus {
|
||||
} else if user.ActiveStatus == constants.WaitWorkFormatStatus && constants.WorkFormat(val).Valid() {
|
||||
wf := constants.WorkFormat(val)
|
||||
user.WorkFormat = &wf
|
||||
user.ActiveStatus = constants.WaitTargetRoleStatus
|
||||
@ -154,7 +154,7 @@ func (t *handler) universalTextHandler(ctx tele.Context) error {
|
||||
)
|
||||
|
||||
msg = constants.AcceptTargetRoleBotMessage
|
||||
} else if user.ActiveStatus == constants.WaitSalaryRangeStatus {
|
||||
} else if user.ActiveStatus == constants.WaitSalaryRangeStatus && constants.SalaryRange(val).Valid() {
|
||||
sr := constants.SalaryRange(val)
|
||||
user.SalaryRange = &sr
|
||||
user.ActiveStatus = constants.WaitWorkExperienceStatus
|
||||
@ -192,7 +192,7 @@ func (t *handler) universalTextHandler(ctx tele.Context) error {
|
||||
}
|
||||
|
||||
msg = fmt.Sprintf(
|
||||
"<b>Резюме</b>: %v\n<b>Зарплатная вилка</b>: %v\n<b>Должность</b>: %v\n<b>Опыт работы</b>: %v\n<b>Формат работы</b>: %v\n",
|
||||
"<b>Резюме</b>: %v\n<b>Зарплатная вилка</b>: %v\n<b>Должность</b>: <i>%v</i>\n<b>Опыт работы</b>: <i>%v</i>\n<b>Формат работы</b>: %v\n",
|
||||
resume, user.SalaryRange, *user.TargetRole, *user.WorkExperience, user.WorkFormat,
|
||||
)
|
||||
} else if val == constants.ShowVacanciesBotCommand && !utils.CheckProfileCompletion(user) {
|
||||
@ -206,7 +206,7 @@ func (t *handler) universalTextHandler(ctx tele.Context) error {
|
||||
|
||||
if err != nil {
|
||||
t.logger.Error(fmt.Sprintf("%v: %v", op, err.Error()))
|
||||
return ctx.Send(constants.GetVacanciesError)
|
||||
return ctx.Send(constants.GetVacanciesErrorBotMessage)
|
||||
} else if len(vacancies) == 0 {
|
||||
return ctx.Send(constants.NoVacanciesBotMessage)
|
||||
}
|
||||
@ -215,6 +215,9 @@ func (t *handler) universalTextHandler(ctx tele.Context) error {
|
||||
mainKeys = &tele.ReplyMarkup{RemoveKeyboard: true}
|
||||
|
||||
msg = strings.Join(vacancies, "\n")
|
||||
} else {
|
||||
needUpdateUser = false
|
||||
msg = constants.UnknownCommandBotMessage
|
||||
}
|
||||
// Set new user data
|
||||
if needUpdateUser {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user