From d4d8508abf65b1bf94c056a8d8dcf910b286a53f Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 15 Oct 2024 13:52:26 +0600 Subject: [PATCH 1/2] add middlewares sample in custom bot --- CustomBot/src/main/kotlin/CustomBot.kt | 16 +++++++++++++++- gradle.properties | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CustomBot/src/main/kotlin/CustomBot.kt b/CustomBot/src/main/kotlin/CustomBot.kt index b82582c..3c19749 100644 --- a/CustomBot/src/main/kotlin/CustomBot.kt +++ b/CustomBot/src/main/kotlin/CustomBot.kt @@ -25,7 +25,21 @@ suspend fun main(vararg args: String) { ) } - telegramBotWithBehaviourAndLongPolling(botToken, CoroutineScope(Dispatchers.IO), testServer = isTestServer) { + telegramBotWithBehaviourAndLongPolling( + botToken, + CoroutineScope(Dispatchers.IO), + testServer = isTestServer, + builder = { + includeMiddlewares { + addMiddleware { + doOnRequestReturnResult { result, request, _ -> + println("Result of $request:\n\n$result") + null + } + } + } + } + ) { // start here!! val me = getMe() println(me) diff --git a/gradle.properties b/gradle.properties index 1e36528..46bae98 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ kotlin.daemon.jvmargs=-Xmx3g -Xms500m kotlin_version=2.0.20 -telegram_bot_api_version=18.2.1 +telegram_bot_api_version=18.2.2 micro_utils_version=0.22.4 serialization_version=1.7.3 ktor_version=2.3.12 From 0bbc6a95558d729ae290a3550f71c85999c9235d Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 22 Oct 2024 17:22:41 +0600 Subject: [PATCH 2/2] Update gradle.properties --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 46bae98..afcf2fb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,8 +5,8 @@ org.gradle.jvmargs=-Xmx3148m kotlin.daemon.jvmargs=-Xmx3g -Xms500m -kotlin_version=2.0.20 +kotlin_version=2.0.21 telegram_bot_api_version=18.2.2 -micro_utils_version=0.22.4 +micro_utils_version=0.22.7 serialization_version=1.7.3 ktor_version=2.3.12