diff --git a/px32-bot-core/src/main/kotlin/net/projecttl/p/x32/command/Info.kt b/px32-bot-core/src/main/kotlin/net/projecttl/p/x32/command/Info.kt index b921c48..eeb7c2a 100644 --- a/px32-bot-core/src/main/kotlin/net/projecttl/p/x32/command/Info.kt +++ b/px32-bot-core/src/main/kotlin/net/projecttl/p/x32/command/Info.kt @@ -19,8 +19,6 @@ object Info : GlobalCommand { val r = Runtime.getRuntime() val size = kernel.plugins.size - val hSize = kernel.handlers.size - val info = """ Px32Bot v${DefaultConfig.version}, JDA `v${JDAInfo.VERSION}`, `Java ${System.getProperty("java.version")}` and `Kotlin ${KotlinVersion.CURRENT}` System on `${System.getProperty("os.name")}` @@ -32,7 +30,6 @@ object Info : GlobalCommand { Using `${(r.totalMemory() - r.freeMemory()) / 1048576}MB` at this Bot Total $size plugin${if (size > 1) "s" else ""} loaded - Total $hSize handler${if (hSize > 1) "s" else ""} used """.trimIndent() ev.reply(info).queue() diff --git a/px32-bot-core/src/main/kotlin/net/projecttl/p/x32/kernel/CoreKernel.kt b/px32-bot-core/src/main/kotlin/net/projecttl/p/x32/kernel/CoreKernel.kt index d6f1d30..011bb8b 100644 --- a/px32-bot-core/src/main/kotlin/net/projecttl/p/x32/kernel/CoreKernel.kt +++ b/px32-bot-core/src/main/kotlin/net/projecttl/p/x32/kernel/CoreKernel.kt @@ -24,18 +24,19 @@ class CoreKernel(token: String) { private set private val builder = JDABuilder.createDefault(token, listOf( - GatewayIntent.GUILD_PRESENCES, GatewayIntent.GUILD_MEMBERS, GatewayIntent.GUILD_MESSAGES, GatewayIntent.MESSAGE_CONTENT, + GatewayIntent.GUILD_PRESENCES, + GatewayIntent.SCHEDULED_EVENTS, GatewayIntent.GUILD_VOICE_STATES, - GatewayIntent.GUILD_EMOJIS_AND_STICKERS, - GatewayIntent.SCHEDULED_EVENTS + GatewayIntent.GUILD_EMOJIS_AND_STICKERS )).setMemberCachePolicy(MemberCachePolicy.ALL) val memLock = Mutex() val commandContainer = CommandHandler() - val plugins = mutableMapOf() + var plugins = mutableMapOf() + private set var isActive = false private set @@ -133,10 +134,10 @@ class CoreKernel(token: String) { } destroy() - logger.info(jda.eventManager.registeredListeners.size.toString()) + plugins = mutableMapOf() + include() load() - logger.info(jda.eventManager.registeredListeners.size.toString()) plugins.forEach { (_, plugin) -> plugin.handlers.forEach { @@ -144,8 +145,6 @@ class CoreKernel(token: String) { } } - logger.info(jda.eventManager.registeredListeners.size.toString()) - handlers.filterIsInstance().forEach { h -> h.register(jda) } @@ -210,6 +209,8 @@ class CoreKernel(token: String) { } include() + load() + plugins.forEach { (_, plugin) -> plugin.handlers.forEach { handler -> logger.info("Load event listener: ${handler::class.simpleName}")