Compare commits

...

2 Commits

Author SHA1 Message Date
ThePendulum 6f2a5e03e9 1.26.10 2023-07-18 23:35:55 +02:00
ThePendulum 9966c79a26 Added milliseconds to Duck result. 2023-07-18 23:35:53 +02:00
3 changed files with 7 additions and 6 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "schat2-clive", "name": "schat2-clive",
"version": "1.26.9", "version": "1.26.10",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "schat2-clive", "name": "schat2-clive",
"version": "1.26.9", "version": "1.26.10",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"better-sqlite3": "^8.3.0", "better-sqlite3": "^8.3.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "schat2-clive", "name": "schat2-clive",
"version": "1.26.9", "version": "1.26.10",
"description": "Game host for SChat 2-powered chat sites", "description": "Game host for SChat 2-powered chat sites",
"main": "src/app.js", "main": "src/app.js",
"scripts": { "scripts": {

View File

@ -59,12 +59,12 @@ function onCommand(args, context) {
const hit = Math.random() > config.duck.missRatio; const hit = Math.random() > config.duck.missRatio;
const time = new Date().getTime() - duck.getTime(); 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` ? `${(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) .filter(([, value]) => value > 0)
.map(([key, value]) => `${value} ${key}`) .map(([key, value]) => `${value} ${key}`)
.join(', '); .join(', ')} and ${time % 1000} milliseconds`;
if (['bang', 'shoot'].includes(context.command)) { if (['bang', 'shoot'].includes(context.command)) {
if (hit) { if (hit) {
@ -81,6 +81,7 @@ function onCommand(args, context) {
`That's a miss! Better luck next time, ${context.user.prefixedUsername}.`, `That's a miss! Better luck next time, ${context.user.prefixedUsername}.`,
`The duck outsmarted you, ${context.user.prefixedUsername}`, `The duck outsmarted you, ${context.user.prefixedUsername}`,
`Channeling Gareth Southgate, ${context.user.prefixedUsername}? You missed!`, `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()); shots.set(context.user.id, new Date());