mirror of
https://github.com/InsanusMokrassar/PlaguPoster.git
synced 2024-12-22 14:07:14 +00:00
add opportunity to finish post creating by command
This commit is contained in:
parent
3634b9a2a2
commit
1d88423b03
@ -18,6 +18,7 @@ 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.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
|
||||||
@ -80,6 +81,12 @@ object Plugin : Plugin {
|
|||||||
}.first()
|
}.first()
|
||||||
emptyList<ContentMessage<MessageContent>>()
|
emptyList<ContentMessage<MessageContent>>()
|
||||||
}
|
}
|
||||||
|
add {
|
||||||
|
val finishPressed = waitCommandMessage("finish_post").filter {
|
||||||
|
it.sameChat(messageToDelete)
|
||||||
|
}.first()
|
||||||
|
emptyList<ContentMessage<MessageContent>>()
|
||||||
|
}
|
||||||
}.ifEmpty {
|
}.ifEmpty {
|
||||||
edit(messageToDelete, "Ok, finishing your request")
|
edit(messageToDelete, "Ok, finishing your request")
|
||||||
return@strictlyOn RegistrationState.Finish(
|
return@strictlyOn RegistrationState.Finish(
|
||||||
@ -135,8 +142,16 @@ object Plugin : Plugin {
|
|||||||
koin.getOrNull<InlineTemplatesRepo>() ?.apply {
|
koin.getOrNull<InlineTemplatesRepo>() ?.apply {
|
||||||
addTemplate(
|
addTemplate(
|
||||||
OfferTemplate(
|
OfferTemplate(
|
||||||
"Start post",
|
"Start post creating",
|
||||||
listOf(Format("/start_post"))
|
listOf(Format("/start_post")),
|
||||||
|
"Use this command to start creating of complex post with several messages"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
addTemplate(
|
||||||
|
OfferTemplate(
|
||||||
|
"Finish post creating",
|
||||||
|
listOf(Format("/finish_post")),
|
||||||
|
"Finish creating of complex post"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user