diff --git a/annotation-processor/src/main/java/HandlerWriter.java b/annotation-processor/src/main/java/HandlerWriter.java index 8613f4c..4cd41e5 100644 --- a/annotation-processor/src/main/java/HandlerWriter.java +++ b/annotation-processor/src/main/java/HandlerWriter.java @@ -4,11 +4,15 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.function.Consumer; +import java.util.function.Supplier; public class HandlerWriter { public static void write(String body) throws IOException { + Consumer consumer = (String s) -> {}; + String classFilePath = "models/Handlers.class"; // Путь к вашему файлу Path path = Paths.get(classFilePath); diff --git a/core/src/main/java/hdvtdev/telegram/core/InvokeMethod.java b/core/src/main/java/hdvtdev/telegram/core/InvokeMethod.java deleted file mode 100644 index 0046255..0000000 --- a/core/src/main/java/hdvtdev/telegram/core/InvokeMethod.java +++ /dev/null @@ -1,7 +0,0 @@ -package hdvtdev.telegram.core; - -import java.lang.reflect.Method; - -public record InvokeMethod(Method method, Class parameterType) { - -} diff --git a/core/src/main/java/hdvtdev/telegram/core/UpdateExecutor.java b/core/src/main/java/hdvtdev/telegram/core/UpdateExecutor.java deleted file mode 100644 index a19268c..0000000 --- a/core/src/main/java/hdvtdev/telegram/core/UpdateExecutor.java +++ /dev/null @@ -1,10 +0,0 @@ -package hdvtdev.telegram.core; - -import hdvtdev.telegram.core.objects.Update; - -@FunctionalInterface -public interface UpdateExecutor { - - void execute(Update update); - -} diff --git a/longpolling-okhttp/build.gradle b/longpolling-okhttp/build.gradle index a6a5d4a..5687046 100644 --- a/longpolling-okhttp/build.gradle +++ b/longpolling-okhttp/build.gradle @@ -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")) } diff --git a/longpolling-okhttp/src/main/java/hdvtdev/telegram/longpolling/okhttp/OkHttpTelegramBot.java b/longpolling-okhttp/src/main/java/hdvtdev/telegram/longpolling/okhttp/OkHttpTelegramBot.java index 1bdef5b..385cab8 100644 --- a/longpolling-okhttp/src/main/java/hdvtdev/telegram/longpolling/okhttp/OkHttpTelegramBot.java +++ b/longpolling-okhttp/src/main/java/hdvtdev/telegram/longpolling/okhttp/OkHttpTelegramBot.java @@ -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 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 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()); }