From acde0d3ee5fe38cd30c9287804ce0fde24f51f9d Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani Date: Tue, 20 May 2025 05:30:54 +0700 Subject: [PATCH] chore: Prepare BotModule.setup() --- .../kotlin/io/github/null2264/tsukumogami/core/AbstractBot.kt | 3 ++- .../io/github/null2264/tsukumogami/core/module/BotModule.kt | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/io/github/null2264/tsukumogami/core/AbstractBot.kt b/core/src/main/kotlin/io/github/null2264/tsukumogami/core/AbstractBot.kt index cb5f4ca..4f0f895 100644 --- a/core/src/main/kotlin/io/github/null2264/tsukumogami/core/AbstractBot.kt +++ b/core/src/main/kotlin/io/github/null2264/tsukumogami/core/AbstractBot.kt @@ -29,7 +29,8 @@ abstract class AbstractBot(configurator: BotConfigurator.() -> Unit) { extensions = mutableMapOf() currentConfig.extensions.forEach { val module = it.call() - module.setup(this, currentConfig) + module.setup() + module.install(this, currentConfig) extensions[module.name] = module } commands = currentConfig.commands diff --git a/core/src/main/kotlin/io/github/null2264/tsukumogami/core/module/BotModule.kt b/core/src/main/kotlin/io/github/null2264/tsukumogami/core/module/BotModule.kt index 529c375..b533d50 100644 --- a/core/src/main/kotlin/io/github/null2264/tsukumogami/core/module/BotModule.kt +++ b/core/src/main/kotlin/io/github/null2264/tsukumogami/core/module/BotModule.kt @@ -11,7 +11,9 @@ abstract class BotModule(val name: String, val description: String? = null) { var bot: AbstractBot? = null internal set - internal fun setup(bot: AbstractBot, configurator: BotConfigurator) { + open fun setup() {} + + internal fun install(bot: AbstractBot, configurator: BotConfigurator) { this.bot = bot val methods = this::class.java.declaredMethods