mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-02-18 12:41:50 +00:00
small update of scenarios
This commit is contained in:
parent
00873a255c
commit
30e6f68228
@ -9,8 +9,6 @@ typealias ScenarioAndTypeReceiver<T, I> = suspend Scenario.(I) -> T
|
|||||||
|
|
||||||
data class Scenario(
|
data class Scenario(
|
||||||
val bot: TelegramBot,
|
val bot: TelegramBot,
|
||||||
val flowsUpdatesFilter: FlowsUpdatesFilter,
|
val scope: CoroutineScope,
|
||||||
val scope: CoroutineScope
|
val flowsUpdatesFilter: FlowsUpdatesFilter = FlowsUpdatesFilter()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,17 +1,34 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.steps
|
package dev.inmo.tgbotapi.extensions.steps
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.updates.retrieving.startGettingFlowsUpdatesByLongPolling
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.updates.retrieving.startGettingOfUpdatesByLongPolling
|
||||||
import dev.inmo.tgbotapi.updateshandlers.FlowsUpdatesFilter
|
import dev.inmo.tgbotapi.updateshandlers.FlowsUpdatesFilter
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
|
||||||
suspend fun TelegramBot.buildScenarios(
|
suspend fun TelegramBot.buildScenarios(
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
flowUpdatesFilter: FlowsUpdatesFilter = FlowsUpdatesFilter(),
|
flowUpdatesFilter: FlowsUpdatesFilter,
|
||||||
block: ScenarioReceiver<Unit>
|
block: ScenarioReceiver<Unit>
|
||||||
) {
|
) {
|
||||||
Scenario(
|
Scenario(
|
||||||
this,
|
this,
|
||||||
flowUpdatesFilter,
|
scope,
|
||||||
scope
|
flowUpdatesFilter
|
||||||
).block()
|
).block()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun TelegramBot.buildScenarios(
|
||||||
|
scope: CoroutineScope,
|
||||||
|
block: ScenarioReceiver<Unit>
|
||||||
|
) = FlowsUpdatesFilter().also {
|
||||||
|
buildScenarios(
|
||||||
|
scope,
|
||||||
|
it,
|
||||||
|
block
|
||||||
|
)
|
||||||
|
startGettingOfUpdatesByLongPolling(
|
||||||
|
updatesFilter = it,
|
||||||
|
scope = scope
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user