PlaguBot/plugin/src/main/kotlin/dev/inmo/plagubot/Plugin.kt
2022-06-08 17:13:46 +06:00

30 lines
986 B
Kotlin

package dev.inmo.plagubot
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonObject
import org.jetbrains.exposed.sql.Database
import org.koin.core.Koin
import org.koin.core.module.Module
/**
* **ANY REALIZATION OF [Plugin] MUST HAVE CONSTRUCTOR WITH ABSENCE OF INCOMING PARAMETERS**
*
* Use this interface for your bot. It is possible to use [kotlinx.serialization.SerialName] annotations on your plugins
* to set up short name for your plugin. Besides, simple name of your class will be used as key for deserialization
* too.
*/
@Serializable(PluginSerializer::class)
interface Plugin {
/**
* This method will be called when this plugin should configure di module based on the incoming params
*/
fun Module.setupDI(
database: Database,
params: JsonObject
) {}
suspend fun BehaviourContext.setupBotPlugin(
koin: Koin
) {}
}