From c5650aead6dfbf4cba0a751071fa22c9af1dac48 Mon Sep 17 00:00:00 2001 From: Ali Hammoud Date: Fri, 28 Nov 2025 00:08:54 +0200 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=A4=96=20ci:=20add=20REGULAR=5FROLE?= =?UTF-8?q?=5FID=20to=20env.test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.test | 1 + 1 file changed, 1 insertion(+) diff --git a/.env.test b/.env.test index d099dce..947b5c8 100644 --- a/.env.test +++ b/.env.test @@ -20,6 +20,7 @@ REPEL_LOG_CHANNEL_ID=your-repel-log-channel-id # Role IDs (from your dev server) REPEL_ROLE_ID=your-repel-role-id MODERATORS_ROLE_IDS=your-moderator-role-id +REGULAR_ROLE_ID=your-regular-role-id # Other GUIDES_TRACKER_PATH=guides-tracker.json From 2b08155ec56e150161af229aaf7d99653ed75214 Mon Sep 17 00:00:00 2001 From: Ali Hammoud Date: Fri, 28 Nov 2025 00:09:23 +0200 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=90=9B=20fix:=20update=20regex=20for?= =?UTF-8?q?=20subject=20patterns=20and=20export=20isAskingToAsk=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/events/just-ask.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/events/just-ask.ts b/src/events/just-ask.ts index f3506f1..5b9ded6 100644 --- a/src/events/just-ask.ts +++ b/src/events/just-ask.ts @@ -6,7 +6,7 @@ import { loadMarkdownOptions } from '../util/markdown.js'; import { rateLimit } from '../util/rate-limit.js'; // Subject patterns (who) -const reSubject = `(?:(?:any|some|no|every)(?:one|body)|people|folks|peeps|who)`; +const reSubject = `(?:(?:any|some|no|every)(?: ?(?:one|body))|people|folks|peeps|who)`; // Verb patterns (has/knows/can help/etc) const reVerb = `(?:ha[sv]e?|got|knows?|can(?: help)?|tried|used|worked(?: with)?|familiar(?: with)?|experience[ds]?(?: with)?|heard(?: of)?|seen)`; @@ -25,7 +25,7 @@ const askToAskPattern = new RegExp( 'i' ); -const isAskingToAsk = (text: string) => askToAskPattern.test(text); +export const isAskingToAsk = (text: string) => askToAskPattern.test(text); const [response] = await loadMarkdownOptions<{ name: string }>( new URL('../commands/tips/subjects/', import.meta.url), From 14e5449354386e9c83e93da1ad0bd0383b8515a7 Mon Sep 17 00:00:00 2001 From: Ali Hammoud Date: Fri, 28 Nov 2025 00:10:05 +0200 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=9A=A8=20test:=20add=20unit=20tests?= =?UTF-8?q?=20for=20just=20ask=20regex=20detection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/events/just-ask.test.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/events/just-ask.test.ts diff --git a/src/events/just-ask.test.ts b/src/events/just-ask.test.ts new file mode 100644 index 0000000..85569df --- /dev/null +++ b/src/events/just-ask.test.ts @@ -0,0 +1,23 @@ +import assert from 'node:assert'; +import { describe, it } from 'node:test'; +import { isAskingToAsk } from './just-ask.js'; + +describe('justAsk Regex', () => { + it("should detect 'just ask' variations", () => { + const testCases = [ + { input: 'Anyone knows js?', expected: true }, + { input: 'Somebody can help with Python?', expected: true }, + { input: 'No one has experience with js?', expected: true }, + { input: 'Everybody tried React?', expected: true }, + { input: 'People familiar with Kubernetes?', expected: true }, + + { input: 'I know js well.', expected: false }, + { input: 'This is a question without the pattern.', expected: false }, + ]; + + for (const { input, expected } of testCases) { + const result = isAskingToAsk(input); + assert.strictEqual(result, expected, `Failed for input: "${input}"`); + } + }); +}); From a8b1110be576a264c0c592df59361689dc8f9458 Mon Sep 17 00:00:00 2001 From: Ali Hammoud Date: Fri, 28 Nov 2025 12:06:03 +0200 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=9A=A8=20test:=20refractor=20justask?= =?UTF-8?q?=20test=20to=20use=20multiple=20`it`=20for=20each=20testcase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/events/just-ask.test.ts | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/events/just-ask.test.ts b/src/events/just-ask.test.ts index 85569df..5a17ffd 100644 --- a/src/events/just-ask.test.ts +++ b/src/events/just-ask.test.ts @@ -3,21 +3,20 @@ import { describe, it } from 'node:test'; import { isAskingToAsk } from './just-ask.js'; describe('justAsk Regex', () => { - it("should detect 'just ask' variations", () => { - const testCases = [ - { input: 'Anyone knows js?', expected: true }, - { input: 'Somebody can help with Python?', expected: true }, - { input: 'No one has experience with js?', expected: true }, - { input: 'Everybody tried React?', expected: true }, - { input: 'People familiar with Kubernetes?', expected: true }, + const testCases = [ + { input: 'Anyone knows js?', expected: true }, + { input: 'Somebody can help with Python?', expected: true }, + { input: 'No one has experience with js?', expected: true }, + { input: 'Everybody tried React?', expected: true }, + { input: 'People familiar with Kubernetes?', expected: true }, - { input: 'I know js well.', expected: false }, - { input: 'This is a question without the pattern.', expected: false }, - ]; - - for (const { input, expected } of testCases) { + { input: 'I know js well.', expected: false }, + { input: 'This is a question without the pattern.', expected: false }, + ]; + testCases.forEach(({ input, expected }) => { + it(`should return ${expected} for input: "${input}"`, () => { const result = isAskingToAsk(input); - assert.strictEqual(result, expected, `Failed for input: "${input}"`); - } + assert.strictEqual(result, expected); + }); }); });