mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 19:48:43 +00:00
includeWebhookHandlingInRouteWithFlows
This commit is contained in:
parent
1cff6f616f
commit
e3bfc4472a
@ -51,6 +51,9 @@
|
|||||||
|
|
||||||
### 0.27.10
|
### 0.27.10
|
||||||
|
|
||||||
|
* `TelegramBotAPI-extensions-utils`:
|
||||||
|
* Extension `Route#includeWebhookHandlingInRouteWithFlows` was added
|
||||||
|
|
||||||
### 0.27.9
|
### 0.27.9
|
||||||
|
|
||||||
* `Common`
|
* `Common`
|
||||||
|
@ -159,6 +159,8 @@ Besides, there are two additional opportunities:
|
|||||||
|
|
||||||
* Extension `Route#includeWebhookHandlingInRoute`, which allow you to include webhook processing inside your ktor
|
* Extension `Route#includeWebhookHandlingInRoute`, which allow you to include webhook processing inside your ktor
|
||||||
application without creating of new one server (as it is happening in `startListenWebhooks`)
|
application without creating of new one server (as it is happening in `startListenWebhooks`)
|
||||||
|
* Also, you can use `Route#includeWebhookHandlingInRouteWithFlows` to use it like `flowUpdatesFilter` fun, but apply
|
||||||
|
`FlowsUpdatesFilter` to the block
|
||||||
* Extension `RequestsExecutor#setWebhookInfoAndStartListenWebhooks`. It is allow to set up full server (in fact, with
|
* Extension `RequestsExecutor#setWebhookInfoAndStartListenWebhooks`. It is allow to set up full server (in fact, with
|
||||||
`startListenWebhooks`), but also send `SetWebhook` request before and check that it was successful
|
`startListenWebhooks`), but also send `SetWebhook` request before and check that it was successful
|
||||||
|
|
||||||
|
@ -2,14 +2,14 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.updates.retr
|
|||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.nonstrictJsonFormat
|
import com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.nonstrictJsonFormat
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.updates.flowsUpdatesFilter
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.MultipartRequestImpl
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.MultipartRequestImpl
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.webhook.SetWebhook
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.webhook.SetWebhook
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.UpdateDeserializationStrategy
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.UpdateDeserializationStrategy
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdateReceiver
|
import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdatesFilter
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.webhook.WebhookPrivateKeyConfig
|
import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.webhook.WebhookPrivateKeyConfig
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.ExceptionHandler
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.ExceptionHandler
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.handleSafely
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.handleSafely
|
||||||
@ -56,6 +56,16 @@ fun Route.includeWebhookHandlingInRoute(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Route.includeWebhookHandlingInRouteWithFlows(
|
||||||
|
scope: CoroutineScope,
|
||||||
|
exceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
|
block: FlowsUpdatesFilter.() -> Unit
|
||||||
|
) = includeWebhookHandlingInRoute(
|
||||||
|
scope,
|
||||||
|
exceptionsHandler,
|
||||||
|
flowsUpdatesFilter(block = block).asUpdateReceiver
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting up ktor server, set webhook info via [SetWebhook] request.
|
* Setting up ktor server, set webhook info via [SetWebhook] request.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user