This commit is contained in:
InsanusMokrassar 2022-10-03 11:16:09 +06:00
parent af1bddcc85
commit 089be36601

View File

@ -18,11 +18,13 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextWithFSM
import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.* import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.*
import dev.inmo.tgbotapi.extensions.behaviour_builder.strictlyOn import dev.inmo.tgbotapi.extensions.behaviour_builder.strictlyOn
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.* import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
import dev.inmo.tgbotapi.extensions.utils.extensions.raw.text
import dev.inmo.tgbotapi.extensions.utils.extensions.sameChat import dev.inmo.tgbotapi.extensions.utils.extensions.sameChat
import dev.inmo.tgbotapi.extensions.utils.extensions.sameMessage import dev.inmo.tgbotapi.extensions.utils.extensions.sameMessage
import dev.inmo.tgbotapi.extensions.utils.formatting.buildEntities import dev.inmo.tgbotapi.extensions.utils.formatting.buildEntities
import dev.inmo.tgbotapi.extensions.utils.formatting.regular import dev.inmo.tgbotapi.extensions.utils.formatting.regular
import dev.inmo.tgbotapi.extensions.utils.mediaGroupMessageOrNull import dev.inmo.tgbotapi.extensions.utils.mediaGroupMessageOrNull
import dev.inmo.tgbotapi.extensions.utils.textContentOrNull
import dev.inmo.tgbotapi.extensions.utils.types.buttons.* import dev.inmo.tgbotapi.extensions.utils.types.buttons.*
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.MessageContent import dev.inmo.tgbotapi.types.message.content.MessageContent
@ -66,7 +68,7 @@ object Plugin : Plugin {
waitContentMessage( waitContentMessage(
includeMediaGroups = false includeMediaGroups = false
).filter { ).filter {
it.chat.id == state.context it.chat.id == state.context && it.content.textContentOrNull() ?.text != "/finish_post"
}.take(1).first() }.take(1).first()
) )
} }
@ -82,8 +84,8 @@ object Plugin : Plugin {
emptyList<ContentMessage<MessageContent>>() emptyList<ContentMessage<MessageContent>>()
} }
add { add {
val finishPressed = waitCommandMessage("finish_post").filter { val finishPressed = waitTextMessage().filter {
it.sameChat(messageToDelete) it.sameChat(messageToDelete) && it.content.text == "/finish_post"
}.first() }.first()
emptyList<ContentMessage<MessageContent>>() emptyList<ContentMessage<MessageContent>>()
} }