From 43a67cff3c3d2f91b98c9390c6d4d5083184381c Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 3 Jan 2025 12:03:42 +0100 Subject: [PATCH] fix(ping): negative ping (#218) Also move the ":" to localization Reviewed-on: https://git.mylloon.fr/ConfrerieDuKassoulait/Botanique/pulls/218 Co-authored-by: Mylloon Co-committed-by: Mylloon --- src/commands/misc/ping.ts | 9 ++++----- src/locales/en-US.json | 5 +++-- src/locales/fr.json | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/commands/misc/ping.ts b/src/commands/misc/ping.ts index 87c6344..674ee8a 100644 --- a/src/commands/misc/ping.ts +++ b/src/commands/misc/ping.ts @@ -23,10 +23,9 @@ export default { withResponse: true, }); - interaction.editReply( - `${loc?.get("c_ping1")}: \ -${sent.resource!.message!.createdTimestamp - interaction.createdTimestamp}ms -${loc?.get("c_ping2")}: ${client.ws.ping}ms.`, - ); + const total = sent.resource!.message!.createdTimestamp - interaction.createdTimestamp; + const ws = client.ws.ping == -1 ? loc?.get("c_ping3") : client.ws.ping + "ms"; + + interaction.editReply(`${loc?.get("c_ping1")} ${total}ms\n${loc?.get("c_ping2")} ${ws}.`); }, }; diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 4385cb5..0431705 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -6,8 +6,9 @@ "c_ping_name": "Ping", "c_ping_desc": "Pong!", - "c_ping1": "Roundtrip latency", - "c_ping2": "Web socket heartbeat", + "c_ping1": "Roundtrip latency:", + "c_ping2": "Web socket heartbeat:", + "c_ping3": "Unknown", "c_help_name": "Help", "c_help_desc": "Information about commands", diff --git a/src/locales/fr.json b/src/locales/fr.json index e83b8ae..0d94802 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -6,8 +6,9 @@ "c_ping_name": "Ping", "c_ping_desc": "Pong!", - "c_ping1": "Latence totale", - "c_ping2": "Latence du Web socket", + "c_ping1": "Latence totale :", + "c_ping2": "Latence du Web socket :", + "c_ping3": "Inconnu", "c_help_name": "Aide", "c_help_desc": "Informations sur les commandes",