diff --git a/README.md b/README.md index e850d5c..b7a2929 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ A wild BUTTON appears is licensed under GNU AGPL v3 or later, see the `LICENSE` ``` a-wild-button-appears - a slack bot for posting random buttons -Copyright (c) 2018, 2019, 2020, 2021, 2022, Linus Karlsson +Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023, 2024, Linus Karlsson This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as diff --git a/__tests__/click.test.js b/__tests__/click.test.js index 90cdb69..3047768 100644 --- a/__tests__/click.test.js +++ b/__tests__/click.test.js @@ -241,7 +241,7 @@ describe('click handler to', () => { expect(slack.sendReplacingResponse.mock.calls[1][0]).toBe(clickMockResponseUrl) expect(JSON.stringify(slack.sendReplacingResponse.mock.calls[1][1])).toMatch(/<@UA8RXUSPL> won \(4.113 s\)/) expect(JSON.stringify(slack.sendReplacingResponse.mock.calls[1][1])).toMatch(/<@otheruser> \(4.114 s\)/) - expect(JSON.stringify(slack.sendReplacingResponse.mock.calls[1][1])).toMatch(/<@otheruser> \(4.12 s\) was close/) + expect(JSON.stringify(slack.sendReplacingResponse.mock.calls[1][1])).toMatch(/<@otheruser> \(4.12 s\) were close/) expect(JSON.stringify(slack.sendReplacingResponse.mock.calls[1][1])).toMatch(/4\.113 s/) expect(JSON.stringify(slack.sendReplacingResponse.mock.calls[1][1])).toMatch(/4\.114 s/) expect(JSON.stringify(slack.sendReplacingResponse.mock.calls[1][1])).toMatch(/4\.12 s/) diff --git a/click.js b/click.js index e49c499..cd2ac9f 100644 --- a/click.js +++ b/click.js @@ -44,12 +44,13 @@ function wonMessageFormatter (uuid, clickData) { ] if (runnersUp.length > 0) { + const verb = runnersUp.length === 1 ? 'was' : 'were' blocks.push({ type: 'context', elements: [ { type: 'mrkdwn', - text: runnersUpTexts.join(', ') + ' was close!' + text: runnersUpTexts.join(', ') + ` ${verb} close!` } ] }) diff --git a/package-lock.json b/package-lock.json index 270dcf2..ffa6cc3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@sentry/tracing": "^7.7.0", "@slack/events-api": "^3.0.1", "@slack/web-api": "^6.5.1", - "@slack/webhook": "^6.0.0", + "@slack/webhook": "^7.0.2", "countries-and-timezones": "^3.3.0", "dotenv": "^16.0.1", "express": "^4.17.1", @@ -2197,34 +2197,25 @@ } }, "node_modules/@slack/webhook": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@slack/webhook/-/webhook-6.1.0.tgz", - "integrity": "sha512-7AYNISyAjn/lA/VDwZ307K5ft5DojXgBd3DRrGoFN8XxIwIyRALdFhxBiMgAqeJH8eWoktvNwLK24R9hREEqpA==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@slack/webhook/-/webhook-7.0.2.tgz", + "integrity": "sha512-dsrO/ow6a6+xkLm/lZKbUNTsFJlBc679tD+qwlVTztsQkDxPLH6odM7FKALz1IHa+KpLX8HKUIPV13a7y7z29w==", "dependencies": { - "@slack/types": "^1.2.1", - "@types/node": ">=12.0.0", - "axios": "^0.21.4" + "@slack/types": "^2.9.0", + "@types/node": ">=18.0.0", + "axios": "^1.6.3" }, "engines": { - "node": ">= 12.13.0", - "npm": ">= 6.12.0" - } - }, - "node_modules/@slack/webhook/node_modules/@slack/types": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@slack/types/-/types-1.10.0.tgz", - "integrity": "sha512-tA7GG7Tj479vojfV3AoxbckalA48aK6giGjNtgH6ihpLwTyHE3fIgRrvt8TWfLwW8X8dyu7vgmAsGLRG7hWWOg==", - "engines": { - "node": ">= 8.9.0", - "npm": ">= 5.5.1" + "node": ">= 18", + "npm": ">= 8.6.0" } }, - "node_modules/@slack/webhook/node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "node_modules/@slack/webhook/node_modules/@types/node": { + "version": "20.11.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.6.tgz", + "integrity": "sha512-+EOokTnksGVgip2PbYbr3xnR7kZigh4LbybAfBAw5BpnQ+FqBYUsvCEjYd70IXKlbohQ64mzEYmMtlWUY8q//Q==", "dependencies": { - "follow-redirects": "^1.14.0" + "undici-types": "~5.26.4" } }, "node_modules/@smithy/abort-controller": { @@ -3365,11 +3356,11 @@ } }, "node_modules/axios": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz", - "integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==", + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.6.tgz", + "integrity": "sha512-XZLZDFfXKM9U/Y/B4nNynfCRUqNyVZ4sBC/n9GDRCkq9vd2mIvKjKKsbIh1WPmHmNbg6ND7cTBY3Y2+u1G3/2Q==", "dependencies": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.4", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -5235,9 +5226,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", "funding": [ { "type": "individual", @@ -9408,6 +9399,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", diff --git a/package.json b/package.json index b7f60a0..f853dc6 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "@sentry/tracing": "^7.7.0", "@slack/events-api": "^3.0.1", "@slack/web-api": "^6.5.1", - "@slack/webhook": "^6.0.0", + "@slack/webhook": "^7.0.2", "countries-and-timezones": "^3.3.0", "dotenv": "^16.0.1", "express": "^4.17.1",