mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(builders): correct assertion for select menu string min/max values (#11139)
* fix(builders): correct assertion for select menu string min/max values * fix: actually fix the logic --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -117,13 +117,26 @@ export const selectMenuStringPredicate = selectMenuBasePredicate
|
||||
input: minimum,
|
||||
});
|
||||
|
||||
if (ctx.value.max_values !== undefined && ctx.value.options.length < ctx.value.max_values) {
|
||||
addIssue('max_values', ctx.value.max_values);
|
||||
}
|
||||
|
||||
if (ctx.value.min_values !== undefined && ctx.value.options.length < ctx.value.min_values) {
|
||||
addIssue('min_values', ctx.value.min_values);
|
||||
}
|
||||
|
||||
if (
|
||||
ctx.value.min_values !== undefined &&
|
||||
ctx.value.max_values !== undefined &&
|
||||
ctx.value.min_values > ctx.value.max_values
|
||||
) {
|
||||
ctx.issues.push({
|
||||
code: 'too_big',
|
||||
message: `The maximum amount of options must be greater than or equal to the minimum amount of options`,
|
||||
inclusive: true,
|
||||
maximum: ctx.value.max_values,
|
||||
type: 'number',
|
||||
path: ['min_values'],
|
||||
origin: 'number',
|
||||
input: ctx.value.min_values,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export const selectMenuUserPredicate = selectMenuBasePredicate.extend({
|
||||
|
||||
Reference in New Issue
Block a user