From 8cd3f91e9e347f6b91e2d47dd4ba84fd94ea329f Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 9 Mar 2021 16:54:32 +0600 Subject: [PATCH] fix of content waiters and expecters --- CHANGELOG.md | 2 ++ .../extensions/behaviour_builder/expectations/WaitContent.kt | 2 +- .../behaviour_builder/triggers_handling/ContentTriggers.kt | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b33ac4743..b96231b661 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitContent.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitContent.kt index fe5cdbf153..67b3746a09 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitContent.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitContent.kt @@ -31,7 +31,7 @@ private suspend fun BehaviourContext.waitCommonMessage( (it as CommonMessage).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 BehaviourContext.waitContent( diff --git a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt index 591686026e..493b58f0ee 100644 --- a/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt +++ b/tgbotapi.extensions.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt @@ -36,7 +36,7 @@ internal suspend inline fun 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 if (additionalFilter == null || additionalFilter(adaptedMessage)) adaptedMessage else null