Simp-O-Matic

Dumb Discord bot in TS.
git clone git://git.knutsen.co/Simp-O-Matic
Log | Files | Refs | README | LICENSE

commit a14292ec492635173c6b2bd5f4fc2b6a24b922fb
parent 7d4a03f46454eb7c67d5b55c94bd5d5374476ee6
Author: knutsen <samuel@knutsen.co>
Date:   Mon, 19 Apr 2021 17:02:33 +0100

Round temperature conversions.

Diffstat:
Mlib/commands/metric.ts | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/commands/metric.ts b/lib/commands/metric.ts @@ -17,7 +17,7 @@ const UNITS: Conversions = { "yd": n => [0.9144 * n, "m"], "acre": n => [4046.873 * n, "m^2"], "pint": n => [473.176 * n, "ml"], - "fl": n => [29.573 * n, " ml"], + "fl oz": n => [29.573 * n, " ml"], "quart": n => [0.946 * n, "l"], "gallon": n => [3.785 * n, "l"], "oz" : n => [28.349 * n, "g"], @@ -43,10 +43,10 @@ export default async (homescope: HomeScope) => { if (unit === "f") { const c = ftoc(quantity); - if (c) return `${quantity}${unit} = ${c[0]}${c[1]}`; + return `${quantity}F = ${Math.round(c[0])}${c[1]}`; } if (unit.startsWith("fl")) - unit = "fl"; + unit = "fl oz"; const out = (UNITS[unit] || noop)(quantity); if (out && !isNaN(out[0])) {