From c4d7902d3c3e8b088a36183824e6cd1208149d73 Mon Sep 17 00:00:00 2001 From: WinG4merBR <68250074+WinG4merBR@users.noreply.github.com> Date: Wed, 8 Jan 2025 00:02:05 -0300 Subject: [PATCH] Add Dispatchers.IO to get hostname --- .../cakeyfox/foxy/command/vanilla/utils/PingExecutor.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/foxy/src/main/kotlin/net/cakeyfox/foxy/command/vanilla/utils/PingExecutor.kt b/foxy/src/main/kotlin/net/cakeyfox/foxy/command/vanilla/utils/PingExecutor.kt index 58aef768..8ffa1f4a 100644 --- a/foxy/src/main/kotlin/net/cakeyfox/foxy/command/vanilla/utils/PingExecutor.kt +++ b/foxy/src/main/kotlin/net/cakeyfox/foxy/command/vanilla/utils/PingExecutor.kt @@ -1,5 +1,7 @@ package net.cakeyfox.foxy.command.vanilla.utils +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext import net.cakeyfox.common.FoxyEmotes import net.cakeyfox.foxy.command.FoxyInteractionContext import net.cakeyfox.foxy.command.structure.FoxyCommandExecutor @@ -11,11 +13,14 @@ class PingExecutor : FoxyCommandExecutor() { val gatewayPing = context.jda.gatewayPing val currentShardId = context.jda.shardInfo.shardId + 1 val totalShards = context.jda.shardInfo.shardTotal + val hostname = withContext(Dispatchers.IO) { + InetAddress.getLocalHost().hostName + } val response = pretty(FoxyEmotes.FoxyHowdy, "Ping\n") + pretty(FoxyEmotes.FoxyWow, "Gateway Ping: ${gatewayPing}ms\n") + pretty(FoxyEmotes.FoxyThink, "Shard ID: ${currentShardId}/${totalShards}\n") + - pretty(FoxyEmotes.FoxyCupcake, "Cluster: `${InetAddress.getLocalHost().hostName}`") + pretty(FoxyEmotes.FoxyCupcake, "Cluster: `$hostname`") context.reply { content = response