DefaultBehaviourContextWithFSM

class DefaultBehaviourContextWithFSM<T : State>(behaviourContext: BehaviourContext, statesManager: StatesManager<T>, handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>) : BehaviourContext, BehaviourContextWithFSM<T>

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

Constructors

DefaultBehaviourContextWithFSM
Link copied to clipboard
common
fun <T : State> DefaultBehaviourContextWithFSM(behaviourContext: BehaviourContext, statesManager: StatesManager<T>, handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>)

Functions

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

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
common
open suspend override fun StatesMachine<in T>.handleState(state: T): T?
launchStateHandling
Link copied to clipboard
common
open suspend fun launchStateHandling(state: T, handlers: List<CheckableHandlerHolder<in T, T>>): T?
open suspend fun launchStateHandling(state: T, contextUpdatesFlow: Flow<Update>, handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>): T?
start
Link copied to clipboard
common
open suspend fun start(): Job
open override fun start(scope: CoroutineScope): Job
startChain
Link copied to clipboard
common
open suspend override fun startChain(state: T)

Properties

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

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

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

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
common
open override val shippingQueriesFlow: Flow<ShippingQueryUpdate>
unknownUpdatesFlow
Link copied to clipboard
common
open override val unknownUpdatesFlow: Flow<UnknownUpdate>