From f16ac8010b8e7fe8c5151bb29a6b760f4b2fc074 Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Fri, 4 Oct 2024 04:33:52 +0200 Subject: [PATCH] Remove decimals if not needed --- commands/misc/convert.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/misc/convert.js b/commands/misc/convert.js index bb5b661..0e5c56c 100644 --- a/commands/misc/convert.js +++ b/commands/misc/convert.js @@ -30,7 +30,11 @@ module.exports = { break; case "F": if (args[2].toUpperCase() === "C") { - const celsius = ((initial_temp - 32) * 5 / 9).toFixed(2); + let celsius = ((initial_temp - 32) * 5 / 9).toFixed(2); + if(celsius[celsius.length - 1] === '0' && celsius[celsius.length - 2] === "0"){ + celsius = celsius.replace(".00","") + } + sendText = `${initial_temp}°F is ${celsius}°C`; } else { sendText = "Can only convert to fahrenheit from celsius";