File tree 3 files changed +19
-13
lines changed
3 files changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ export async function execute(interaction: ChatInputCommandInteraction) {
37
37
const response = results . length
38
38
? results
39
39
. map (
40
- ( { word, meaning, extra , type } ) =>
41
- `${ word } (${ type } ): ${ meaning } ${ extra ?. join ( ' ' ) ?? '' } `
40
+ ( { word, meaning, impl , type } ) =>
41
+ `${ word } (${ type } ): ${ meaning } ${ impl ? ` – ${ impl } ` : '' } `
42
42
)
43
43
. join ( '\n' )
44
44
: 'No results found.' ;
Original file line number Diff line number Diff line change @@ -6,15 +6,19 @@ export async function searchLangSpec(
6
6
matching ?: MatchType
7
7
) : Promise < FullEntry [ ] > {
8
8
const matchWord = matching === 'word' || ! matching ,
9
- matchMeaning = matching === 'meaning' || ! matching ;
9
+ matchMeaning = matching === 'meaning' || ! matching ,
10
+ matchImpl = matching === 'impl' || ! matching ,
11
+ matchObscurism = matching === 'obscurism' || ! matching ;
10
12
const results : FullEntry [ ] = [ ] ;
11
13
for ( const entry of await CompleteLangSpec ( ) )
12
14
if (
13
15
( matchWord && entry . word . includes ( query ) ) ||
14
- ( matchMeaning && entry . meaning . includes ( query ) )
16
+ ( matchMeaning && ( entry . meaning ?? entry . impl ! ) . includes ( query ) ) ||
17
+ ( matchImpl && entry . impl ?. includes ( query ) ) ||
18
+ ( matchObscurism && entry . obscurism ?. includes ( query ) )
15
19
)
16
20
results . push ( entry ) ;
17
21
return results ;
18
22
}
19
23
20
- export type MatchType = 'word' | 'meaning' ;
24
+ export type MatchType = 'word' | 'meaning' | 'impl' | 'obscurism' | 'all' ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * The type of the entry in each separated file (i.e. verbs.json)
3
+ */
1
4
export interface Section {
2
- title ?: string ;
3
- type : WordType ;
5
+ title : string | null ;
4
6
headers : string [ ] ;
7
+ type : WordType ;
5
8
entries : Entry [ ] ;
6
9
}
7
10
8
- /**
9
- * The type of the entry in each separated file (i.e. verbs.json)
10
- */
11
11
export interface Entry {
12
12
word : string ;
13
- meaning : string ;
14
- extra ?: string [ ] ;
13
+ meaning : string | null ;
14
+ impl : string | null ;
15
+ obscurism : string | null ;
15
16
}
16
17
17
18
/**
@@ -36,4 +37,5 @@ export type WordType =
36
37
| 'preposition'
37
38
| 'pronoun'
38
39
| 'suffix'
39
- | 'verb' ;
40
+ | 'verb'
41
+ | 'article' ;
You can’t perform that action at this time.
0 commit comments