Package dev. inmo. tgbotapi. extensions. behaviour_builder
Types
BehaviourContext
Link copied to clipboard
interface BehaviourContext : 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
DefaultBehaviourContext
Link copied to clipboard
class DefaultBehaviourContext(bot: TelegramBot, scope: CoroutineScope, flowsUpdatesFilter: FlowsUpdatesFilter) : FlowsUpdatesFilter, RequestsExecutor, CoroutineScope, BehaviourContext
Content copied to clipboard
Functions
BehaviourContext
Link copied to clipboard
fun BehaviourContext(bot: TelegramBot, scope: CoroutineScope, flowsUpdatesFilter: FlowsUpdatesFilter = FlowsUpdatesFilter()): DefaultBehaviourContext
Content copied to clipboard
buildBehaviour
Link copied to clipboard
suspend fun TelegramBot.buildBehaviour(scope: CoroutineScope, defaultExceptionsHandler: ExceptionHandler<Unit>? = null, block: BehaviourContextReceiver<Unit>): Job
Content copied to clipboard
suspend fun TelegramBot.buildBehaviour(scope: CoroutineScope, flowUpdatesFilter: FlowsUpdatesFilter, defaultExceptionsHandler: ExceptionHandler<Unit>? = null, 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
telegramBotWithBehaviour
Link copied to clipboard
suspend fun telegramBotWithBehaviour(token: String, scope: CoroutineScope? = null, apiUrl: String = telegramBotAPIDefaultUrl, builder: KtorRequestsExecutorBuilder.() -> Unit = {}, defaultExceptionsHandler: ExceptionHandler<Unit>? = null, block: BehaviourContextReceiver<Unit>): Pair<TelegramBot, Job>
Content copied to clipboard
suspend fun telegramBotWithBehaviour(token: String, flowsUpdatesFilter: FlowsUpdatesFilter, scope: CoroutineScope? = null, apiUrl: String = telegramBotAPIDefaultUrl, builder: KtorRequestsExecutorBuilder.() -> Unit = {}, defaultExceptionsHandler: ExceptionHandler<Unit>? = null, block: BehaviourContextReceiver<Unit>): TelegramBot
Content copied to clipboard
withAction
Link copied to clipboard