From c64faf75d001a1fa0a7cb94e622156992c9cca0c Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 18 Mar 2023 12:28:35 +0600 Subject: [PATCH 1/7] start 0.1.1 --- CHANGELOG.md | 2 ++ gradle.properties | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b0b281..5c423f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # PlaguPoster +## 0.1.1 + ## 0.0.10 ## 0.0.9 diff --git a/gradle.properties b/gradle.properties index 5c07492..7a47a53 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ android.enableJetifier=true # Project data group=dev.inmo -version=0.1.0 +version=0.1.1 From 7bc7bf6e8cf02bf1fa00cddd6c94d22fdfc440e7 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 18 Mar 2023 12:35:18 +0600 Subject: [PATCH 2/7] update dependencies --- CHANGELOG.md | 4 +++- gradle/libs.versions.toml | 10 +++++----- ratings/gc/src/jvmMain/kotlin/Plugin.kt | 6 ++---- .../selector_with_timer/src/jvmMain/kotlin/Plugin.kt | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c423f9..9e9a2c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,11 @@ ## 0.1.1 +* Update dependencies + ## 0.0.10 ## 0.0.9 -* Update depedencies +* Update dependencies diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9d06886..fb67715 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,13 +3,13 @@ kotlin = "1.8.10" kotlin-serialization = "1.5.0" -plagubot = "5.0.0" -tgbotapi = "7.0.0" +plagubot = "5.0.1" +tgbotapi = "7.0.1" microutils = "0.17.5" kslog = "1.0.0" -krontab = "0.9.0" -tgbotapi-libraries = "0.10.0" -plagubot-plugins = "0.10.0" +krontab = "0.10.0-branch_0.10.0-build171" +tgbotapi-libraries = "0.10.1" +plagubot-plugins = "0.10.1" dokka = "1.8.10" diff --git a/ratings/gc/src/jvmMain/kotlin/Plugin.kt b/ratings/gc/src/jvmMain/kotlin/Plugin.kt index 1f06e5f..d8a297a 100644 --- a/ratings/gc/src/jvmMain/kotlin/Plugin.kt +++ b/ratings/gc/src/jvmMain/kotlin/Plugin.kt @@ -1,10 +1,9 @@ package dev.inmo.plaguposter.ratings.gc -import com.soywiz.klock.milliseconds import com.soywiz.klock.seconds import dev.inmo.krontab.KrontabTemplate import dev.inmo.krontab.toSchedule -import dev.inmo.krontab.utils.asFlow +import dev.inmo.krontab.utils.asFlowWithDelays import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.micro_utils.repos.* import dev.inmo.plagubot.Plugin @@ -12,7 +11,6 @@ import dev.inmo.plaguposter.posts.repo.PostsRepo import dev.inmo.plaguposter.ratings.models.Rating import dev.inmo.plaguposter.ratings.repo.RatingsRepo import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext -import dev.inmo.tgbotapi.types.MilliSeconds import dev.inmo.tgbotapi.types.Seconds import kotlinx.serialization.Serializable import kotlinx.serialization.json.* @@ -50,7 +48,7 @@ object Plugin : Plugin { } } config.autoclear ?.let { autoclear -> - autoclear.autoClearKrontab.toSchedule().asFlow().subscribeSafelyWithoutExceptions(scope) { + autoclear.autoClearKrontab.toSchedule().asFlowWithDelays().subscribeSafelyWithoutExceptions(scope) { val dropCreatedBefore = it - (autoclear.skipPostAge ?: 0).seconds ratingsRepo.getPostsWithRatingLessEq(autoclear.rating).keys.forEach { if ((postsRepo.getPostCreationTime(it) ?: return@forEach) < dropCreatedBefore) { diff --git a/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt b/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt index 33f324c..9fb94fe 100644 --- a/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt +++ b/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt @@ -2,7 +2,7 @@ package dev.inmo.plaguposter.triggers.selector_with_timer import dev.inmo.krontab.KrontabTemplate import dev.inmo.krontab.toSchedule -import dev.inmo.krontab.utils.asFlow +import dev.inmo.krontab.utils.asFlowWithDelays import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.plagubot.Plugin import dev.inmo.plaguposter.posts.sending.PostPublisher @@ -35,7 +35,7 @@ object Plugin : Plugin { val publisher = koin.get() val selector = koin.get() val filters = koin.getAll().distinct() - koin.get().krontab.asFlow().subscribeSafelyWithoutExceptions(this) { dateTime -> + koin.get().krontab.asFlowWithDelays().subscribeSafelyWithoutExceptions(this) { dateTime -> selector.take(now = dateTime).forEach { postId -> if (filters.all { it.check(postId, dateTime) }) { publisher.publish(postId) From 7a4fb05bfb3280717988bcfc05d7fa8a199d3f4e Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 18 Mar 2023 13:12:05 +0600 Subject: [PATCH 3/7] add publishing_autoschedule --- CHANGELOG.md | 3 + .../src/commonMain/kotlin/DefaultSelector.kt | 4 +- .../src/commonMain/kotlin/Selector.kt | 2 +- settings.gradle | 1 - .../selector_with_scheduling/build.gradle | 16 --- .../src/commonMain/kotlin/PackageInfo.kt | 1 - .../src/jvmMain/kotlin/Plugin.kt | 11 -- .../src/main/AndroidManifest.xml | 1 - .../src/jvmMain/kotlin/Plugin.kt | 113 +++++++++++++++++- 9 files changed, 116 insertions(+), 36 deletions(-) delete mode 100644 triggers/selector_with_scheduling/build.gradle delete mode 100644 triggers/selector_with_scheduling/src/commonMain/kotlin/PackageInfo.kt delete mode 100644 triggers/selector_with_scheduling/src/jvmMain/kotlin/Plugin.kt delete mode 100644 triggers/selector_with_scheduling/src/main/AndroidManifest.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e9a2c0..a3dab43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ ## 0.1.1 * Update dependencies +* `Triggers` + * `SelectorWithTimer` + * Opportunity to get schedule of posts using `publishing_autoschedule` command ## 0.0.10 diff --git a/ratings/selector/src/commonMain/kotlin/DefaultSelector.kt b/ratings/selector/src/commonMain/kotlin/DefaultSelector.kt index 75bad45..fafeb3f 100644 --- a/ratings/selector/src/commonMain/kotlin/DefaultSelector.kt +++ b/ratings/selector/src/commonMain/kotlin/DefaultSelector.kt @@ -11,11 +11,11 @@ class DefaultSelector ( private val ratingsRepo: RatingsRepo, private val postsRepo: PostsRepo ) : Selector { - override suspend fun take(n: Int, now: DateTime): List { + override suspend fun take(n: Int, now: DateTime, exclude: List): List { val result = mutableListOf() do { - val selected = config.active(now.time) ?.rating ?.select(ratingsRepo, postsRepo, result, now) ?: break + val selected = config.active(now.time) ?.rating ?.select(ratingsRepo, postsRepo, result + exclude, now) ?: break result.add(selected) } while (result.size < n) diff --git a/ratings/selector/src/commonMain/kotlin/Selector.kt b/ratings/selector/src/commonMain/kotlin/Selector.kt index 813aa20..134f6b1 100644 --- a/ratings/selector/src/commonMain/kotlin/Selector.kt +++ b/ratings/selector/src/commonMain/kotlin/Selector.kt @@ -4,5 +4,5 @@ import com.soywiz.klock.DateTime import dev.inmo.plaguposter.posts.models.PostId interface Selector { - suspend fun take(n: Int = 1, now: DateTime = DateTime.now()): List + suspend fun take(n: Int = 1, now: DateTime = DateTime.now(), exclude: List = emptyList()): List } diff --git a/settings.gradle b/settings.gradle index 1bb37bc..f356c8c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -11,7 +11,6 @@ String[] includes = [ ":ratings:gc", ":triggers:command", ":triggers:selector_with_timer", - ":triggers:selector_with_scheduling", ":triggers:timer", ":triggers:timer:disablers:ratings", ":triggers:timer:disablers:autoposts", diff --git a/triggers/selector_with_scheduling/build.gradle b/triggers/selector_with_scheduling/build.gradle deleted file mode 100644 index f95f579..0000000 --- a/triggers/selector_with_scheduling/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - id "org.jetbrains.kotlin.multiplatform" - id "org.jetbrains.kotlin.plugin.serialization" -} - -apply from: "$mppProjectWithSerializationPresetPath" - -kotlin { - sourceSets { - commonMain { - dependencies { - api project(":plaguposter.common") - } - } - } -} diff --git a/triggers/selector_with_scheduling/src/commonMain/kotlin/PackageInfo.kt b/triggers/selector_with_scheduling/src/commonMain/kotlin/PackageInfo.kt deleted file mode 100644 index 6b58a49..0000000 --- a/triggers/selector_with_scheduling/src/commonMain/kotlin/PackageInfo.kt +++ /dev/null @@ -1 +0,0 @@ -package dev.inmo.plaguposter.triggers.selector_with_scheduling diff --git a/triggers/selector_with_scheduling/src/jvmMain/kotlin/Plugin.kt b/triggers/selector_with_scheduling/src/jvmMain/kotlin/Plugin.kt deleted file mode 100644 index d360aa8..0000000 --- a/triggers/selector_with_scheduling/src/jvmMain/kotlin/Plugin.kt +++ /dev/null @@ -1,11 +0,0 @@ -package dev.inmo.plaguposter.triggers.selector_with_scheduling - -import dev.inmo.plagubot.Plugin -import kotlinx.serialization.json.* -import org.jetbrains.exposed.sql.Database -import org.koin.core.module.Module - -object Plugin : Plugin { - override fun Module.setupDI(database: Database, params: JsonObject) { - } -} diff --git a/triggers/selector_with_scheduling/src/main/AndroidManifest.xml b/triggers/selector_with_scheduling/src/main/AndroidManifest.xml deleted file mode 100644 index acdf85d..0000000 --- a/triggers/selector_with_scheduling/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt b/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt index 9fb94fe..42aae1c 100644 --- a/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt +++ b/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt @@ -1,14 +1,38 @@ package dev.inmo.plaguposter.triggers.selector_with_timer +import com.soywiz.klock.DateFormat import dev.inmo.krontab.KrontabTemplate import dev.inmo.krontab.toSchedule import dev.inmo.krontab.utils.asFlowWithDelays +import dev.inmo.krontab.utils.asFlowWithoutDelays +import dev.inmo.micro_utils.coroutines.runCatchingSafely import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions +import dev.inmo.micro_utils.pagination.FirstPagePagination +import dev.inmo.micro_utils.pagination.Pagination +import dev.inmo.micro_utils.pagination.firstIndex +import dev.inmo.micro_utils.pagination.lastIndexExclusive import dev.inmo.plagubot.Plugin +import dev.inmo.plaguposter.common.ChatConfig +import dev.inmo.plaguposter.posts.models.PostId +import dev.inmo.plaguposter.posts.repo.ReadPostsRepo import dev.inmo.plaguposter.posts.sending.PostPublisher import dev.inmo.plaguposter.ratings.selector.Selector +import dev.inmo.tgbotapi.extensions.api.answers.answer +import dev.inmo.tgbotapi.extensions.api.edit.edit +import dev.inmo.tgbotapi.extensions.api.send.send import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext +import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onCommand +import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onMessageDataCallbackQuery +import dev.inmo.tgbotapi.extensions.utils.extensions.sameChat +import dev.inmo.tgbotapi.extensions.utils.formatting.makeLinkToMessage +import dev.inmo.tgbotapi.extensions.utils.types.buttons.dataButton +import dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard +import dev.inmo.tgbotapi.extensions.utils.types.buttons.urlButton +import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup +import dev.inmo.tgbotapi.utils.row import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.flow.collectIndexed +import kotlinx.coroutines.flow.take import kotlinx.serialization.* import kotlinx.serialization.json.* import org.jetbrains.exposed.sql.Database @@ -16,15 +40,21 @@ import org.koin.core.Koin import org.koin.core.module.Module object Plugin : Plugin { - @Serializable + private const val pageCallbackDataQueryPrefix = "publishing_autoschedule page" + private const val pageCallbackDataQuerySize = 5 + @Serializable internal data class Config( @SerialName("krontab") - val krontabTemplate: KrontabTemplate + val krontabTemplate: KrontabTemplate, + val dateTimeFormat: String = "HH:mm:ss, dd.MM.yyyy" ) { @Transient val krontab by lazy { krontabTemplate.toSchedule() } + + @Transient + val format: DateFormat = DateFormat(dateTimeFormat) } override fun Module.setupDI(database: Database, params: JsonObject) { single { get().decodeFromJsonElement(Config.serializer(), params["timer_trigger"] ?: return@single null) } @@ -35,12 +65,89 @@ object Plugin : Plugin { val publisher = koin.get() val selector = koin.get() val filters = koin.getAll().distinct() - koin.get().krontab.asFlowWithDelays().subscribeSafelyWithoutExceptions(this) { dateTime -> + val chatConfig = koin.get() + val postsRepo = koin.get() + + val krontab = koin.get().krontab + val dateTimeFormat = koin.get().format + krontab.asFlowWithDelays().subscribeSafelyWithoutExceptions(this) { dateTime -> selector.take(now = dateTime).forEach { postId -> if (filters.all { it.check(postId, dateTime) }) { publisher.publish(postId) } } } + + suspend fun buildPage(pagination: Pagination = FirstPagePagination(size = pageCallbackDataQuerySize)): InlineKeyboardMarkup { + return inlineKeyboard { + row { + if (pagination.page > 1) { + dataButton("⬅️", "${pageCallbackDataQueryPrefix}0") + } + if (pagination.page > 0) { + dataButton("◀️", "${pageCallbackDataQueryPrefix}${pagination.page - 1}") + } + + dataButton("\uD83D\uDD04 ${pagination.page}", "${pageCallbackDataQueryPrefix}${pagination.page}") + dataButton("▶️", "${pageCallbackDataQueryPrefix}${pagination.page + 1}") + } + + val selected = mutableListOf() + krontab.asFlowWithoutDelays().take(pagination.lastIndexExclusive).collectIndexed { i, dateTime -> + val postId = selector.take(now = dateTime, exclude = selected).firstOrNull() ?.also { postId -> + if (filters.all { it.check(postId, dateTime) }) { + selected.add(postId) + } else { + return@collectIndexed + } + } + + val post = postsRepo.getFirstMessageInfo(postId ?: return@collectIndexed) + if (i < pagination.firstIndex || post == null) { + return@collectIndexed + } + + row { + urlButton( + dateTime.format(dateTimeFormat), + makeLinkToMessage(post.chatId, post.messageId) + ) + } + } + } + } + + onCommand("publishing_autoschedule", initialFilter = { it.sameChat(chatConfig.sourceChatId) }) { + val keyboard = buildPage() + + runCatchingSafely { + edit(it, replyMarkup = keyboard) { + +"Your schedule:" + } + }.onFailure { _ -> + send(it.chat, replyMarkup = keyboard) { + +"Your schedule:" + } + } + } + + onMessageDataCallbackQuery( + Regex("^$pageCallbackDataQueryPrefix"), + initialFilter = { it.message.sameChat(chatConfig.sourceChatId) } + ) { + val page = it.data.removePrefix(pageCallbackDataQueryPrefix).toIntOrNull() ?: let { _ -> + answer(it) + return@onMessageDataCallbackQuery + } + + runCatchingSafely { + edit( + it.message, + replyMarkup = buildPage(Pagination(page, size = pageCallbackDataQuerySize)) + ) + }.onFailure { _ -> + answer(it) + } + } } } From e59c7b0f7e5fa220cd2b176b770f61c25f283bc2 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 18 Mar 2023 13:48:26 +0600 Subject: [PATCH 4/7] fixes --- triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt b/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt index 42aae1c..2984257 100644 --- a/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt +++ b/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt @@ -109,7 +109,7 @@ object Plugin : Plugin { row { urlButton( - dateTime.format(dateTimeFormat), + dateTime.local.format(dateTimeFormat), makeLinkToMessage(post.chatId, post.messageId) ) } @@ -132,7 +132,7 @@ object Plugin : Plugin { } onMessageDataCallbackQuery( - Regex("^$pageCallbackDataQueryPrefix"), + Regex("^$pageCallbackDataQueryPrefix\\d+"), initialFilter = { it.message.sameChat(chatConfig.sourceChatId) } ) { val page = it.data.removePrefix(pageCallbackDataQueryPrefix).toIntOrNull() ?: let { _ -> From ebfa79cf64631bc3700b0a3a6cf2b512a8b22a82 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 18 Mar 2023 13:59:37 +0600 Subject: [PATCH 5/7] add OfferTemplate and change autoschedule command --- .../src/jvmMain/kotlin/Plugin.kt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt b/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt index 2984257..50fc945 100644 --- a/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt +++ b/triggers/selector_with_timer/src/jvmMain/kotlin/Plugin.kt @@ -7,11 +7,14 @@ import dev.inmo.krontab.utils.asFlowWithDelays import dev.inmo.krontab.utils.asFlowWithoutDelays import dev.inmo.micro_utils.coroutines.runCatchingSafely import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions +import dev.inmo.micro_utils.koin.singleWithRandomQualifier import dev.inmo.micro_utils.pagination.FirstPagePagination import dev.inmo.micro_utils.pagination.Pagination import dev.inmo.micro_utils.pagination.firstIndex 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.plaguposter.common.ChatConfig import dev.inmo.plaguposter.posts.models.PostId import dev.inmo.plaguposter.posts.repo.ReadPostsRepo @@ -28,6 +31,7 @@ import dev.inmo.tgbotapi.extensions.utils.formatting.makeLinkToMessage import dev.inmo.tgbotapi.extensions.utils.types.buttons.dataButton import dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard import dev.inmo.tgbotapi.extensions.utils.types.buttons.urlButton +import dev.inmo.tgbotapi.types.BotCommand import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.utils.row import kotlinx.coroutines.FlowPreview @@ -58,6 +62,17 @@ 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) @@ -117,7 +132,7 @@ object Plugin : Plugin { } } - onCommand("publishing_autoschedule", initialFilter = { it.sameChat(chatConfig.sourceChatId) }) { + onCommand("autoschedule_panel", initialFilter = { it.sameChat(chatConfig.sourceChatId) }) { val keyboard = buildPage() runCatchingSafely { From 1b3a632d7b5b86038afbdee6becefab91da27079 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 18 Mar 2023 14:05:09 +0600 Subject: [PATCH 6/7] replace OfferTemplate --- .../src/jvmMain/kotlin/Plugin.kt | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) 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 -> From c449457d86904f926c90030bee1e6639d1922997 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 18 Mar 2023 14:11:40 +0600 Subject: [PATCH 7/7] update krontab --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fb67715..da466c8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ plagubot = "5.0.1" tgbotapi = "7.0.1" microutils = "0.17.5" kslog = "1.0.0" -krontab = "0.10.0-branch_0.10.0-build171" +krontab = "0.10.0" tgbotapi-libraries = "0.10.1" plagubot-plugins = "0.10.1"