//[docs](../../index.md)/[dev.inmo.tgbotapi.extensions.behaviour_builder](index.md) # Package dev.inmo.tgbotapi.extensions.behaviour_builder ## Types | Name | Summary | |---|---| | [BehaviourContext](-behaviour-context/index.md)| [common]
Content
data class [BehaviourContext](-behaviour-context/index.md)(**bot**: [TelegramBot](../dev.inmo.tgbotapi.bot/index.md#%5Bdev.inmo.tgbotapi.bot%2FTelegramBot%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081), **scope**: , **flowsUpdatesFilter**: [FlowsUpdatesFilter](../dev.inmo.tgbotapi.updateshandlers/-flows-updates-filter/index.md)) : [FlowsUpdatesFilter](../dev.inmo.tgbotapi.updateshandlers/-flows-updates-filter/index.md), [RequestsExecutor](../dev.inmo.tgbotapi.bot/-requests-executor/index.md),
More info
This class contains all necessary tools for work with bots and especially for [buildBehaviour](build-behaviour.md)


| | [BehaviourContextAndTypeReceiver](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextAndTypeReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)| [common]
Content
typealias [BehaviourContextAndTypeReceiver](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextAndTypeReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<[T](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextAndTypeReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081), [I](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextAndTypeReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)> = suspend [BehaviourContext](-behaviour-context/index.md).([I](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextAndTypeReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)) -> [T](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextAndTypeReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)


| | [BehaviourContextReceiver](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)| [common]
Content
typealias [BehaviourContextReceiver](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<[T](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)> = suspend [BehaviourContext](-behaviour-context/index.md).() -> [T](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)


| ## Functions | Name | Summary | |---|---| | [asAction](as-action.md)| [common]
Content
inline fun <[T](as-action.md)> <[T](as-action.md)>.[asAction](as-action.md)(): <[T](as-action.md), [T](as-action.md)>


| | [buildBehaviour](build-behaviour.md)| [common]
Content
suspend fun [TelegramBot](../dev.inmo.tgbotapi.bot/index.md#%5Bdev.inmo.tgbotapi.bot%2FTelegramBot%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081).[buildBehaviour](build-behaviour.md)(scope: , block: [BehaviourContextReceiver](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)>):
More info
Use this method to build bot behaviour and run it via long polling.


[common]
Content
suspend fun [TelegramBot](../dev.inmo.tgbotapi.bot/index.md#%5Bdev.inmo.tgbotapi.bot%2FTelegramBot%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081).[buildBehaviour](build-behaviour.md)(scope: , flowUpdatesFilter: [FlowsUpdatesFilter](../dev.inmo.tgbotapi.updateshandlers/-flows-updates-filter/index.md), block: [BehaviourContextReceiver](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)>)
More info
Use this method in case you wish to make some additional actions with [flowUpdatesFilter](build-behaviour.md).


| | [doInSubContext](do-in-sub-context.md)| [common]
Content
suspend fun <[T](do-in-sub-context.md)> [BehaviourContext](-behaviour-context/index.md).[doInSubContext](do-in-sub-context.md)(stopOnCompletion: [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) = true, behaviourContextReceiver: [BehaviourContextReceiver](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<[T](do-in-sub-context.md)>): [T](do-in-sub-context.md)


| | [doInSubContextWithFlowsUpdatesFilterSetup](do-in-sub-context-with-flows-updates-filter-setup.md)| [common]
Content
suspend fun <[T](do-in-sub-context-with-flows-updates-filter-setup.md)> [BehaviourContext](-behaviour-context/index.md).[doInSubContextWithFlowsUpdatesFilterSetup](do-in-sub-context-with-flows-updates-filter-setup.md)(newFlowsUpdatesFilterSetUp: [BehaviourContextAndTypeReceiver](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextAndTypeReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html), [FlowsUpdatesFilter](../dev.inmo.tgbotapi.updateshandlers/-flows-updates-filter/index.md)>?, stopOnCompletion: [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) = true, behaviourContextReceiver: [BehaviourContextReceiver](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<[T](do-in-sub-context-with-flows-updates-filter-setup.md)>): [T](do-in-sub-context-with-flows-updates-filter-setup.md)
More info
Creates new one [BehaviourContext](-behaviour-context/index.md), adding subsequent [FlowsUpdatesFilter](../dev.inmo.tgbotapi.updateshandlers/-flows-updates-filter/index.md) in case [newFlowsUpdatesFilterSetUp](do-in-sub-context-with-flows-updates-filter-setup.md) is provided and as new [BehaviourContext.scope](-behaviour-context/scope.md).


| | [doInSubContextWithUpdatesFilter](do-in-sub-context-with-updates-filter.md)| [common]
Content
suspend fun <[T](do-in-sub-context-with-updates-filter.md)> [BehaviourContext](-behaviour-context/index.md).[doInSubContextWithUpdatesFilter](do-in-sub-context-with-updates-filter.md)(updatesFilter: [BehaviourContextAndTypeReceiver](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextAndTypeReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html), [Update](../dev.inmo.tgbotapi.types.update.abstracts/-update/index.md)>?, stopOnCompletion: [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) = true, behaviourContextReceiver: [BehaviourContextReceiver](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<[T](do-in-sub-context-with-updates-filter.md)>): [T](do-in-sub-context-with-updates-filter.md)
More info
Creates new one [BehaviourContext](-behaviour-context/index.md), adding subsequent [FlowsUpdatesFilter](../dev.inmo.tgbotapi.updateshandlers/-flows-updates-filter/index.md) in case [updatesFilter](do-in-sub-context-with-updates-filter.md) is provided and as new [BehaviourContext.scope](-behaviour-context/scope.md)


| | [oneOf](one-of.md)| [common]
Content
suspend fun <[O](one-of.md)> [BehaviourContext](-behaviour-context/index.md).[oneOf](one-of.md)(vararg deferredActions: <[O](one-of.md)>): [O](one-of.md)
suspend fun <[O](one-of.md)> [BehaviourContext](-behaviour-context/index.md).[oneOf](one-of.md)(deferredActions: [Iterable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterable/index.html)<<[O](one-of.md)>>): [O](one-of.md)


| | [oneOfActions](one-of-actions.md)| [common]
Content
suspend fun <[O](one-of-actions.md)> [BehaviourContext](-behaviour-context/index.md).[oneOfActions](one-of-actions.md)(vararg deferredActions: <*, [O](one-of-actions.md)>): [O](one-of-actions.md)
suspend fun <[O](one-of-actions.md)> [BehaviourContext](-behaviour-context/index.md).[oneOfActions](one-of-actions.md)(deferredActions: [Iterable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterable/index.html)<<*, [O](one-of-actions.md)>>): [O](one-of-actions.md)


| | [parallel](parallel.md)| [common]
Content
suspend fun <[T](parallel.md)> [BehaviourContext](-behaviour-context/index.md).[parallel](parallel.md)(action: [BehaviourContextReceiver](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder%2FBehaviourContextReceiver%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<[T](parallel.md)>): <[T](parallel.md)>


| | [stop](stop.md)| [common]
Content
fun [BehaviourContext](-behaviour-context/index.md).[stop](stop.md)()
More info
This method will cancel ALL subsequent contexts, expectations and waiters


| | [withAction](with-action.md)| [common]
Content
infix inline fun <[T](with-action.md), [O](with-action.md)> <[T](with-action.md)>.[withAction](with-action.md)(noinline callback: suspend ([T](with-action.md)) -> [O](with-action.md)): <[T](with-action.md), [O](with-action.md)>


|