diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 28f8672..38ca6ed 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ kotlin-serialization = "1.4.0" plagubot = "2.2.0" tgbotapi = "3.2.0" -microutils = "0.12.4" +microutils = "0.12.6" kslog = "0.5.1" dexcount = "3.1.0" diff --git a/posts/src/jvmMain/kotlin/Plugin.kt b/posts/src/jvmMain/kotlin/Plugin.kt index 4bc3908..128fc64 100644 --- a/posts/src/jvmMain/kotlin/Plugin.kt +++ b/posts/src/jvmMain/kotlin/Plugin.kt @@ -4,6 +4,7 @@ import dev.inmo.kslog.common.logger import dev.inmo.kslog.common.w import dev.inmo.plagubot.Plugin import dev.inmo.plaguposter.posts.exposed.ExposedPostsRepo +import dev.inmo.plaguposter.posts.models.ChatConfig import dev.inmo.plaguposter.posts.repo.PostsRepo import dev.inmo.plaguposter.posts.sending.PostPublisher import dev.inmo.tgbotapi.types.ChatId @@ -14,14 +15,6 @@ import org.jetbrains.exposed.sql.Database import org.koin.core.module.Module object Plugin : Plugin { - @Serializable - private data class Config( - @SerialName("targetChat") - val targetChatId: ChatId, - @SerialName("cacheChat") - val cacheChatId: ChatId - ) - override fun Module.setupDI(database: Database, params: JsonObject) { val configJson = params["posts"] ?: this@Plugin.let { it.logger.w { @@ -29,10 +22,10 @@ object Plugin : Plugin { } return } - single { get().decodeFromJsonElement(Config.serializer(), configJson) } + single { get().decodeFromJsonElement(ChatConfig.serializer(), configJson) } single { ExposedPostsRepo(database) } single { - val config = get() + val config = get() PostPublisher(get(), get(), config.cacheChatId, config.targetChatId) } }