Skip to content

Commit

Permalink
Update to use new langspec types
Browse files Browse the repository at this point in the history
  • Loading branch information
Akhil Pillai committed Nov 19, 2024
1 parent f5251d1 commit 7b3db9c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/commands/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ export async function execute(interaction: ChatInputCommandInteraction) {
(match as MatchType) ?? undefined
);
const response = results.length
? results.map(({ word, meaning }) => `${word}: ${meaning}`).join('\n')
? results
.map(
({ word, meaning, extra, type }) =>
`${word} (${type}): ${meaning} ${extra?.join(' ') ?? ''}`
)
.join('\n')
: 'No results found.';
await interaction.editReply(
response.length > 2000
Expand Down
8 changes: 8 additions & 0 deletions src/lib/kumilinwa/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
export interface Section {
title?: string;
type: WordType;
headers: string[];
entries: Entry[];
}

/**
* The type of the entry in each separated file (i.e. verbs.json)
*/
export interface Entry {
word: string;
meaning: string;
extra?: string[];
}

/**
Expand Down

0 comments on commit 7b3db9c

Please sign in to comment.