mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-16 13:23:47 +00:00
small refactoring
This commit is contained in:
parent
bb7d47a33b
commit
173839c677
@ -3,8 +3,7 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
|||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
import dev.inmo.tgbotapi.extensions.utils.asInlineQueryUpdate
|
import dev.inmo.tgbotapi.extensions.utils.asInlineQueryUpdate
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery
|
import dev.inmo.tgbotapi.types.InlineQueries.query.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery
|
|
||||||
import kotlinx.coroutines.flow.toList
|
import kotlinx.coroutines.flow.toList
|
||||||
|
|
||||||
typealias InlineQueryMapper<T> = suspend T.() -> T?
|
typealias InlineQueryMapper<T> = suspend T.() -> T?
|
||||||
@ -48,7 +47,7 @@ suspend fun BehaviourContext.waitAnyInlineQuery(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null },
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
count: Int = 1,
|
count: Int = 1,
|
||||||
filter: InlineQueryMapper<dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery>? = null
|
filter: InlineQueryMapper<InlineQuery>? = null
|
||||||
) = waitInlines(count, initRequest, errorFactory, filter)
|
) = waitInlines(count, initRequest, errorFactory, filter)
|
||||||
|
|
||||||
suspend fun BehaviourContext.waitBaseInlineQuery(
|
suspend fun BehaviourContext.waitBaseInlineQuery(
|
||||||
|
@ -5,8 +5,7 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
|||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.expectFlow
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.expectFlow
|
||||||
import dev.inmo.tgbotapi.extensions.utils.asInlineQueryUpdate
|
import dev.inmo.tgbotapi.extensions.utils.asInlineQueryUpdate
|
||||||
import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat
|
import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.query.BaseInlineQuery
|
import dev.inmo.tgbotapi.types.InlineQueries.query.*
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.query.LocationInlineQuery
|
|
||||||
|
|
||||||
internal suspend inline fun <reified T : dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery> BehaviourContext.onInlineQuery(
|
internal suspend inline fun <reified T : dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery> BehaviourContext.onInlineQuery(
|
||||||
includeFilterByChatInBehaviourSubContext: Boolean = true,
|
includeFilterByChatInBehaviourSubContext: Boolean = true,
|
||||||
@ -36,7 +35,7 @@ internal suspend inline fun <reified T : dev.inmo.tgbotapi.types.InlineQueries.q
|
|||||||
|
|
||||||
suspend fun BehaviourContext.onAnyInlineQuery(
|
suspend fun BehaviourContext.onAnyInlineQuery(
|
||||||
includeFilterByChatInBehaviourSubContext: Boolean = true,
|
includeFilterByChatInBehaviourSubContext: Boolean = true,
|
||||||
additionalFilter: (suspend (dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery) -> Boolean)? = null,
|
additionalFilter: (suspend (InlineQuery) -> Boolean)? = null,
|
||||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery>
|
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery>
|
||||||
) = onInlineQuery(includeFilterByChatInBehaviourSubContext, additionalFilter, scenarioReceiver)
|
) = onInlineQuery(includeFilterByChatInBehaviourSubContext, additionalFilter, scenarioReceiver)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user