Package dev. inmo. tgbotapi. extensions. behaviour_builder
Types
BehaviourContext
Link copied to clipboard
data class BehaviourContext(bot: TelegramBot, scope: CoroutineScope, flowsUpdatesFilter: FlowsUpdatesFilter) : FlowsUpdatesFilter, RequestsExecutor, CoroutineScope
Content copied to clipboard
This class contains all necessary tools for work with bots and especially for buildBehaviour
BehaviourContextAndTypeReceiver
Link copied to clipboard
typealias BehaviourContextAndTypeReceiver<T, I> = suspend BehaviourContext.(I) -> T
Content copied to clipboard
BehaviourContextReceiver
Link copied to clipboard
Functions
buildBehaviour
Link copied to clipboard
suspend fun TelegramBot.buildBehaviour(scope: CoroutineScope, block: BehaviourContextReceiver<Unit>): Job
Content copied to clipboard
suspend fun TelegramBot.buildBehaviour(scope: CoroutineScope, flowUpdatesFilter: FlowsUpdatesFilter, block: BehaviourContextReceiver<Unit>)
Content copied to clipboard
Use this method in case you wish to make some additional actions with flowUpdatesFilter.
doInSubContext
Link copied to clipboard
suspend fun <T> BehaviourContext.doInSubContext(stopOnCompletion: Boolean = true, behaviourContextReceiver: BehaviourContextReceiver<T>): T
Content copied to clipboard
doInSubContextWithFlowsUpdatesFilterSetup
Link copied to clipboard
suspend fun <T> BehaviourContext.doInSubContextWithFlowsUpdatesFilterSetup(newFlowsUpdatesFilterSetUp: BehaviourContextAndTypeReceiver<Unit, FlowsUpdatesFilter>?, stopOnCompletion: Boolean = true, behaviourContextReceiver: BehaviourContextReceiver<T>): T
Content copied to clipboard
Creates new one BehaviourContext, adding subsequent FlowsUpdatesFilter in case newFlowsUpdatesFilterSetUp is provided and CoroutineScope as new BehaviourContext.scope.
doInSubContextWithUpdatesFilter
Link copied to clipboard
suspend fun <T> BehaviourContext.doInSubContextWithUpdatesFilter(updatesFilter: BehaviourContextAndTypeReceiver<Boolean, Update>?, stopOnCompletion: Boolean = true, behaviourContextReceiver: BehaviourContextReceiver<T>): T
Content copied to clipboard
Creates new one BehaviourContext, adding subsequent FlowsUpdatesFilter in case updatesFilter is provided and CoroutineScope as new BehaviourContext.scope
oneOfActions
Link copied to clipboard
suspend fun <O> BehaviourContext.oneOfActions(vararg deferredActions: DeferredAction<*, O>): O
Content copied to clipboard
suspend fun <O> BehaviourContext.oneOfActions(deferredActions: Iterable<DeferredAction<*, O>>): O
Content copied to clipboard
parallel
Link copied to clipboard
suspend fun <T> BehaviourContext.parallel(action: BehaviourContextReceiver<T>): Deferred<T>
Content copied to clipboard
stop
Link copied to clipboard
withAction
Link copied to clipboard