mirror of
https://github.com/InsanusMokrassar/PlaguPoster.git
synced 2024-12-22 05:57:13 +00:00
start add panel plugin
This commit is contained in:
parent
77fae11dfd
commit
dfa748b1e7
22
posts/panel/build.gradle
Normal file
22
posts/panel/build.gradle
Normal 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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1
posts/panel/src/commonMain/kotlin/PackageInfo.kt
Normal file
1
posts/panel/src/commonMain/kotlin/PackageInfo.kt
Normal file
@ -0,0 +1 @@
|
||||
package dev.inmo.plaguposter.posts.panel
|
9
posts/panel/src/commonMain/kotlin/PanelButtonSettings.kt
Normal file
9
posts/panel/src/commonMain/kotlin/PanelButtonSettings.kt
Normal 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
|
||||
)
|
26
posts/panel/src/jvmMain/kotlin/Plugin.kt
Normal file
26
posts/panel/src/jvmMain/kotlin/Plugin.kt
Normal 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")
|
||||
}
|
||||
}
|
1
posts/panel/src/main/AndroidManifest.xml
Normal file
1
posts/panel/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1 @@
|
||||
<manifest package="dev.inmo.plaguposter.posts.panel"/>
|
@ -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
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ rootProject.name = 'plaguposter'
|
||||
String[] includes = [
|
||||
":common",
|
||||
":posts",
|
||||
":posts:panel",
|
||||
":posts_registrar",
|
||||
":ratings",
|
||||
":ratings:source",
|
||||
|
Loading…
Reference in New Issue
Block a user