From 85840c295855d4e270c5aaa564955f04563f9a63 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 8 Dec 2024 19:05:14 +0000 Subject: [PATCH 1/8] Update dependency @slack/bolt to v3.22.0 --- package-lock.json | 131 ++++++++++++++++++++++++++-------------------- 1 file changed, 74 insertions(+), 57 deletions(-) diff --git a/package-lock.json b/package-lock.json index 49f8e14..69eca6a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,21 +16,21 @@ } }, "node_modules/@slack/bolt": { - "version": "3.21.4", - "resolved": "https://registry.npmjs.org/@slack/bolt/-/bolt-3.21.4.tgz", - "integrity": "sha512-4PqOuHXcVt8KxjKiLdLIqZp8285zdiYLj7HrrKvVHnUNbkD0l16HZxtMfIEe07REQ+vmM1mrqCiZqe9dPAMucA==", + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@slack/bolt/-/bolt-3.22.0.tgz", + "integrity": "sha512-iKDqGPEJDnrVwxSVlFW6OKTkijd7s4qLBeSufoBsTM0reTyfdp/5izIQVkxNfzjHi3o6qjdYbRXkYad5HBsBog==", "license": "MIT", "dependencies": { "@slack/logger": "^4.0.0", "@slack/oauth": "^2.6.3", "@slack/socket-mode": "^1.3.6", "@slack/types": "^2.13.0", - "@slack/web-api": "^6.12.1", + "@slack/web-api": "^6.13.0", "@types/express": "^4.16.1", "@types/promise.allsettled": "^1.0.3", "@types/tsscmp": "^1.0.0", "axios": "^1.7.4", - "express": "^4.16.4", + "express": "^4.21.0", "path-to-regexp": "^8.1.0", "promise.allsettled": "^1.0.2", "raw-body": "^2.3.3", @@ -42,9 +42,9 @@ } }, "node_modules/@slack/bolt/node_modules/@slack/web-api": { - "version": "6.12.1", - "resolved": "https://registry.npmjs.org/@slack/web-api/-/web-api-6.12.1.tgz", - "integrity": "sha512-dXHyHkvvziqkDdZlPRnUl/H2uvnUmdJ5B7kxiH1HIgHe18vcbUk1zjU/XCZgJFhxGeq5Zwa95Z+SbNW9mbRhtw==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@slack/web-api/-/web-api-6.13.0.tgz", + "integrity": "sha512-dv65crIgdh9ZYHrevLU6XFHTQwTyDmNqEqzuIrV+Vqe/vgiG6w37oex5ePDU1RGm2IJ90H8iOvHFvzdEO/vB+g==", "license": "MIT", "dependencies": { "@slack/logger": "^3.0.0", @@ -84,14 +84,15 @@ "license": "MIT" }, "node_modules/@slack/bolt/node_modules/form-data": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.2.tgz", + "integrity": "sha512-GgwY0PS7DbXqajuGf4OYlsrIu3zgxD6Vvql43IBhm6MahqA5SK/7mwhtNj2AdH2z35YR34ujJ7BN+3fFC3jP5Q==", "license": "MIT", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" + "mime-types": "^2.1.12", + "safe-buffer": "^5.2.1" }, "engines": { "node": ">= 0.12" @@ -572,9 +573,9 @@ } }, "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", "license": "MIT", "dependencies": { "bytes": "3.1.2", @@ -585,7 +586,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.11.0", + "qs": "6.13.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -663,9 +664,9 @@ } }, "node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -827,9 +828,9 @@ "license": "MIT" }, "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", "license": "MIT", "engines": { "node": ">= 0.8" @@ -1007,37 +1008,37 @@ "license": "MIT" }, "node_modules/express": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.2", + "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.6.0", + "cookie": "0.7.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "1.2.0", + "finalhandler": "1.3.1", "fresh": "0.5.2", "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", + "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", + "path-to-regexp": "0.1.12", "proxy-addr": "~2.0.7", - "qs": "6.11.0", + "qs": "6.13.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", + "send": "0.19.0", + "serve-static": "1.16.2", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", @@ -1046,22 +1047,26 @@ }, "engines": { "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/express/node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==", + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", "license": "MIT" }, "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", "license": "MIT", "dependencies": { "debug": "2.6.9", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "on-finished": "2.4.1", "parseurl": "~1.3.3", @@ -1756,10 +1761,13 @@ } }, "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", - "license": "MIT" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/methods": { "version": "1.1.2", @@ -1992,12 +2000,12 @@ "license": "MIT" }, "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "license": "BSD-3-Clause", "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" @@ -2131,9 +2139,9 @@ } }, "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "license": "MIT", "dependencies": { "debug": "2.6.9", @@ -2154,6 +2162,15 @@ "node": ">= 0.8.0" } }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/send/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -2161,15 +2178,15 @@ "license": "MIT" }, "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "license": "MIT", "dependencies": { - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.18.0" + "send": "0.19.0" }, "engines": { "node": ">= 0.8.0" From 702e3e966e118ebcef977025ca27e396240a184d Mon Sep 17 00:00:00 2001 From: DaInfLoop Date: Fri, 27 Jun 2025 11:52:59 +0100 Subject: [PATCH 2/8] Remove whitelist + make changes to work with Identity Vault --- index.ts | 70 ++++++++++++++++++++++---------------------------------- 1 file changed, 27 insertions(+), 43 deletions(-) diff --git a/index.ts b/index.ts index d8196d3..be1fa04 100644 --- a/index.ts +++ b/index.ts @@ -8,20 +8,6 @@ const app = new App({ signingSecret: process.env.SLACK_SIGNING_SECRET, }); -const whitelist: string[] = (() => { - try { - return require('./whitelist.json') - } catch (e) { - return [] - } -})(); - -function checkUserOk(user: UsersInfoResponse['user']) { - if (whitelist.includes(user!.id!)) return true - - return user!.is_admin || user!.is_owner || user!.is_primary_owner -} - const eligibilityCmd = async (ctx: any) => { await ctx.ack(); @@ -33,12 +19,8 @@ const eligibilityCmd = async (ctx: any) => { const iUser = await ctx.client.users.info({ user: ctx.context.userId! }); if ((match = text.match(/\<\@(.+)\|(.+)>/))) { - if (!checkUserOk(iUser.user!)) { - matchedBy = "not allowed" - } else { - userId = match[1]; - matchedBy = "user mention" - } + userId = match[1]; + matchedBy = "user mention" } else if (text) matchedBy = "invalid input" @@ -52,30 +34,29 @@ const eligibilityCmd = async (ctx: any) => { redirect: "follow" }).then(res => res.json()) - if (res === `User ${userId} not found!`) + if (res.status === "not_found") return await ctx.respond({ response_type: 'ephemeral', - text: `${matchedBy !== "user mention" ? "You aren't" : `<@${userId}> isn't`} verified and therefore aren't eligible for rewards from your program.${matchedBy !== "user mention" ? `\nCheck out the to verify.` : ""}${matchedBy == "not allowed" ? " (Only whitelisted users can check other people's verification statuses.)" : ""}`, + text: `${matchedBy !== "user mention" ? "You aren't" : `<@${userId}> isn't`} verified. ${matchedBy !== "user mention" ? `\nCheck out the to verify.` : ""}`, unfurl_links: true }) - else if (res.status === "Insufficient") { + else if (res.status === "needs_submission") { return await ctx.respond({ response_type: 'ephemeral', - text: `${matchedBy !== "user mention" ? "You" : `<@${userId}>`} provided insufficient evidence that ${matchedBy !== "user mention" ? "you" : "they"} are a student.${matchedBy !== "user mention" ? `\nCheck out the to re-verify.` : ""}${matchedBy == "not allowed" ? " (Only whitelisted users can check other people's verification statuses.)" : ""}`, + text: `${matchedBy !== "user mention" ? "You" : `<@${userId}>`} provided insufficient evidence of who ${matchedBy !== "user mention" ? "you" : "they"} are.${matchedBy !== "user mention" ? `\nCheck out the to re-verify.` : ""}`, unfurl_links: true - }) + }) } - else if (res.status === "Unknown") { + else if (res.status === "pending") { return await ctx.respond({ response_type: 'ephemeral', - text: `${matchedBy !== "user mention" ? "Your verification" : `<@${userId}>'s verification`} has not been accepted yet.${matchedBy == "not allowed" ? " (Only whitelisted users can check other people's verification statuses.)" : ""}`, - unfurl_links: true - }) + text: `${matchedBy !== "user mention" ? "Your verification" : `<@${userId}>'s verification`} has not been accepted yet.`, + }) } - else if (res.status === "Ineligible") { + else if (res.status === "rejected") { if (matchedBy === "user mention") { return await ctx.respond({ response_type: 'ephemeral', @@ -84,11 +65,15 @@ const eligibilityCmd = async (ctx: any) => { } else { return await ctx.respond({ response_type: 'ephemeral', - text: `Your verification has been denied. If you believe this to be a mistake, please contact an admin of the program you are applying for.${matchedBy == "not allowed" ? " (Only whitelisted users can check other people's verification statuses.)" : ""},` + text: `Your verification has been denied. If you believe this to be a mistake, please send a message in <#C092833JXKK>.` }) } } + /** + * The sanctioned country status seems to have been deprecated in the Identity Vault. + * However, this piece of code is being kept for documentation purposes. + else if (res.status === "Sanctioned country") { if (matchedBy === "user mention") { return await ctx.respond({ @@ -100,22 +85,21 @@ const eligibilityCmd = async (ctx: any) => { response_type: 'ephemeral', text: `You live in a country that cannot have packages delivered to due to sanctions.${matchedBy == "not allowed" ? " (Only whitelisted users can check other people's verification statuses.)" : ""},` }) - } + } } + */ - else { + else if (res.status === "verified_eligible") { return await ctx.respond({ response_type: 'ephemeral', - text: `${matchedBy !== "user mention" ? "You have verified your" : `<@${userId}> has verified their`} student status, and ${matchedBy !== "user mention" ? "are" : "is"} ${res.status}.${matchedBy == "not allowed" ? " (Only whitelisted users can check other people's verification statuses.)" : ""}`, - blocks: [ - { - type: 'section', - text: { - type: 'mrkdwn', - text: `${matchedBy !== "user mention" ? "You have verified your" : `<@${userId}> has verified their`} student status, and ${matchedBy !== "user mention" ? "are" : "is"} *${res.status}*.${matchedBy == "not allowed" ? " (Only whitelisted users can check other people's verification statuses.)" : ""}` - } - } - ] + text: `${matchedBy !== "user mention" ? "You have verified your" : `<@${userId}> has verified their`} identity, and ${matchedBy !== "user mention" ? "are" : "is"} eligible for YSWS prizes.`, + }) + } + + else if (res.status === "verified_but_over_18") { + return await ctx.respond({ + response_type: 'ephemeral', + text: `${matchedBy !== "user mention" ? "You have verified your" : `<@${userId}> has verified their`} identity, but since ${matchedBy !== "user mention" ? "you're" : "they're"} over 18, ${matchedBy !== "user mention" ? "you're" : "they're"} ineligible for YSWS prizes.`, }) } } From 2a8af5667ad55b66b5f5fcd6d5cc7e427f14e233 Mon Sep 17 00:00:00 2001 From: DaInfLoop Date: Fri, 27 Jun 2025 12:09:35 +0100 Subject: [PATCH 3/8] i forgot to change the url --- index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/index.ts b/index.ts index be1fa04..1dbe6fb 100644 --- a/index.ts +++ b/index.ts @@ -16,8 +16,6 @@ const eligibilityCmd = async (ctx: any) => { let userId = ctx.context.userId; let matchedBy = "no input" - const iUser = await ctx.client.users.info({ user: ctx.context.userId! }); - if ((match = text.match(/\<\@(.+)\|(.+)>/))) { userId = match[1]; matchedBy = "user mention" @@ -25,7 +23,7 @@ const eligibilityCmd = async (ctx: any) => { matchedBy = "invalid input" - const res = await fetch("https://verify.hackclub.dev/api/status", { + const res = await fetch("https://identity.hackclub.com/api/external/check?slack_id" + userId, { method: "POST", headers: { 'content-type': 'application/json' }, body: JSON.stringify({ From 276a6ea313f95853236695a6ba8cb38742072773 Mon Sep 17 00:00:00 2001 From: DaInfLoop Date: Fri, 27 Jun 2025 12:11:34 +0100 Subject: [PATCH 4/8] i also forgot to change the request method --- index.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/index.ts b/index.ts index 1dbe6fb..71bd1e6 100644 --- a/index.ts +++ b/index.ts @@ -24,11 +24,6 @@ const eligibilityCmd = async (ctx: any) => { const res = await fetch("https://identity.hackclub.com/api/external/check?slack_id" + userId, { - method: "POST", - headers: { 'content-type': 'application/json' }, - body: JSON.stringify({ - "slack_id": userId - }), redirect: "follow" }).then(res => res.json()) From 5c3d854fdfcbf355fa812e201dea8152c2a48445 Mon Sep 17 00:00:00 2001 From: DaInfLoop Date: Fri, 27 Jun 2025 12:14:30 +0100 Subject: [PATCH 5/8] don't rush me, me --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 71bd1e6..7a08c24 100644 --- a/index.ts +++ b/index.ts @@ -23,7 +23,7 @@ const eligibilityCmd = async (ctx: any) => { matchedBy = "invalid input" - const res = await fetch("https://identity.hackclub.com/api/external/check?slack_id" + userId, { + const res = await fetch("https://identity.hackclub.com/api/external/check?slack_id=" + userId, { redirect: "follow" }).then(res => res.json()) From 8f9a4540f701b20d195772822040ff2b710868d1 Mon Sep 17 00:00:00 2001 From: DaInfLoop Date: Fri, 27 Jun 2025 12:15:42 +0100 Subject: [PATCH 6/8] add a user-agent so they know who's killing their servers :D --- index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.ts b/index.ts index 7a08c24..be544ff 100644 --- a/index.ts +++ b/index.ts @@ -24,6 +24,9 @@ const eligibilityCmd = async (ctx: any) => { const res = await fetch("https://identity.hackclub.com/api/external/check?slack_id=" + userId, { + headers: { + 'User-Agent': 'HackClubEligibilityBot/1.0 (ran by Loop / dainfloop)' + } redirect: "follow" }).then(res => res.json()) From 655633349c0cb75031b2769af0d1cc95dcf84803 Mon Sep 17 00:00:00 2001 From: DaInfLoop Date: Fri, 27 Jun 2025 12:16:34 +0100 Subject: [PATCH 7/8] the comma of pain --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index be544ff..467b783 100644 --- a/index.ts +++ b/index.ts @@ -26,7 +26,7 @@ const eligibilityCmd = async (ctx: any) => { const res = await fetch("https://identity.hackclub.com/api/external/check?slack_id=" + userId, { headers: { 'User-Agent': 'HackClubEligibilityBot/1.0 (ran by Loop / dainfloop)' - } + }, redirect: "follow" }).then(res => res.json()) From 7f2f2decc4de3db8b656fdec141253c9af268f47 Mon Sep 17 00:00:00 2001 From: DaInfLoop Date: Fri, 27 Jun 2025 12:32:23 +0100 Subject: [PATCH 8/8] using the wrong property name :sob: --- index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.ts b/index.ts index 467b783..f7e8ee2 100644 --- a/index.ts +++ b/index.ts @@ -30,14 +30,14 @@ const eligibilityCmd = async (ctx: any) => { redirect: "follow" }).then(res => res.json()) - if (res.status === "not_found") + if (res.result === "not_found") return await ctx.respond({ response_type: 'ephemeral', text: `${matchedBy !== "user mention" ? "You aren't" : `<@${userId}> isn't`} verified. ${matchedBy !== "user mention" ? `\nCheck out the to verify.` : ""}`, unfurl_links: true }) - else if (res.status === "needs_submission") { + else if (res.result === "needs_submission") { return await ctx.respond({ response_type: 'ephemeral', text: `${matchedBy !== "user mention" ? "You" : `<@${userId}>`} provided insufficient evidence of who ${matchedBy !== "user mention" ? "you" : "they"} are.${matchedBy !== "user mention" ? `\nCheck out the to re-verify.` : ""}`, @@ -45,14 +45,14 @@ const eligibilityCmd = async (ctx: any) => { }) } - else if (res.status === "pending") { + else if (res.result === "pending") { return await ctx.respond({ response_type: 'ephemeral', text: `${matchedBy !== "user mention" ? "Your verification" : `<@${userId}>'s verification`} has not been accepted yet.`, }) } - else if (res.status === "rejected") { + else if (res.result === "rejected") { if (matchedBy === "user mention") { return await ctx.respond({ response_type: 'ephemeral', @@ -85,14 +85,14 @@ const eligibilityCmd = async (ctx: any) => { } */ - else if (res.status === "verified_eligible") { + else if (res.result === "verified_eligible") { return await ctx.respond({ response_type: 'ephemeral', text: `${matchedBy !== "user mention" ? "You have verified your" : `<@${userId}> has verified their`} identity, and ${matchedBy !== "user mention" ? "are" : "is"} eligible for YSWS prizes.`, }) } - else if (res.status === "verified_but_over_18") { + else if (res.result === "verified_but_over_18") { return await ctx.respond({ response_type: 'ephemeral', text: `${matchedBy !== "user mention" ? "You have verified your" : `<@${userId}> has verified their`} identity, but since ${matchedBy !== "user mention" ? "you're" : "they're"} over 18, ${matchedBy !== "user mention" ? "you're" : "they're"} ineligible for YSWS prizes.`,