mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-30 14:08:44 +00:00
fix of content waiters and expecters
This commit is contained in:
parent
2065faf157
commit
8cd3f91e9e
@ -5,6 +5,8 @@
|
|||||||
* `Common`:
|
* `Common`:
|
||||||
* `Version`:
|
* `Version`:
|
||||||
* `MicroUtils`: `0.4.28` -> `0.4.29`
|
* `MicroUtils`: `0.4.28` -> `0.4.29`
|
||||||
|
* `Behaviour Builder`:
|
||||||
|
* Now content triggers and expectaters will wait for channel posts too
|
||||||
|
|
||||||
## 0.32.9
|
## 0.32.9
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ private suspend fun <O> BehaviourContext.waitCommonMessage(
|
|||||||
(it as CommonMessage<MessageContent>).mapper()
|
(it as CommonMessage<MessageContent>).mapper()
|
||||||
} ?.let { return@expectFlow it }
|
} ?.let { return@expectFlow it }
|
||||||
}
|
}
|
||||||
it.asMessageUpdate() ?.data ?.asCommonMessage() ?.mapper().let(::listOfNotNull)
|
it.asBaseSentMessageUpdate() ?.data ?.asCommonMessage() ?.mapper().let(::listOfNotNull)
|
||||||
}.toList().toList()
|
}.toList().toList()
|
||||||
|
|
||||||
private suspend inline fun <reified T : MessageContent> BehaviourContext.waitContent(
|
private suspend inline fun <reified T : MessageContent> BehaviourContext.waitContent(
|
||||||
|
@ -36,7 +36,7 @@ internal suspend inline fun <reified T : MessageContent> BehaviourContext.onCont
|
|||||||
return@expectFlow it
|
return@expectFlow it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
it.asMessageUpdate() ?.data ?.asCommonMessage() ?.let { message ->
|
it.asBaseSentMessageUpdate() ?.data ?.asCommonMessage() ?.let { message ->
|
||||||
if (message.content is T) {
|
if (message.content is T) {
|
||||||
val adaptedMessage = message as CommonMessage<T>
|
val adaptedMessage = message as CommonMessage<T>
|
||||||
if (additionalFilter == null || additionalFilter(adaptedMessage)) adaptedMessage else null
|
if (additionalFilter == null || additionalFilter(adaptedMessage)) adaptedMessage else null
|
||||||
|
Loading…
Reference in New Issue
Block a user