diff --git a/kord-extensions/src/main/kotlin/dev/kordex/core/builders/ExtensibleBotBuilder.kt b/kord-extensions/src/main/kotlin/dev/kordex/core/builders/ExtensibleBotBuilder.kt index 34714cca83..095b8f9f1c 100644 --- a/kord-extensions/src/main/kotlin/dev/kordex/core/builders/ExtensibleBotBuilder.kt +++ b/kord-extensions/src/main/kotlin/dev/kordex/core/builders/ExtensibleBotBuilder.kt @@ -623,7 +623,7 @@ public open class ExtensibleBotBuilder { * configuration to a subcommand named "general". */ public fun section(body: Section.() -> Unit) { - val section = Section() + val section = Section(this) body(section) @@ -711,12 +711,12 @@ public open class ExtensibleBotBuilder { public var emoji: ReactionEmoji? = null } - public class Section { + public class Section(parent: AboutBuilder) { public lateinit var name: String public lateinit var description: String public lateinit var messageBuilder: suspend MessageCreateBuilder.() -> Unit - public var bundle: String? = null + public var bundle: String? = parent.translationBundle public fun message(body: suspend MessageCreateBuilder.() -> Unit) { messageBuilder = body diff --git a/kord-extensions/src/main/kotlin/dev/kordex/core/datacollection/DataCollector.kt b/kord-extensions/src/main/kotlin/dev/kordex/core/datacollection/DataCollector.kt index 0654b956b8..ba4bead36f 100644 --- a/kord-extensions/src/main/kotlin/dev/kordex/core/datacollection/DataCollector.kt +++ b/kord-extensions/src/main/kotlin/dev/kordex/core/datacollection/DataCollector.kt @@ -6,6 +6,7 @@ package dev.kordex.core.datacollection +import dev.kord.core.entity.Application import dev.kord.gateway.Intents import dev.kordex.core.* import dev.kordex.core.annotations.InternalAPI @@ -44,9 +45,15 @@ public class DataCollector(public val level: DataCollection) : KordExKoinCompone private val state: Properties = loadState() private val systemInfo by lazy { SystemInfo() } + private lateinit var applicationInfo: Application + @OptIn(InternalAPI::class) @Suppress("TooGenericExceptionCaught") internal suspend fun collect() { + if (!::applicationInfo.isInitialized) { + applicationInfo = bot.kordRef.getApplicationInfo() + } + try { lateinit var entity: Entity val lastUUID = getUUID() @@ -78,7 +85,7 @@ public class DataCollector(public val level: DataCollection) : KordExKoinCompone }, botId = bot.kordRef.selfId.toString(), - botName = bot.kordRef.getApplicationInfo().name, + botName = applicationInfo.name, extensionCount = bot.extensions.size, guildCount = bot.kordRef.guilds.count(), @@ -95,8 +102,6 @@ public class DataCollector(public val level: DataCollection) : KordExKoinCompone val hardware = systemInfo.hardware val processor = hardware.processor - val applicationInfo = bot.kordRef.getApplicationInfo() - entity = ExtraDataEntity( id = lastUUID,