mirror of
https://github.com/InsanusMokrassar/PlaguPoster.git
synced 2024-11-25 08:58:45 +00:00
provide support of inlines
This commit is contained in:
parent
bf68fc58f4
commit
23be7cac81
@ -94,7 +94,8 @@ object Plugin : Plugin {
|
||||
"Delete post",
|
||||
listOf(
|
||||
Format("/delete_post")
|
||||
)
|
||||
),
|
||||
"Should be used with a reply on any post message"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -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<InlineTemplatesRepo>() ?.apply {
|
||||
addTemplate(
|
||||
OfferTemplate(
|
||||
"Start post",
|
||||
listOf(Format("start_post"))
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<InlineTemplatesRepo>() ?.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"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<InlineTemplatesRepo>() ?.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"
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user