Skip to content

Commit a67d727

Browse files
committed
feat: support for minValue, maxValue in Argument
1 parent bd88556 commit a67d727

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/lib/structures/Argument.ts

+10
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export interface ArgumentOptions {
5050
*/
5151
options?: Array<Argument | ArgumentOptions>;
5252
channelTypes?: Array<ChannelType | keyof typeof ChannelType>;
53+
minValue?: number;
54+
maxValue?: number;
5355
run?: (ctx: AutocompleteContext) => any;
5456
}
5557

@@ -82,6 +84,8 @@ const validationSchema = z
8284
)
8385
.array()
8486
.optional(),
87+
minValue: z.number().optional(),
88+
maxValue: z.number().optional(),
8589
run: z.function().optional(),
8690
})
8791
.passthrough();
@@ -99,6 +103,8 @@ export class Argument {
99103
*/
100104
public options?: Array<Argument>;
101105
public channelTypes?: Array<ChannelType | keyof typeof ChannelType>;
106+
public minValue?: number;
107+
public maxValue?: number;
102108
public run?: (ctx: AutocompleteContext) => any;
103109

104110
constructor(options: ArgumentOptions) {
@@ -123,6 +129,8 @@ export class Argument {
123129
});
124130
this.options = this.arguments;
125131
this.channelTypes = options.channelTypes;
132+
this.minValue = options.minValue;
133+
this.maxValue = options.maxValue;
126134
this.run = options.run;
127135
})
128136
.catch((error) => {
@@ -148,6 +156,8 @@ export class Argument {
148156
required: this.required,
149157
choices: this.choices,
150158
channel_types: this.channelTypes,
159+
min_value: this.minValue,
160+
max_value: this.maxValue,
151161
autocomplete: typeof this.run === 'function',
152162
};
153163
}

0 commit comments

Comments
 (0)