docs

# DefaultBehaviourContextWithFSM

class DefaultBehaviourContextWithFSM < T : State>( behaviourContext: BehaviourContext , statesManager: StatesManager< T >, handlers: List < BehaviourWithFSMStateHandlerHolder <*, T >>, onStateHandlingErrorHandler: StateHandlingErrorHandler< T > = defaultStateHandlingErrorHandler()) : BehaviourContext, BehaviourContextWithFSM < T >
Content copied to clipboard

Default realization of BehaviourContextWithFSM. It uses behaviourContext as a base for this object as BehaviourContext, but managing substates contexts updates for avoiding of updates lost between states

## Parameters

onStateHandlingErrorHandler

Will be used in case if state handling has not been successfully completed in launchStateHandling

## Constructors

DefaultBehaviourContextWithFSM
Link copied to clipboard
fun < T : State> DefaultBehaviourContextWithFSM ( behaviourContext: BehaviourContext , statesManager: StatesManager< T >, handlers: List < BehaviourWithFSMStateHandlerHolder <*, T >>, onStateHandlingErrorHandler: StateHandlingErrorHandler< T > = defaultStateHandlingErrorHandler())
Content copied to clipboard

## Functions

add
Link copied to clipboard
open override fun < I : T > add ( kClass: KClass < I >, strict: Boolean , handler: BehaviourWithFSMStateHandler < I , T >)
Content copied to clipboard

Add NON STRICT handler to list of available in future BehaviourContextWithFSM. Non strict means that for input State will be used KClass.isInstance and any inheritor of kClass will pass this requirement

addStrict
Link copied to clipboard
open fun < I : T > addStrict (kClass: KClass < I >, handler: BehaviourWithFSMStateHandler < I , T >)
Content copied to clipboard

Add STRICT handler to list of available in future BehaviourContextWithFSM. Strict means that for input State will be used State::class == kClass and any State with exactly the same type will pass requirements

close
Link copied to clipboard
expect open override fun close ()
Content copied to clipboard
copy
Link copied to clipboard
open override fun copy ( bot: TelegramBot , scope: CoroutineScope, broadcastChannelsSize: Int , onBufferOverflow: BufferOverflow, upstreamUpdatesFlow: Flow< Update >?, triggersHolder: TriggersHolder , updatesFilter: BehaviourContextAndTypeReceiver < Boolean , Update >?): DefaultBehaviourContextWithFSM < T >
Content copied to clipboard
open override fun copy ( bot: TelegramBot , scope: CoroutineScope, broadcastChannelsSize: Int , onBufferOverflow: BufferOverflow, upstreamUpdatesFlow: Flow< Update >?, triggersHolder: TriggersHolder , onStateHandlingErrorHandler: StateHandlingErrorHandler< T >, updatesFilter: BehaviourContextAndTypeReceiver < Boolean , Update >?): DefaultBehaviourContextWithFSM < T >
Content copied to clipboard
execute
Link copied to clipboard
open suspend override fun <T : Any > execute (request: Request <T>): T
Content copied to clipboard

Unsafe execution of incoming request. Can throw almost any exception. So, it is better to use something like dev.inmo.tgbotapi.extensions.utils.shortcuts.executeAsync or dev.inmo.tgbotapi.extensions.utils.shortcuts.executeUnsafe

handleState
Link copied to clipboard
open suspend override fun StatesMachine<in T >. handleState (state: T ): T ?
Content copied to clipboard
launchStateHandling
Link copied to clipboard
open suspend override fun launchStateHandling (state: T , handlers: List <CheckableHandlerHolder<in T , T >>): T ?
Content copied to clipboard
open suspend fun launchStateHandling ( state: T , handlers: List <CheckableHandlerHolder<in T , T >>, onStateHandlingErrorHandler: suspend ( T , Throwable ) -> T ?): T ?
Content copied to clipboard
onStateOrSubstate
Link copied to clipboard
inline fun < I : T > onStateOrSubstate (handler: BehaviourWithFSMStateHandler < I , T >)
Content copied to clipboard

Add NON STRICT handler to list of available in future BehaviourContextWithFSM. Non strict means that for input State will be used KClass.isInstance and any inheritor of kClass will pass this requirement

start
Link copied to clipboard
open suspend fun start (): Job
Content copied to clipboard
open override fun start (scope: CoroutineScope): Job
Content copied to clipboard
startChain
Link copied to clipboard
open suspend override fun startChain (state: T )
Content copied to clipboard
strictlyOn
Link copied to clipboard
inline fun < I : T > strictlyOn (handler: BehaviourWithFSMStateHandler < I , T >)
Content copied to clipboard

Add STRICT handler to list of available in future BehaviourContextWithFSM. Strict means that for input State will be used State::class == kClass and any State with exactly the same type will pass requirements

## Properties

allowedUpdates
Link copied to clipboard
open override val allowedUpdates : List < String >
Content copied to clipboard
allUpdatesFlow
Link copied to clipboard
open override val allUpdatesFlow : Flow< Update >
Content copied to clipboard
allUpdatesWithoutMediaGroupsGroupingFlow
Link copied to clipboard
open override val allUpdatesWithoutMediaGroupsGroupingFlow : Flow< Update >
Content copied to clipboard
asUpdateReceiver
Link copied to clipboard
open override val asUpdateReceiver : UpdateReceiver < Update >
Content copied to clipboard
bot
Link copied to clipboard
open override val bot : TelegramBot
Content copied to clipboard
callbackQueriesFlow
Link copied to clipboard
open override val callbackQueriesFlow : Flow< CallbackQueryUpdate >
Content copied to clipboard
channelPostMediaGroupsFlow
Link copied to clipboard
open override val channelPostMediaGroupsFlow : Flow< ChannelPostMediaGroupUpdate >
Content copied to clipboard
channelPostsFlow
Link copied to clipboard
open override val channelPostsFlow : Flow< ChannelPostUpdate >
Content copied to clipboard
chatJoinRequestUpdateFlow
Link copied to clipboard
open override val chatJoinRequestUpdateFlow : Flow< ChatJoinRequestUpdate >
Content copied to clipboard
chatMemberUpdatesFlow
Link copied to clipboard
open override val chatMemberUpdatesFlow : Flow< CommonChatMemberUpdatedUpdate >
Content copied to clipboard
chosenInlineResultsFlow
Link copied to clipboard
open override val chosenInlineResultsFlow : Flow< ChosenInlineResultUpdate >
Content copied to clipboard
coroutineContext
Link copied to clipboard
open override val coroutineContext : CoroutineContext
Content copied to clipboard
editedChannelPostMediaGroupsFlow
Link copied to clipboard
open override val editedChannelPostMediaGroupsFlow : Flow< EditChannelPostMediaGroupUpdate >
Content copied to clipboard
editedChannelPostsFlow
Link copied to clipboard
open override val editedChannelPostsFlow : Flow< EditChannelPostUpdate >
Content copied to clipboard
editedMessageMediaGroupsFlow
Link copied to clipboard
open override val editedMessageMediaGroupsFlow : Flow< EditMessageMediaGroupUpdate >
Content copied to clipboard
editedMessagesFlow
Link copied to clipboard
open override val editedMessagesFlow : Flow< EditMessageUpdate >
Content copied to clipboard
flowsUpdatesFilter
Link copied to clipboard
open override val flowsUpdatesFilter : FlowsUpdatesFilter
Content copied to clipboard

This parameter will be used to subscribe on different types of update

inlineQueriesFlow
Link copied to clipboard
open override val inlineQueriesFlow : Flow< InlineQueryUpdate >
Content copied to clipboard
messageMediaGroupsFlow
Link copied to clipboard
open override val messageMediaGroupsFlow : Flow< MessageMediaGroupUpdate >
Content copied to clipboard
messagesFlow
Link copied to clipboard
open override val messagesFlow : Flow< MessageUpdate >
Content copied to clipboard
myChatMemberUpdatesFlow
Link copied to clipboard
open override val myChatMemberUpdatesFlow : Flow< MyChatMemberUpdatedUpdate >
Content copied to clipboard
pollAnswersFlow
Link copied to clipboard
open override val pollAnswersFlow : Flow< PollAnswerUpdate >
Content copied to clipboard
pollsFlow
Link copied to clipboard
open override val pollsFlow : Flow< PollUpdate >
Content copied to clipboard
preCheckoutQueriesFlow
Link copied to clipboard
open override val preCheckoutQueriesFlow : Flow< PreCheckoutQueryUpdate >
Content copied to clipboard
scope
Link copied to clipboard
open override val scope : CoroutineScope
Content copied to clipboard

Will be used for creating of some subscriptions inside of methods, updates listening and different other things in context of working with CoroutineScope and coroutines.

shippingQueriesFlow
Link copied to clipboard
open override val shippingQueriesFlow : Flow< ShippingQueryUpdate >
Content copied to clipboard
triggersHolder
Link copied to clipboard
open override val triggersHolder : TriggersHolder
Content copied to clipboard
unknownUpdatesFlow
Link copied to clipboard
open override val unknownUpdatesFlow : Flow< UnknownUpdate >
Content copied to clipboard