Skip to content

Commit

Permalink
fix: add missing nameLocalizations for ArgumentChoice
Browse files Browse the repository at this point in the history
  • Loading branch information
xhyrom committed Apr 17, 2022
1 parent 40293fe commit 038d9c4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/lib/structures/Argument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export enum ChannelType {

export interface ArgumentChoice {
name: string;
nameLocalizations?: Record<LocaleString, string>;
value: string;
}

Expand Down Expand Up @@ -104,6 +105,21 @@ const validationSchema = z
choices: z
.object({
name: z.string(),
nameLocalizations: z
.record(
z
.union([z.string(), z.nativeEnum(Locale)])
.transform(arg =>
typeof arg === 'string' && Object.keys(Locale).includes(arg)
? Locale[arg]
: arg,
),
z
.string()
.max(32)
.regex(/^[a-zA-Z1-9]/),
)
.optional(),
value: z.string(),
})
.array()
Expand Down

0 comments on commit 038d9c4

Please sign in to comment.