From 23be7cac81e8236fc87345f0d6761393a9379155 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 9 Sep 2022 19:46:32 +0600 Subject: [PATCH] provide support of inlines --- posts/src/jvmMain/kotlin/Plugin.kt | 3 ++- posts_registrar/src/jvmMain/kotlin/Plugin.kt | 11 ++++++++++ ratings/source/src/jvmMain/kotlin/Plugin.kt | 20 +++++++++++++++++++ triggers/command/src/jvmMain/kotlin/Plugin.kt | 17 ++++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/posts/src/jvmMain/kotlin/Plugin.kt b/posts/src/jvmMain/kotlin/Plugin.kt index eacb7d6..7b53695 100644 --- a/posts/src/jvmMain/kotlin/Plugin.kt +++ b/posts/src/jvmMain/kotlin/Plugin.kt @@ -94,7 +94,8 @@ object Plugin : Plugin { "Delete post", listOf( Format("/delete_post") - ) + ), + "Should be used with a reply on any post message" ) ) } diff --git a/posts_registrar/src/jvmMain/kotlin/Plugin.kt b/posts_registrar/src/jvmMain/kotlin/Plugin.kt index 9ba9327..3b42989 100644 --- a/posts_registrar/src/jvmMain/kotlin/Plugin.kt +++ b/posts_registrar/src/jvmMain/kotlin/Plugin.kt @@ -5,6 +5,9 @@ import dev.inmo.micro_utils.fsm.common.State import dev.inmo.micro_utils.repos.create import dev.inmo.plagubot.Plugin import dev.inmo.plaguposter.common.* +import dev.inmo.plaguposter.inlines.models.Format +import dev.inmo.plaguposter.inlines.models.OfferTemplate +import dev.inmo.plaguposter.inlines.repos.InlineTemplatesRepo import dev.inmo.plaguposter.posts.models.* import dev.inmo.plaguposter.posts.registrar.state.RegistrationState import dev.inmo.plaguposter.posts.repo.PostsRepo @@ -134,5 +137,13 @@ object Plugin : Plugin { ) ) } + koin.getOrNull() ?.apply { + addTemplate( + OfferTemplate( + "Start post", + listOf(Format("start_post")) + ) + ) + } } } diff --git a/ratings/source/src/jvmMain/kotlin/Plugin.kt b/ratings/source/src/jvmMain/kotlin/Plugin.kt index cc6f968..9594e3c 100644 --- a/ratings/source/src/jvmMain/kotlin/Plugin.kt +++ b/ratings/source/src/jvmMain/kotlin/Plugin.kt @@ -10,6 +10,9 @@ import dev.inmo.micro_utils.repos.pagination.getAll import dev.inmo.micro_utils.repos.set import dev.inmo.plagubot.Plugin import dev.inmo.plaguposter.common.* +import dev.inmo.plaguposter.inlines.models.Format +import dev.inmo.plaguposter.inlines.models.OfferTemplate +import dev.inmo.plaguposter.inlines.repos.InlineTemplatesRepo import dev.inmo.plaguposter.posts.models.PostId import dev.inmo.plaguposter.posts.repo.PostsRepo import dev.inmo.plaguposter.ratings.models.Rating @@ -189,5 +192,22 @@ object Plugin : Plugin { } } } + + koin.getOrNull() ?.apply { + addTemplate( + OfferTemplate( + "Enable ratings for post", + listOf(Format("attach_ratings")), + "Require reply on post message" + ) + ) + addTemplate( + OfferTemplate( + "Disable ratings for post", + listOf(Format("detach_ratings")), + "Require reply on post message" + ) + ) + } } } diff --git a/triggers/command/src/jvmMain/kotlin/Plugin.kt b/triggers/command/src/jvmMain/kotlin/Plugin.kt index c12be69..9bd6123 100644 --- a/triggers/command/src/jvmMain/kotlin/Plugin.kt +++ b/triggers/command/src/jvmMain/kotlin/Plugin.kt @@ -4,6 +4,9 @@ import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.micro_utils.fsm.common.State import dev.inmo.plagubot.Plugin import dev.inmo.plaguposter.common.SuccessfulSymbol +import dev.inmo.plaguposter.inlines.models.Format +import dev.inmo.plaguposter.inlines.models.OfferTemplate +import dev.inmo.plaguposter.inlines.repos.InlineTemplatesRepo import dev.inmo.plaguposter.posts.repo.PostsRepo import dev.inmo.plaguposter.posts.sending.PostPublisher import dev.inmo.plaguposter.ratings.selector.Selector @@ -64,5 +67,19 @@ object Plugin : Plugin { it.content.textSources + regular(SuccessfulSymbol) ) } + + koin.getOrNull() ?.apply { + addTemplate( + OfferTemplate( + "Publish post", + listOf(Format("publish_post")), + if (selector == null) { + "Require reply on post message" + } else { + "Publish post according to selector in system or post with message from reply" + } + ) + ) + } } }