diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt index d6131aac84..1f96aef8cd 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt @@ -132,6 +132,8 @@ fun BC.createSubContext( /** * Launch [behaviourContextReceiver] in context of [this] as [BehaviourContext] and as [kotlin.coroutines.CoroutineContext] + * + * [this] [BehaviourContext] will **NOT** be closed automatically */ suspend fun BC.doInContext( behaviourContextReceiver: CustomBehaviourContextReceiver @@ -152,12 +154,10 @@ suspend fun BC.createSubContextAndDoWithUpdatesFilter ): T { return supervisorScope { createSubContext( - scope = this, + scope = this@supervisorScope, triggersHolder = triggersHolder, updatesUpstreamFlow = updatesUpstreamFlow - ).doInContext( - behaviourContextReceiver = behaviourContextReceiver - ) + ).behaviourContextReceiver() } }