1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-27 12:38:45 +00:00

fix of content waiters and expecters

This commit is contained in:
InsanusMokrassar 2021-03-09 16:54:32 +06:00
parent 2065faf157
commit 8cd3f91e9e
3 changed files with 4 additions and 2 deletions

View File

@ -5,6 +5,8 @@
* `Common`:
* `Version`:
* `MicroUtils`: `0.4.28` -> `0.4.29`
* `Behaviour Builder`:
* Now content triggers and expectaters will wait for channel posts too
## 0.32.9

View File

@ -31,7 +31,7 @@ private suspend fun <O> BehaviourContext.waitCommonMessage(
(it as CommonMessage<MessageContent>).mapper()
} ?.let { return@expectFlow it }
}
it.asMessageUpdate() ?.data ?.asCommonMessage() ?.mapper().let(::listOfNotNull)
it.asBaseSentMessageUpdate() ?.data ?.asCommonMessage() ?.mapper().let(::listOfNotNull)
}.toList().toList()
private suspend inline fun <reified T : MessageContent> BehaviourContext.waitContent(

View File

@ -36,7 +36,7 @@ internal suspend inline fun <reified T : MessageContent> BehaviourContext.onCont
return@expectFlow it
}
}
it.asMessageUpdate() ?.data ?.asCommonMessage() ?.let { message ->
it.asBaseSentMessageUpdate() ?.data ?.asCommonMessage() ?.let { message ->
if (message.content is T) {
val adaptedMessage = message as CommonMessage<T>
if (additionalFilter == null || additionalFilter(adaptedMessage)) adaptedMessage else null