1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-08 09:23:47 +00:00
tgbotapi/docs/dev.inmo.tgbotapi.extensions.behaviour_builder/index.md
2021-03-17 15:18:37 +00:00

16 KiB

//docs/dev.inmo.tgbotapi.extensions.behaviour_builder

Package dev.inmo.tgbotapi.extensions.behaviour_builder

Types

Name Summary
BehaviourContext [common]
Content
data class BehaviourContext(bot: TelegramBot, scope: , flowsUpdatesFilter: FlowsUpdatesFilter) : FlowsUpdatesFilter, RequestsExecutor,
More info
This class contains all necessary tools for work with bots and especially for buildBehaviour


BehaviourContextAndTypeReceiver [common]
Content
typealias BehaviourContextAndTypeReceiver<T, I> = suspend BehaviourContext.(I) -> T


BehaviourContextReceiver [common]
Content
typealias BehaviourContextReceiver<T> = suspend BehaviourContext.() -> T


Functions

Name Summary
asAction [common]
Content
inline fun <T> <T>.asAction(): <T, T>


buildBehaviour [common]
Content
suspend fun TelegramBot.buildBehaviour(scope: , block: BehaviourContextReceiver<Unit>):
More info
Use this method to build bot behaviour and run it via long polling.


[common]
Content
suspend fun TelegramBot.buildBehaviour(scope: , flowUpdatesFilter: FlowsUpdatesFilter, block: BehaviourContextReceiver<Unit>)
More info
Use this method in case you wish to make some additional actions with flowUpdatesFilter.


doInSubContext [common]
Content
suspend fun <T> BehaviourContext.doInSubContext(stopOnCompletion: Boolean = true, behaviourContextReceiver: BehaviourContextReceiver<T>): T


doInSubContextWithFlowsUpdatesFilterSetup [common]
Content
suspend fun <T> BehaviourContext.doInSubContextWithFlowsUpdatesFilterSetup(newFlowsUpdatesFilterSetUp: BehaviourContextAndTypeReceiver<Unit, FlowsUpdatesFilter>?, stopOnCompletion: Boolean = true, behaviourContextReceiver: BehaviourContextReceiver<T>): T
More info
Creates new one BehaviourContext, adding subsequent FlowsUpdatesFilter in case newFlowsUpdatesFilterSetUp is provided and as new BehaviourContext.scope.


doInSubContextWithUpdatesFilter [common]
Content
suspend fun <T> BehaviourContext.doInSubContextWithUpdatesFilter(updatesFilter: BehaviourContextAndTypeReceiver<Boolean, Update>?, stopOnCompletion: Boolean = true, behaviourContextReceiver: BehaviourContextReceiver<T>): T
More info
Creates new one BehaviourContext, adding subsequent FlowsUpdatesFilter in case updatesFilter is provided and as new BehaviourContext.scope


oneOf [common]
Content
suspend fun <O> BehaviourContext.oneOf(vararg deferredActions: <O>): O
suspend fun <O> BehaviourContext.oneOf(deferredActions: Iterable<<O>>): O


oneOfActions [common]
Content
suspend fun <O> BehaviourContext.oneOfActions(vararg deferredActions: <, O>): O
suspend fun <O> BehaviourContext.oneOfActions(deferredActions: Iterable<<
, O>>): O


parallel [common]
Content
suspend fun <T> BehaviourContext.parallel(action: BehaviourContextReceiver<T>): <T>


stop [common]
Content
fun BehaviourContext.stop()
More info
This method will cancel ALL subsequent contexts, expectations and waiters


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