mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
fix build
This commit is contained in:
parent
ed077ae1bc
commit
96d980cb8a
@ -35,23 +35,23 @@ private suspend inline fun <reified T : CallbackQuery> BehaviourContext.waitCall
|
||||
count: Int = 1,
|
||||
initRequest: Request<*>? = null,
|
||||
noinline errorFactory: NullableRequestBuilder<*> = { null },
|
||||
filter: SimpleFilter<T>? = null,
|
||||
noinline filter: CallbackQueryMapper<T>? = null
|
||||
noinline filter: SimpleFilter<T>? = null,
|
||||
noinline mapper: CallbackQueryMapper<T>? = null
|
||||
) : List<T> = waitCallbackQueries<T>(
|
||||
count,
|
||||
initRequest,
|
||||
errorFactory,
|
||||
filter ?.let {
|
||||
{
|
||||
(it as? T) ?.let(::filter)
|
||||
(it as? T) ?.let { filter(it) } == true
|
||||
}
|
||||
}
|
||||
) {
|
||||
if (this is T) {
|
||||
if (filter == null) {
|
||||
if (mapper == null) {
|
||||
this
|
||||
} else {
|
||||
filter(this)
|
||||
mapper(this)
|
||||
}
|
||||
} else {
|
||||
null
|
||||
|
@ -15,16 +15,16 @@ private suspend inline fun <reified T : ChatMemberUpdatedUpdate> BehaviourContex
|
||||
count: Int = 1,
|
||||
initRequest: Request<*>? = null,
|
||||
noinline errorFactory: NullableRequestBuilder<*> = { null },
|
||||
filter: SimpleFilter<T>? = null,
|
||||
noinline filter: SimpleFilter<T>? = null,
|
||||
noinline mapper: ChatMemberUpdatedMapper<ChatMemberUpdated>
|
||||
): List<ChatMemberUpdated> = expectFlow(
|
||||
initRequest,
|
||||
count,
|
||||
errorFactory
|
||||
) {
|
||||
val data = (it as? T) ?.data ?: return@expectFlow emptyList()
|
||||
if (filter == null || filter(data)) {
|
||||
data.mapper().let(::listOfNotNull)
|
||||
val casted = (it as? T) ?: return@expectFlow emptyList()
|
||||
if (filter == null || filter(casted)) {
|
||||
casted.data.mapper().let(::listOfNotNull)
|
||||
} else {
|
||||
emptyList()
|
||||
}
|
||||
@ -34,7 +34,7 @@ private suspend inline fun <reified T : ChatMemberUpdatedUpdate> BehaviourContex
|
||||
count: Int = 1,
|
||||
initRequest: Request<*>? = null,
|
||||
noinline errorFactory: NullableRequestBuilder<*> = { null },
|
||||
filter: SimpleFilter<T>? = null,
|
||||
noinline filter: SimpleFilter<T>? = null,
|
||||
noinline mapper: ChatMemberUpdatedMapper<ChatMemberUpdated>? = null
|
||||
) : List<ChatMemberUpdated> = waitChatMemberUpdated<T>(
|
||||
count,
|
||||
|
@ -56,14 +56,18 @@ private suspend inline fun <reified T : MessageContent> BehaviourContext.waitCon
|
||||
initRequest: Request<*>? = null,
|
||||
includeMediaGroups: Boolean = true,
|
||||
noinline errorFactory: NullableRequestBuilder<*> = { null },
|
||||
filter: SimpleFilter<CommonMessage<T>>? = null,
|
||||
noinline filter: SimpleFilter<CommonMessage<T>>? = null,
|
||||
noinline mapper: CommonMessageToContentMapper<T>? = null
|
||||
) : List<T> = waitCommonMessage<T>(
|
||||
count,
|
||||
initRequest,
|
||||
includeMediaGroups,
|
||||
errorFactory,
|
||||
filter
|
||||
filter ?.let {
|
||||
{
|
||||
it.withContent<T>() ?.let { filter(it) } == true
|
||||
}
|
||||
}
|
||||
) {
|
||||
if (content is T) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
|
@ -39,13 +39,17 @@ private suspend inline fun <reified T : ChatEvent> BehaviourContext.waitEvents(
|
||||
count: Int = 1,
|
||||
initRequest: Request<*>? = null,
|
||||
noinline errorFactory: NullableRequestBuilder<*> = { null },
|
||||
filter: SimpleFilter<ChatEventMessage<T>>? = null,
|
||||
noinline filter: SimpleFilter<ChatEventMessage<T>>? = null,
|
||||
noinline mapper: EventMessageToEventMapper<T>? = null
|
||||
) : List<T> = waitEventMessages<T>(
|
||||
initRequest,
|
||||
errorFactory,
|
||||
count,
|
||||
filter
|
||||
filter ?.let {
|
||||
{
|
||||
(it.chatEvent as? T) ?.let { filter(it as ChatEventMessage<T>) } == true
|
||||
}
|
||||
}
|
||||
) {
|
||||
if (chatEvent is T) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
|
@ -33,19 +33,23 @@ private suspend inline fun <reified T : InlineQuery> BehaviourContext.waitInline
|
||||
count: Int = 1,
|
||||
initRequest: Request<*>? = null,
|
||||
noinline errorFactory: NullableRequestBuilder<*> = { null },
|
||||
filter: SimpleFilter<InlineQuery>? = null,
|
||||
noinline filter: SimpleFilter<T>? = null,
|
||||
noinline mapper: InlineQueryMapper<T>? = null
|
||||
) : List<T> = waitInlineQueries<T>(
|
||||
count,
|
||||
initRequest,
|
||||
errorFactory,
|
||||
filter
|
||||
filter ?.let {
|
||||
{
|
||||
(it as? T) ?.let { casted -> filter(casted) } == true
|
||||
}
|
||||
}
|
||||
) {
|
||||
if (this is T) {
|
||||
if (filter == null) {
|
||||
if (mapper == null) {
|
||||
this
|
||||
} else {
|
||||
filter(this)
|
||||
mapper(this)
|
||||
}
|
||||
} else {
|
||||
null
|
||||
|
@ -37,7 +37,7 @@ suspend inline fun <reified T : EncryptedPassportElement> BehaviourContext.waitP
|
||||
count: Int = 1,
|
||||
initRequest: Request<*>? = null,
|
||||
noinline errorFactory: NullableRequestBuilder<*> = { null },
|
||||
filter: SimpleFilter<PassportMessage>? = null,
|
||||
noinline filter: SimpleFilter<PassportMessage>? = null,
|
||||
noinline mapper: PassportMessageMapper? = null
|
||||
) : List<PassportData> = waitPassportMessages(
|
||||
initRequest,
|
||||
|
Loading…
Reference in New Issue
Block a user