mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
feat: implement zod-validation-error (#10534)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import { ActionRowBuilder } from '../../components/ActionRow.js';
|
||||
import { createComponentBuilder } from '../../components/Components.js';
|
||||
import { normalizeArray, type RestOrArray } from '../../util/normalizeArray.js';
|
||||
import { resolveBuilder } from '../../util/resolveBuilder.js';
|
||||
import { isValidationEnabled } from '../../util/validation.js';
|
||||
import { validate } from '../../util/validation.js';
|
||||
import { modalPredicate } from './Assertions.js';
|
||||
|
||||
export interface ModalBuilderData extends Partial<Omit<APIModalInteractionResponseCallbackData, 'components'>> {
|
||||
@@ -162,9 +162,7 @@ export class ModalBuilder implements JSONEncodable<APIModalInteractionResponseCa
|
||||
components: components.map((component) => component.toJSON(validationOverride)),
|
||||
};
|
||||
|
||||
if (validationOverride ?? isValidationEnabled()) {
|
||||
modalPredicate.parse(data);
|
||||
}
|
||||
validate(modalPredicate, data, validationOverride);
|
||||
|
||||
return data as APIModalInteractionResponseCallbackData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user