mirror of
https://github.com/InsanusMokrassar/PlaguPoster.git
synced 2025-09-15 21:19:30 +00:00
added ratings
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
package dev.inmo.plaguposter.posts.models
|
||||
|
||||
import dev.inmo.tgbotapi.types.ChatId
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ChatConfig(
|
||||
@SerialName("targetChat")
|
||||
val targetChatId: ChatId,
|
||||
@SerialName("sourceChat")
|
||||
val sourceChatId: ChatId,
|
||||
@SerialName("cacheChat")
|
||||
val cacheChatId: ChatId
|
||||
)
|
||||
|
@@ -5,7 +5,7 @@ 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.repo.*
|
||||
import dev.inmo.plaguposter.posts.sending.PostPublisher
|
||||
import dev.inmo.tgbotapi.types.ChatId
|
||||
import kotlinx.serialization.SerialName
|
||||
@@ -13,6 +13,7 @@ import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.*
|
||||
import org.jetbrains.exposed.sql.Database
|
||||
import org.koin.core.module.Module
|
||||
import org.koin.dsl.binds
|
||||
|
||||
object Plugin : Plugin {
|
||||
override fun Module.setupDI(database: Database, params: JsonObject) {
|
||||
@@ -23,7 +24,11 @@ object Plugin : Plugin {
|
||||
return
|
||||
}
|
||||
single { get<Json>().decodeFromJsonElement(ChatConfig.serializer(), configJson) }
|
||||
single<PostsRepo> { ExposedPostsRepo(database) }
|
||||
single { ExposedPostsRepo(database) } binds arrayOf(
|
||||
PostsRepo::class,
|
||||
ReadPostsRepo::class,
|
||||
WritePostsRepo::class,
|
||||
)
|
||||
single {
|
||||
val config = get<ChatConfig>()
|
||||
PostPublisher(get(), get(), config.cacheChatId, config.targetChatId)
|
||||
|
Reference in New Issue
Block a user