start add panel plugin

This commit is contained in:
InsanusMokrassar 2022-09-14 23:32:32 +06:00
parent 77fae11dfd
commit dfa748b1e7
7 changed files with 60 additions and 5 deletions

22
posts/panel/build.gradle Normal file
View File

@ -0,0 +1,22 @@
plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization"
id "com.android.library"
}
apply from: "$mppProjectWithSerializationPresetPath"
kotlin {
sourceSets {
commonMain {
dependencies {
api project(":plaguposter.common")
api project(":plaguposter.posts")
}
}
jvmMain {
dependencies {
}
}
}
}

View File

@ -0,0 +1 @@
package dev.inmo.plaguposter.posts.panel

View File

@ -0,0 +1,9 @@
package dev.inmo.plaguposter.posts.panel
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.InlineKeyboardButton
import kotlinx.serialization.Serializable
@Serializable
data class PanelButtonSettings(
val button: InlineKeyboardButton
)

View File

@ -0,0 +1,26 @@
package dev.inmo.plaguposter.posts.panel
import dev.inmo.plagubot.Plugin
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.InlineKeyboardButton
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.*
import org.jetbrains.exposed.sql.Database
import org.koin.core.Koin
import org.koin.core.module.Module
object Plugin : Plugin {
@Serializable
internal data class Config (
val text: String = "You have registered new post with %s posts",
val buttonsPrefix: String = ". Here the buttons available for management of post:",
val preset: List<List<InlineKeyboardButton>>? = null
)
override fun Module.setupDI(database: Database, params: JsonObject) {
single { }
}
override suspend fun BehaviourContext.setupBotPlugin(koin: Koin) {
TODO("Not yet implemented")
}
}

View File

@ -0,0 +1 @@
<manifest package="dev.inmo.plaguposter.posts.panel"/>

View File

@ -103,11 +103,6 @@ object Plugin : Plugin {
NewPost(
state.messages
)
).firstOrNull() ?.let {
send(state.context, "Ok, you have registered ${it.content.size} messages as new post")
} ?: send(
state.context,
"Sorry, for some reason I was unable to register your post"
)
null
}

View File

@ -3,6 +3,7 @@ rootProject.name = 'plaguposter'
String[] includes = [
":common",
":posts",
":posts:panel",
":posts_registrar",
":ratings",
":ratings:source",