mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 08:37:12 +00:00
small improvement in BehaviourContext
This commit is contained in:
parent
86bd5eaa07
commit
60fdbb8ac4
@ -132,6 +132,8 @@ fun <BC : BehaviourContext> BC.createSubContext(
|
||||
|
||||
/**
|
||||
* Launch [behaviourContextReceiver] in context of [this] as [BehaviourContext] and as [kotlin.coroutines.CoroutineContext]
|
||||
*
|
||||
* [this] [BehaviourContext] will **NOT** be closed automatically
|
||||
*/
|
||||
suspend fun <T, BC : BehaviourContext> BC.doInContext(
|
||||
behaviourContextReceiver: CustomBehaviourContextReceiver<BC, T>
|
||||
@ -152,12 +154,10 @@ suspend fun <T, BC : BehaviourContext> BC.createSubContextAndDoWithUpdatesFilter
|
||||
): T {
|
||||
return supervisorScope {
|
||||
createSubContext(
|
||||
scope = this,
|
||||
scope = this@supervisorScope,
|
||||
triggersHolder = triggersHolder,
|
||||
updatesUpstreamFlow = updatesUpstreamFlow
|
||||
).doInContext(
|
||||
behaviourContextReceiver = behaviourContextReceiver
|
||||
)
|
||||
).behaviourContextReceiver()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user