backup
This commit is contained in:
@@ -12,11 +12,9 @@ repositories {
|
||||
dependencies {
|
||||
implementation platform('com.fasterxml.jackson:jackson-bom:2.18.3')
|
||||
|
||||
|
||||
implementation 'com.fasterxml.jackson.core:jackson-core'
|
||||
implementation 'com.fasterxml.jackson.core:jackson-databind'
|
||||
|
||||
//implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:5.2.1'
|
||||
implementation(project(":core"))
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import hdvtdev.telegram.core.HandlersModule;
|
||||
import hdvtdev.telegram.core.TelegramBot;
|
||||
import hdvtdev.telegram.core.UpdateConsumer;
|
||||
import hdvtdev.telegram.core.UpdateExecutor;
|
||||
import hdvtdev.telegram.core.exceptions.TelegramApiException;
|
||||
import hdvtdev.telegram.core.exceptions.TelegramApiNetworkException;
|
||||
import hdvtdev.telegram.core.exceptions.TelegramMethodParsingException;
|
||||
@@ -28,6 +27,7 @@ import java.nio.file.StandardCopyOption;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
||||
public class OkHttpTelegramBot implements TelegramBot {
|
||||
@@ -38,7 +38,7 @@ public class OkHttpTelegramBot implements TelegramBot {
|
||||
|
||||
private ScheduledExecutorService scheduler;
|
||||
|
||||
private final UpdateExecutor updateExecutor;
|
||||
private final Consumer<Update> updateExecutor;
|
||||
private final AtomicLong lastUpdateId = new AtomicLong(0);
|
||||
private int updateLimit = 10;
|
||||
private int updateTimeout = 25;
|
||||
@@ -153,7 +153,7 @@ public class OkHttpTelegramBot implements TelegramBot {
|
||||
List<Update> updates = List.of(awaitExecute(new GetUpdates(lastUpdateId.get() + 1, updateLimit, updateTimeout)));
|
||||
if (!updates.isEmpty()) {
|
||||
for (Update update : updates) {
|
||||
updateExecutor.execute(update);
|
||||
updateExecutor.accept(update);
|
||||
}
|
||||
lastUpdateId.set(updates.getLast().updateId());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user