1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-04 15:49:41 +00:00

refactor: expectFlow

This commit is contained in:
2025-06-15 12:24:23 +06:00
parent 429fc5d2f9
commit 86e83f7f1a

View File

@@ -58,13 +58,16 @@ fun <T> FlowsUpdatesFilter.expectFlow(
result.getOrThrow() result.getOrThrow()
} }
}.flatten() }.flatten()
return flow {
initRequest ?.also { return if (initRequest == null) {
flow
} else {
flow {
runCatching { runCatching {
bot.execute(initRequest) bot.execute(initRequest)
} }
flow.collect(this)
} }
emitAll(flow)
} }
} }