chore: Prepare BotModule.setup()

This commit is contained in:
Ahmad Ansori Palembani 2025-05-20 05:30:54 +07:00
parent 0fa9a44640
commit acde0d3ee5
2 changed files with 5 additions and 2 deletions

View file

@ -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

View file

@ -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