mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-03 07:09:23 +00:00
refactor: expectFlow
This commit is contained in:
@@ -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