1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-25 02:58:10 +00:00
tgbotapi/tgbotapi.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandler.kt

14 lines
429 B
Kotlin
Raw Normal View History

2021-10-13 08:22:01 +00:00
package dev.inmo.tgbotapi.extensions.behaviour_builder
import dev.inmo.micro_utils.fsm.common.*
2022-05-10 20:47:00 +00:00
fun interface BehaviourWithFSMStateHandler<I : O, O : State> : StatesHandler<I, O> {
2021-11-06 15:21:49 +00:00
suspend fun BehaviourContextWithFSM<in O>.handleState(state: I): O?
2022-05-10 20:47:00 +00:00
override suspend fun StatesMachine<in O>.handleState(state: I): O? = if (this is BehaviourContextWithFSM) {
handleState(state)
} else {
null
}
2021-10-13 08:22:01 +00:00
}