File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ REPEL_LOG_CHANNEL_ID=your-repel-log-channel-id
2020# Role IDs (from your dev server)
2121REPEL_ROLE_ID = your-repel-role-id
2222MODERATORS_ROLE_IDS = your-moderator-role-id
23+ REGULAR_ROLE_ID = your-regular-role-id
2324
2425# Other
2526GUIDES_TRACKER_PATH = guides-tracker.json
Original file line number Diff line number Diff line change 1+ import assert from 'node:assert' ;
2+ import { describe , it } from 'node:test' ;
3+ import { isAskingToAsk } from './just-ask.js' ;
4+
5+ describe ( 'justAsk Regex' , ( ) => {
6+ const testCases = [
7+ { input : 'Anyone knows js?' , expected : true } ,
8+ { input : 'Somebody can help with Python?' , expected : true } ,
9+ { input : 'No one has experience with js?' , expected : true } ,
10+ { input : 'Everybody tried React?' , expected : true } ,
11+ { input : 'People familiar with Kubernetes?' , expected : true } ,
12+
13+ { input : 'I know js well.' , expected : false } ,
14+ { input : 'This is a question without the pattern.' , expected : false } ,
15+ ] ;
16+ testCases . forEach ( ( { input, expected } ) => {
17+ it ( `should return ${ expected } for input: "${ input } "` , ( ) => {
18+ const result = isAskingToAsk ( input ) ;
19+ assert . strictEqual ( result , expected ) ;
20+ } ) ;
21+ } ) ;
22+ } ) ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { loadMarkdownOptions } from '../util/markdown.js';
66import { rateLimit } from '../util/rate-limit.js' ;
77
88// Subject patterns (who)
9- const reSubject = `(?:(?:any|some|no|every)(?:one|body)|people|folks|peeps|who)` ;
9+ const reSubject = `(?:(?:any|some|no|every)(?: ?(?: one|body) )|people|folks|peeps|who)` ;
1010
1111// Verb patterns (has/knows/can help/etc)
1212const 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(
2525 'i'
2626) ;
2727
28- const isAskingToAsk = ( text : string ) => askToAskPattern . test ( text ) ;
28+ export const isAskingToAsk = ( text : string ) => askToAskPattern . test ( text ) ;
2929
3030const [ response ] = await loadMarkdownOptions < { name : string } > (
3131 new URL ( '../commands/tips/subjects/' , import . meta. url ) ,
You canβt perform that action at this time.
0 commit comments