mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2025-09-03 23:29:50 +00:00
add middlewares sample in custom bot
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user