code clean

This commit is contained in:
Patrick Haßel 2025-10-10 15:04:09 +02:00
parent 0e7c94f39e
commit b3236bb931

View File

@ -11,7 +11,6 @@ import jakarta.annotation.PreDestroy;
import lombok.NonNull; import lombok.NonNull;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.jpa.repository.JpaContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.telegram.telegrambots.bots.TelegramLongPollingBot; import org.telegram.telegrambots.bots.TelegramLongPollingBot;
import org.telegram.telegrambots.meta.TelegramBotsApi; import org.telegram.telegrambots.meta.TelegramBotsApi;
@ -37,9 +36,7 @@ public class TelegramBot extends TelegramLongPollingBot {
private final DefaultBotSession session; private final DefaultBotSession session;
private final JpaContext jpaContext; public TelegramBot(final TelegramConfig config, final ObjectMapper objectMapper, final ApplicationEventPublisher publisher) throws TelegramApiException {
public TelegramBot(final TelegramConfig config, final ObjectMapper objectMapper, final ApplicationEventPublisher publisher, final JpaContext jpaContext) throws TelegramApiException {
super(config.getToken()); super(config.getToken());
this.config = config; this.config = config;
@ -51,7 +48,6 @@ public class TelegramBot extends TelegramLongPollingBot {
session = (DefaultBotSession) api.registerBot(this); session = (DefaultBotSession) api.registerBot(this);
log.info("Telegram bot registered."); log.info("Telegram bot registered.");
this.objectMapper = objectMapper; this.objectMapper = objectMapper;
this.jpaContext = jpaContext;
} }
@PreDestroy @PreDestroy