diff --git a/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt b/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt index 50fc945..79c8487 100644 --- a/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt +++ b/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt @@ -15,6 +15,7 @@ import dev.inmo.micro_utils.pagination.lastIndexExclusive import dev.inmo.plagubot.Plugin import dev.inmo.plagubot.plugins.inline.queries.models.Format import dev.inmo.plagubot.plugins.inline.queries.models.OfferTemplate +import dev.inmo.plagubot.plugins.inline.queries.repos.InlineTemplatesRepo import dev.inmo.plaguposter.common.ChatConfig import dev.inmo.plaguposter.posts.models.PostId import dev.inmo.plaguposter.posts.repo.ReadPostsRepo @@ -62,17 +63,6 @@ object Plugin : Plugin { } override fun Module.setupDI(database: Database, params: JsonObject) { single { get().decodeFromJsonElement(Config.serializer(), params["timer_trigger"] ?: return@single null) } - singleWithRandomQualifier { - OfferTemplate( - "Autoschedule buttons", - listOf( - Format( - "/autoschedule_panel" - ) - ), - "Show autoscheduling publishing info" - ) - } } @OptIn(FlowPreview::class) @@ -83,6 +73,20 @@ object Plugin : Plugin { val chatConfig = koin.get() val postsRepo = koin.get() + koin.getOrNull() ?.apply { + addTemplate( + OfferTemplate( + "Autoschedule buttons", + listOf( + Format( + "/autoschedule_panel" + ) + ), + "Show autoscheduling publishing info" + ) + ) + } + val krontab = koin.get().krontab val dateTimeFormat = koin.get().format krontab.asFlowWithDelays().subscribeSafelyWithoutExceptions(this) { dateTime ->