mirror of
https://github.com/InsanusMokrassar/PlaguBot.git
synced 2025-12-05 22:06:02 +00:00
temporal progress
This commit is contained in:
@@ -1,16 +1,33 @@
|
||||
package dev.inmo.plagubot
|
||||
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import org.jetbrains.exposed.sql.Database
|
||||
import org.koin.core.Koin
|
||||
import org.koin.core.KoinApplication
|
||||
import org.koin.core.component.KoinComponent
|
||||
import org.koin.core.component.get
|
||||
import org.koin.dsl.module
|
||||
|
||||
@Serializable
|
||||
@SerialName("Hello")
|
||||
data class HelloPlugin(
|
||||
val parameter: String
|
||||
) : Plugin {
|
||||
override suspend fun BehaviourContext.invoke(database: Database) {
|
||||
println(parameter)
|
||||
class HelloPlugin : Plugin {
|
||||
@Serializable
|
||||
data class HelloPluginConfig(
|
||||
val print: String
|
||||
)
|
||||
override suspend fun BehaviourContext.invoke(
|
||||
database: Database,
|
||||
params: JsonObject
|
||||
) {
|
||||
loadModule {
|
||||
single {
|
||||
get<Json>().decodeFromJsonElement(HelloPluginConfig.serializer(), params["helloPlugin"] ?: return@single null)
|
||||
}
|
||||
}
|
||||
|
||||
println(get<HelloPluginConfig>().print)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user