forked from Sanders/TelegaBot
Fix small
This commit is contained in:
@@ -76,6 +76,9 @@ public class KeyboardHelper {
|
||||
|
||||
KeyboardRow row2 = new KeyboardRow();
|
||||
row2.add(new KeyboardButton(EDIT_BOOKS));
|
||||
|
||||
KeyboardRow row3 = new KeyboardRow();
|
||||
row1.add(new KeyboardButton(SET_BOOKS_GOAL));
|
||||
row2.add(new KeyboardButton(BACK));
|
||||
|
||||
keyboardRows.add(row1);
|
||||
|
||||
@@ -81,7 +81,8 @@ public class BookCreationServiceImpl implements BookCreationService {
|
||||
cache.setRating(rating);
|
||||
cache.setCreationState(BookCreationCache.CreationState.ADDING_DATE);
|
||||
bookCacheService.updateCache(user.getId(), cache);
|
||||
telegramClientService.sendMessage(user, "📅 Введите дату прочтения (в формате ДД.ММ.ГГГГ):");
|
||||
telegramClientService.sendMessage(user, "📅 Введите дату прочтения (в формате ДД.ММ.ГГГГ): \n" +
|
||||
"✅ Для указания текущей даты введите букву \"т\"");
|
||||
}
|
||||
|
||||
case ADDING_DATE -> {
|
||||
@@ -154,6 +155,9 @@ public class BookCreationServiceImpl implements BookCreationService {
|
||||
}
|
||||
|
||||
private Date parseDate(String text) throws ParseException {
|
||||
if (text.matches("^([tTтТ])$")) {
|
||||
return new Date(System.currentTimeMillis());
|
||||
}
|
||||
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy");
|
||||
format.setLenient(false);
|
||||
return new Date(format.parse(text).getTime());
|
||||
|
||||
@@ -10,6 +10,8 @@ import ru.cathub.telegabot.service.ProfileService;
|
||||
import ru.cathub.telegabot.service.TelegramClientService;
|
||||
import ru.cathub.telegabot.utils.Constants;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ProfileServiceImpl implements ProfileService {
|
||||
@@ -23,7 +25,8 @@ public class ProfileServiceImpl implements ProfileService {
|
||||
userRepository.save(user);
|
||||
telegramClientService.sendMessage(
|
||||
user,
|
||||
"⌨️ Режим редактирования профиля:\nТекущая цель по книгам "+user.getBooksToRead());
|
||||
"⌨️ Режим редактирования профиля:\nТекущая цель по книгам "
|
||||
+ Optional.of(user.getBooksToRead().toString()).orElse("Не задано"));
|
||||
telegramClientService.sendMessage(
|
||||
user,
|
||||
"Введите цель по количеству книг или вернитесь назад",
|
||||
|
||||
@@ -50,6 +50,9 @@ public class TelegramBotServiceImpl implements TelegramBotService {
|
||||
case EDIT_BOOKS:
|
||||
bookManageService.processBookInput(botUser,text);
|
||||
break;
|
||||
case SET_BOOKS_GOAL:
|
||||
profileService.enterProfileEditingMode(botUser);
|
||||
break;
|
||||
default:
|
||||
switch (botUser.getWorkingMode()) {
|
||||
case BOOK:
|
||||
|
||||
@@ -7,6 +7,7 @@ public class Constants {
|
||||
// Menu options
|
||||
public static final String EDIT_PROFILE = "Редактировать профиль";
|
||||
public static final String SET_BOOKS_GOAL = "Книг для прочтения";
|
||||
public static final String SET_BOOKS_GOAL2 = "Цель на год";
|
||||
public static final String PROFILE_UPDATED = "Цель обновлена! \uD83D\uDCD7";
|
||||
public static final String ADD_BOOK = "Добавить книгу";
|
||||
public static final String LIST_BOOKS = "Список книг";
|
||||
|
||||
Reference in New Issue
Block a user