Заменил executorservice телеги на mutiny
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ae6ffab2a8
commit
a18dceb617
2
pom.xml
2
pom.xml
@ -38,7 +38,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
||||
<godfather.core.ver>0.0.58</godfather.core.ver>
|
||||
<godfather.core.ver>0.0.59-SNAPSHOT</godfather.core.ver>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.telegram/telegrambots -->
|
||||
<telegrambots.ver>6.3.0</telegrambots.ver>
|
||||
|
@ -3,13 +3,17 @@ package dev.struchkov.godfather.telegram.quarkus.core;
|
||||
import dev.struchkov.godfather.telegram.domain.config.TelegramBotConfig;
|
||||
import dev.struchkov.godfather.telegram.quarkus.context.service.EventDistributor;
|
||||
import dev.struchkov.godfather.telegram.quarkus.context.service.TelegramBot;
|
||||
import io.smallrye.mutiny.infrastructure.Infrastructure;
|
||||
import io.vertx.core.Vertx;
|
||||
import lombok.SneakyThrows;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.telegram.telegrambots.bots.DefaultBotOptions;
|
||||
import org.telegram.telegrambots.bots.TelegramLongPollingBot;
|
||||
import org.telegram.telegrambots.meta.api.objects.Update;
|
||||
import org.telegram.telegrambots.meta.bots.AbsSender;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* TODO: Добавить описание класса.
|
||||
*
|
||||
@ -21,10 +25,18 @@ public class TelegramPollingBot extends TelegramLongPollingBot implements Telegr
|
||||
private final TelegramBotConfig telegramBotConfig;
|
||||
private EventDistributor eventDistributor;
|
||||
|
||||
@SneakyThrows
|
||||
public TelegramPollingBot(Vertx vertx, TelegramBotConfig telegramBotConfig, DefaultBotOptions defaultBotOptions) {
|
||||
super(defaultBotOptions);
|
||||
this.telegramBotConfig = telegramBotConfig;
|
||||
this.vertx = vertx;
|
||||
final Field field = this.getClass().getSuperclass().getSuperclass().getDeclaredField("exe");
|
||||
// Делаем поле exe доступным для изменений
|
||||
field.setAccessible(true);
|
||||
// Заменяем поле exe в экземпляре наследника
|
||||
field.set(this, Infrastructure.getDefaultExecutor());
|
||||
// Закрываем доступ к полю exe
|
||||
field.setAccessible(false);
|
||||
}
|
||||
|
||||
public TelegramPollingBot(Vertx vertx, TelegramBotConfig telegramBotConfig) {
|
||||
|
@ -3,19 +3,31 @@ package dev.struchkov.godfather.telegram.quarkus.core;
|
||||
import dev.struchkov.godfather.telegram.domain.config.TelegramBotConfig;
|
||||
import dev.struchkov.godfather.telegram.quarkus.context.service.EventDistributor;
|
||||
import dev.struchkov.godfather.telegram.quarkus.context.service.TelegramBot;
|
||||
import io.smallrye.mutiny.infrastructure.Infrastructure;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
|
||||
import org.telegram.telegrambots.meta.api.objects.Update;
|
||||
import org.telegram.telegrambots.meta.bots.AbsSender;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@Slf4j
|
||||
public class TelegramWebhookBot extends org.telegram.telegrambots.bots.TelegramWebhookBot implements TelegramBot {
|
||||
|
||||
private final TelegramBotConfig telegramBotConfig;
|
||||
private EventDistributor eventDistributor;
|
||||
|
||||
@SneakyThrows
|
||||
public TelegramWebhookBot(TelegramBotConfig telegramBotConfig) {
|
||||
this.telegramBotConfig = telegramBotConfig;
|
||||
final Field field = this.getClass().getSuperclass().getSuperclass().getDeclaredField("exe");
|
||||
// Делаем поле exe доступным для изменений
|
||||
field.setAccessible(true);
|
||||
// Заменяем поле exe в экземпляре наследника
|
||||
field.set(this, Infrastructure.getDefaultExecutor());
|
||||
// Закрываем доступ к полю exe
|
||||
field.setAccessible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user