diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/Base.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/Base.kt index c5bb807fca..ae9371896e 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/Base.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/Base.kt @@ -58,13 +58,16 @@ fun FlowsUpdatesFilter.expectFlow( result.getOrThrow() } }.flatten() - return flow { - initRequest ?.also { + + return if (initRequest == null) { + flow + } else { + flow { runCatching { bot.execute(initRequest) } + flow.collect(this) } - emitAll(flow) } }