mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
add asAction and several variants of oneOf
This commit is contained in:
parent
fc71e028c4
commit
08b8710772
@ -12,10 +12,20 @@ suspend fun <T> BehaviourContext.parallel(
|
||||
|
||||
inline infix fun <T, O> Deferred<T>.withAction(noinline callback: suspend (T) -> O) = DeferredAction(this, callback)
|
||||
|
||||
suspend fun <O> BehaviourContext.oneOf(
|
||||
inline fun <T> Deferred<T>.asAction() = DeferredAction(this) { it }
|
||||
|
||||
suspend fun <O> BehaviourContext.oneOfActions(
|
||||
deferredActions: Iterable<DeferredAction<*, O>>
|
||||
) = deferredActions.invokeFirstOf(scope)
|
||||
|
||||
suspend fun <O> BehaviourContext.oneOf(
|
||||
suspend fun <O> BehaviourContext.oneOfActions(
|
||||
vararg deferredActions: DeferredAction<*, O>
|
||||
) = this@oneOfActions.oneOfActions(deferredActions.toList())
|
||||
|
||||
suspend fun <O> BehaviourContext.oneOf(
|
||||
deferredActions: Iterable<Deferred<O>>
|
||||
) = oneOfActions(deferredActions.map { it.asAction() })
|
||||
|
||||
suspend fun <O> BehaviourContext.oneOf(
|
||||
vararg deferredActions: Deferred<O>
|
||||
) = oneOf(deferredActions.toList())
|
||||
|
Loading…
Reference in New Issue
Block a user