diff --git a/foxy/src/main/kotlin/net/cakeyfox/foxy/listeners/InteractionEventListener.kt b/foxy/src/main/kotlin/net/cakeyfox/foxy/listeners/InteractionEventListener.kt index 7a6bd35b..216b0bbd 100644 --- a/foxy/src/main/kotlin/net/cakeyfox/foxy/listeners/InteractionEventListener.kt +++ b/foxy/src/main/kotlin/net/cakeyfox/foxy/listeners/InteractionEventListener.kt @@ -14,6 +14,7 @@ import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent import net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent import net.dv8tion.jda.api.hooks.ListenerAdapter import kotlin.reflect.jvm.jvmName +import kotlin.system.measureTimeMillis class InteractionEventListener( private val foxy: FoxyInstance @@ -56,11 +57,14 @@ class InteractionEventListener( } try { - if (subCommand != null) { - subCommand.executor?.execute(context) - } else if (subCommandGroupName == null && subCommandName == null) { - command.executor?.execute(context) + val executionTime = measureTimeMillis { + if (subCommand != null) { + subCommand.executor?.execute(context) + } else if (subCommandGroupName == null && subCommandName == null) { + command.executor?.execute(context) + } } + logger.info { "Command /${event.fullCommandName} executed in ${executionTime}ms" } } catch (e: Exception) { logger.error(e) { "An error occurred while executing command: ${event.fullCommandName}" } context.reply(true) { @@ -106,7 +110,7 @@ class InteractionEventListener( } } } - + override fun onStringSelectInteraction(event: StringSelectInteractionEvent) { coroutineScope.launch { val componentId = try { diff --git a/foxy/src/main/kotlin/net/cakeyfox/foxy/utils/HoconUtils.kt b/foxy/src/main/kotlin/net/cakeyfox/foxy/utils/HoconUtils.kt index 2f8ca852..adfc21c8 100644 --- a/foxy/src/main/kotlin/net/cakeyfox/foxy/utils/HoconUtils.kt +++ b/foxy/src/main/kotlin/net/cakeyfox/foxy/utils/HoconUtils.kt @@ -7,5 +7,6 @@ import kotlinx.serialization.hocon.decodeFromConfig object HoconUtils { @OptIn(ExperimentalSerializationApi::class) - inline fun Hocon.decodeFromString(string: String): T = decodeFromConfig(ConfigFactory.parseString(string).resolve()) + inline fun Hocon.decodeFromString(string: String): T = + decodeFromConfig(ConfigFactory.parseString(string).resolve()) } \ No newline at end of file diff --git a/foxy/src/main/kotlin/net/cakeyfox/foxy/utils/profile/ProfileUtils.kt b/foxy/src/main/kotlin/net/cakeyfox/foxy/utils/profile/ProfileUtils.kt index 0d52f612..75d640a0 100644 --- a/foxy/src/main/kotlin/net/cakeyfox/foxy/utils/profile/ProfileUtils.kt +++ b/foxy/src/main/kotlin/net/cakeyfox/foxy/utils/profile/ProfileUtils.kt @@ -6,6 +6,7 @@ object ProfileUtils { fun formatAboutMe(aboutMe: String, layoutInfo: Layout): String { val aboutMeLimit = layoutInfo.profileSettings.aboutme.limit val breakLength = layoutInfo.profileSettings.aboutme.breakLength + return if (aboutMe.length > aboutMeLimit) { aboutMe.chunked(breakLength).joinToString("\n") } else {