mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-10-25 14:07:28 +00:00
refactor: expectFlow
This commit is contained in:
1 parent
429fc5d2f9
commit
86e83f7f1a
1 file changed
+6
-3
+6
-3
@@ -58,13 +58,16 @@ fun <T> 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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user