mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
add flowsUdatesFilter
This commit is contained in:
parent
336b830b0b
commit
e856dc4754
@ -63,6 +63,7 @@
|
||||
* Updates utils were added
|
||||
* New extensions `startListenWebhooks`, `setWebhookInfoAndStartListenWebhooks` and `includeWebhookHandlingInRoute` was added
|
||||
* New extension `CoroutineScope#updateHandlerWithMediaGroupsAdaptation` was added
|
||||
* New extension `flowsUpdatesFilter` was added
|
||||
* `TelegramBotAPI-all`:
|
||||
* Project was created
|
||||
|
||||
|
@ -76,7 +76,17 @@ updates retrieving:
|
||||
* Long Polling
|
||||
|
||||
Both of them you could use in your project using [TelegramBotAPI](../TelegramBotAPI/README.md), but here there are
|
||||
several useful extensions for both of them:
|
||||
several useful extensions for both of them.
|
||||
|
||||
Anyway, in both of ways it will be useful to know that it is possible to create `UpdateReceiver` object using function
|
||||
`flowsUpdatesFilter`:
|
||||
|
||||
```kotlin
|
||||
val internalChannelsSizes = 128
|
||||
flowsUpdatesFilter(internalChannelsSizes/* default is 64 */) {
|
||||
/* ... */
|
||||
}
|
||||
```
|
||||
|
||||
#### Long polling
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.updates
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.FlowsUpdatesFilter
|
||||
|
||||
/**
|
||||
* Non-suspendable function for easy-to-use creating of [FlowsUpdatesFilter] and applying the block to it
|
||||
*/
|
||||
fun flowsUpdatesFilter(
|
||||
internalChannelsSizes: Int = 64,
|
||||
block: FlowsUpdatesFilter.() -> Unit
|
||||
): FlowsUpdatesFilter = FlowsUpdatesFilter(internalChannelsSizes).apply(block)
|
||||
|
||||
/**
|
||||
* Suspend variation for [flowsUpdatesFilter] function
|
||||
*
|
||||
* @see flowsUpdatesFilter
|
||||
*/
|
||||
suspend fun flowsUpdatesFilter(
|
||||
internalChannelsSizes: Int = 64,
|
||||
block: suspend FlowsUpdatesFilter.() -> Unit
|
||||
): FlowsUpdatesFilter {
|
||||
val filter = FlowsUpdatesFilter(internalChannelsSizes)
|
||||
filter.block()
|
||||
return filter
|
||||
}
|
Loading…
Reference in New Issue
Block a user