mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-04 15:49:41 +00:00
refactor: expectFlow
This commit is contained in:
@@ -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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user