code clean
This commit is contained in:
parent
0e7c94f39e
commit
b3236bb931
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user