add middlewares sample in custom bot

This commit is contained in:
2024-10-15 13:52:26 +06:00
parent 9acb64fda9
commit d4d8508abf
2 changed files with 16 additions and 2 deletions

View File

@@ -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)