mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
a little refactor
This commit is contained in:
parent
ad97008f12
commit
69d36c5c1b
@ -52,6 +52,8 @@ __All the `tgbotapi.extensions.*` packages have been removed__
|
|||||||
* `SimpleFilter` now is a `fun interface` instead of just callback (fix of [#546](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/546))
|
* `SimpleFilter` now is a `fun interface` instead of just callback (fix of [#546](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/546))
|
||||||
* New extension `BehaviourContext#createSubContext`. It uses separated `AccumulatorFlow` and will retrieve updates by itself
|
* New extension `BehaviourContext#createSubContext`. It uses separated `AccumulatorFlow` and will retrieve updates by itself
|
||||||
* New extension `BehaviourContext#doInContext`
|
* New extension `BehaviourContext#doInContext`
|
||||||
|
* Extension `BehaviourContext#doInSubContextWithUpdatesFilter` has been renamed to `BehaviourContext#createSubContextAndDoWithUpdatesFilter`
|
||||||
|
* Extension `BehaviourContext#doInSubContext` has been deprecated
|
||||||
* `BehaviourContextWithFSM`:
|
* `BehaviourContextWithFSM`:
|
||||||
* `launchStateHandling` lost its parameter `contextUpdatesFlow: Flow`
|
* `launchStateHandling` lost its parameter `contextUpdatesFlow: Flow`
|
||||||
* `handleState` of `BehaviourContextWithFSM` now will get/create sub context for the state and launch handling in it
|
* `handleState` of `BehaviourContextWithFSM` now will get/create sub context for the state and launch handling in it
|
||||||
|
@ -116,7 +116,7 @@ inline fun <T> BehaviourContext(
|
|||||||
fun <BC : BehaviourContext> BC.createSubContext(
|
fun <BC : BehaviourContext> BC.createSubContext(
|
||||||
scope: CoroutineScope = LinkedSupervisorScope(),
|
scope: CoroutineScope = LinkedSupervisorScope(),
|
||||||
triggersHolder: TriggersHolder = this.triggersHolder,
|
triggersHolder: TriggersHolder = this.triggersHolder,
|
||||||
updatesUpstreamFlow: Flow<Update> = allUpdatesFlow.accumulatorFlow(scope),
|
updatesUpstreamFlow: Flow<Update> = allUpdatesFlow,
|
||||||
updatesFilter: CustomBehaviourContextAndTypeReceiver<BC, Boolean, Update>? = null,
|
updatesFilter: CustomBehaviourContextAndTypeReceiver<BC, Boolean, Update>? = null,
|
||||||
) = copy(
|
) = copy(
|
||||||
scope = scope,
|
scope = scope,
|
||||||
@ -154,7 +154,7 @@ suspend fun <T, BC : BehaviourContext> BC.doInContext(
|
|||||||
suspend fun <T, BC : BehaviourContext> BC.createSubContextAndDoWithUpdatesFilter(
|
suspend fun <T, BC : BehaviourContext> BC.createSubContextAndDoWithUpdatesFilter(
|
||||||
scope: CoroutineScope = LinkedSupervisorScope(),
|
scope: CoroutineScope = LinkedSupervisorScope(),
|
||||||
triggersHolder: TriggersHolder = this.triggersHolder,
|
triggersHolder: TriggersHolder = this.triggersHolder,
|
||||||
updatesUpstreamFlow: Flow<Update> = allUpdatesFlow.accumulatorFlow(scope),
|
updatesUpstreamFlow: Flow<Update> = allUpdatesFlow,
|
||||||
updatesFilter: CustomBehaviourContextAndTypeReceiver<BC, Boolean, Update>? = null,
|
updatesFilter: CustomBehaviourContextAndTypeReceiver<BC, Boolean, Update>? = null,
|
||||||
stopOnCompletion: Boolean = true,
|
stopOnCompletion: Boolean = true,
|
||||||
behaviourContextReceiver: CustomBehaviourContextReceiver<BC, T>
|
behaviourContextReceiver: CustomBehaviourContextReceiver<BC, T>
|
||||||
|
Loading…
Reference in New Issue
Block a user