mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
now setWebhook supports setting up of path for listening
This commit is contained in:
parent
27aba72a5a
commit
ef7e94ba68
@ -34,6 +34,8 @@
|
||||
|
||||
### 0.20.4
|
||||
|
||||
* Now `setWebhook` supports setting up of path for listening
|
||||
|
||||
## 0.19.0 ImplicitReflection removing
|
||||
|
||||
* Total rework of serialization for requests. Now all `SimpleRequest` children have:
|
||||
|
@ -23,7 +23,6 @@ import kotlinx.serialization.json.Json
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
/**
|
||||
* Reverse proxy webhook.
|
||||
*
|
||||
@ -36,6 +35,7 @@ import java.util.concurrent.TimeUnit
|
||||
suspend fun RequestsExecutor.setWebhook(
|
||||
url: String,
|
||||
port: Int,
|
||||
listenAddress: String,
|
||||
engineFactory: ApplicationEngineFactory<*, *>,
|
||||
certificate: InputFile? = null,
|
||||
privateKeyConfig: WebhookPrivateKeyConfig? = null,
|
||||
@ -70,7 +70,7 @@ suspend fun RequestsExecutor.setWebhook(
|
||||
|
||||
module {
|
||||
routing {
|
||||
post {
|
||||
post(listenAddress) {
|
||||
val deserialized = call.receiveText()
|
||||
val update = Json.nonstrict.parse(
|
||||
RawUpdate.serializer(),
|
||||
@ -136,6 +136,29 @@ suspend fun RequestsExecutor.setWebhook(
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.setWebhook(
|
||||
url: String,
|
||||
port: Int,
|
||||
engineFactory: ApplicationEngineFactory<*, *>,
|
||||
certificate: InputFile? = null,
|
||||
privateKeyConfig: WebhookPrivateKeyConfig? = null,
|
||||
scope: CoroutineScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher()),
|
||||
allowedUpdates: List<String>? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
block: UpdateReceiver<Update>
|
||||
) = setWebhook(
|
||||
url,
|
||||
port,
|
||||
"/",
|
||||
engineFactory,
|
||||
certificate,
|
||||
privateKeyConfig,
|
||||
scope,
|
||||
allowedUpdates,
|
||||
maxAllowedConnections,
|
||||
block
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.setWebhook(
|
||||
url: String,
|
||||
port: Int,
|
||||
@ -144,10 +167,12 @@ suspend fun RequestsExecutor.setWebhook(
|
||||
certificate: InputFile? = null,
|
||||
privateKeyConfig: WebhookPrivateKeyConfig? = null,
|
||||
scope: CoroutineScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher()),
|
||||
maxAllowedConnections: Int? = null
|
||||
maxAllowedConnections: Int? = null,
|
||||
listenAddress: String = ""
|
||||
): Job = setWebhook(
|
||||
url,
|
||||
port,
|
||||
listenAddress,
|
||||
engineFactory,
|
||||
certificate,
|
||||
privateKeyConfig,
|
||||
|
Loading…
Reference in New Issue
Block a user