From fe961016315c36659a96462dc482d0337612315c Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 6 Nov 2023 21:56:37 +0600 Subject: [PATCH] change check of yes/no in checking of messages --- posts/gc/src/jvmMain/kotlin/Plugin.kt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/posts/gc/src/jvmMain/kotlin/Plugin.kt b/posts/gc/src/jvmMain/kotlin/Plugin.kt index 63ec05e..92cd5d1 100644 --- a/posts/gc/src/jvmMain/kotlin/Plugin.kt +++ b/posts/gc/src/jvmMain/kotlin/Plugin.kt @@ -24,6 +24,8 @@ import dev.inmo.tgbotapi.extensions.api.forwardMessage import dev.inmo.tgbotapi.extensions.api.send.send import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitMessageDataCallbackQuery +import dev.inmo.tgbotapi.extensions.behaviour_builder.oneOf +import dev.inmo.tgbotapi.extensions.behaviour_builder.parallel import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onCommand import dev.inmo.tgbotapi.extensions.utils.extensions.sameMessage import dev.inmo.tgbotapi.extensions.utils.types.buttons.dataButton @@ -150,9 +152,18 @@ object Plugin : Plugin { } ) - val answer = waitMessageDataCallbackQuery().filter { - it.message.sameMessage(message) - }.first() + val answer = oneOf( + parallel { + waitMessageDataCallbackQuery().filter { + it.data == yesData + }.first() + }, + parallel { + waitMessageDataCallbackQuery().filter { + it.data == noData + }.first() + }, + ) if (answer.data == yesData) { if (recheckActor.trySend(Unit).isSuccess) {