Skip to content

Commit 5f7cb0b

Browse files
committed
try that
1 parent 83d4033 commit 5f7cb0b

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

Diff for: src/commands/search.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export async function execute(interaction: ChatInputCommandInteraction) {
3737
const response = results.length
3838
? results
3939
.map(
40-
({ word, meaning, extra, type }) =>
41-
`${word} (${type}): ${meaning} ${extra?.join(' ') ?? ''}`
40+
({ word, meaning, impl, type }) =>
41+
`${word} (${type}): ${meaning}${impl ? ` – ${impl}` : ''}`
4242
)
4343
.join('\n')
4444
: 'No results found.';

Diff for: src/lib/kumilinwa/search.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ export async function searchLangSpec(
66
matching?: MatchType
77
): Promise<FullEntry[]> {
88
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;
1012
const results: FullEntry[] = [];
1113
for (const entry of await CompleteLangSpec())
1214
if (
1315
(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))
1519
)
1620
results.push(entry);
1721
return results;
1822
}
1923

20-
export type MatchType = 'word' | 'meaning';
24+
export type MatchType = 'word' | 'meaning' | 'impl' | 'obscurism' | 'all';

Diff for: src/lib/kumilinwa/types.ts

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1+
/**
2+
* The type of the entry in each separated file (i.e. verbs.json)
3+
*/
14
export interface Section {
2-
title?: string;
3-
type: WordType;
5+
title: string | null;
46
headers: string[];
7+
type: WordType;
58
entries: Entry[];
69
}
710

8-
/**
9-
* The type of the entry in each separated file (i.e. verbs.json)
10-
*/
1111
export interface Entry {
1212
word: string;
13-
meaning: string;
14-
extra?: string[];
13+
meaning: string | null;
14+
impl: string | null;
15+
obscurism: string | null;
1516
}
1617

1718
/**
@@ -36,4 +37,5 @@ export type WordType =
3637
| 'preposition'
3738
| 'pronoun'
3839
| 'suffix'
39-
| 'verb';
40+
| 'verb'
41+
| 'article';

0 commit comments

Comments
 (0)