change check of yes/no in checking of messages

This commit is contained in:
InsanusMokrassar 2023-11-06 21:56:37 +06:00
parent 7abb6efba3
commit fe96101631

View File

@ -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)
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) {