From 9966c79a26e7b3c9923639556bc0a15e4f5fa841 Mon Sep 17 00:00:00 2001 From: ThePendulum Date: Tue, 18 Jul 2023 23:35:53 +0200 Subject: [PATCH] Added milliseconds to Duck result. --- src/games/duck.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/games/duck.js b/src/games/duck.js index f881a7a..8e1698a 100755 --- a/src/games/duck.js +++ b/src/games/duck.js @@ -59,12 +59,12 @@ function onCommand(args, context) { const hit = Math.random() > config.duck.missRatio; const time = new Date().getTime() - duck.getTime(); - const distance = time < 600 * 1000 // show exact time up to ten minutes + const distance = time < 60 * 1000 // show digits up to one minute ? `${(time / 1000).toFixed(3)} seconds` - : Object.entries(intervalToDuration({ start: duck, end: new Date() })) + : `${Object.entries(intervalToDuration({ start: duck, end: new Date() })) .filter(([, value]) => value > 0) .map(([key, value]) => `${value} ${key}`) - .join(', '); + .join(', ')} and ${time % 1000} milliseconds`; if (['bang', 'shoot'].includes(context.command)) { if (hit) { @@ -81,6 +81,7 @@ function onCommand(args, context) { `That's a miss! Better luck next time, ${context.user.prefixedUsername}.`, `The duck outsmarted you, ${context.user.prefixedUsername}`, `Channeling Gareth Southgate, ${context.user.prefixedUsername}? You missed!`, + `Oh, and that's a bad miss, ${context.user.prefixedUsername}.`, ]); shots.set(context.user.id, new Date());