1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00
This commit is contained in:
InsanusMokrassar 2020-05-15 22:14:19 +06:00
parent 6394e1a52b
commit d629aa206e

View File

@ -59,7 +59,7 @@ fun Route.includeWebhookHandlingInRoute(
* Setting up ktor server, set webhook info via [SetWebhook] request. * Setting up ktor server, set webhook info via [SetWebhook] request.
* *
* @param listenPort port which will be listen by bot * @param listenPort port which will be listen by bot
* @param listenRoute address to listen by bot * @param listenRoute address to listen by bot. If null - will be set up in root of host
* @param scope Scope which will be used for * @param scope Scope which will be used for
* @param privateKeyConfig If configured - server will be created with [sslConnector]. [connector] will be used otherwise * @param privateKeyConfig If configured - server will be created with [sslConnector]. [connector] will be used otherwise
* *
@ -72,7 +72,7 @@ fun startListenWebhooks(
engineFactory: ApplicationEngineFactory<*, *>, engineFactory: ApplicationEngineFactory<*, *>,
exceptionsHandler: ExceptionHandler<Unit>, exceptionsHandler: ExceptionHandler<Unit>,
listenHost: String = "0.0.0.0", listenHost: String = "0.0.0.0",
listenRoute: String = "/", listenRoute: String? = null,
privateKeyConfig: WebhookPrivateKeyConfig? = null, privateKeyConfig: WebhookPrivateKeyConfig? = null,
scope: CoroutineScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher()), scope: CoroutineScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher()),
block: UpdateReceiver<Update> block: UpdateReceiver<Update>
@ -82,9 +82,11 @@ fun startListenWebhooks(
module { module {
routing { routing {
route(listenRoute) { listenRoute ?.also {
route(it) {
includeWebhookHandlingInRoute(scope, exceptionsHandler, block) includeWebhookHandlingInRoute(scope, exceptionsHandler, block)
} }
} ?: includeWebhookHandlingInRoute(scope, exceptionsHandler, block)
} }
} }
privateKeyConfig ?.let { privateKeyConfig ?.let {