1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-04 07:39:39 +00:00
This commit is contained in:
2022-05-02 13:21:43 +06:00
parent 8e7f7a03c8
commit 8c9cd9df67
7 changed files with 32 additions and 9 deletions

View File

@@ -38,10 +38,12 @@ suspend fun <T : State> telegramBotWithBehaviourAndFSM(
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*, T>> = mutableListOf(),
testServer: Boolean = false,
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder<T>, Unit>
): TelegramBot = telegramBot(
token,
apiUrl,
testServer,
builder
).apply {
buildBehaviourWithFSMAndStartLongPolling(
@@ -73,11 +75,13 @@ suspend fun <T : State> telegramBotWithBehaviourAndFSMAndStartLongPolling(
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
presetHandlers: MutableList<BehaviourWithFSMStateHandlerHolder<*, T>> = mutableListOf(),
testServer: Boolean = false,
block: CustomBehaviourContextReceiver<BehaviourContextWithFSMBuilder<T>, Unit>
): Pair<TelegramBot, Job> {
return telegramBot(
token,
apiUrl,
testServer,
builder
).let {
it to it.buildBehaviourWithFSMAndStartLongPolling (