mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 18:13:29 +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:
@@ -1,5 +1,5 @@
|
||||
import { ComponentType, type TextInputStyle, type APITextInputComponent } from 'discord-api-types/v10';
|
||||
import { isValidationEnabled } from '../../util/validation.js';
|
||||
import { validate } from '../../util/validation.js';
|
||||
import { ComponentBuilder } from '../Component.js';
|
||||
import { textInputPredicate } from './Assertions.js';
|
||||
|
||||
@@ -154,10 +154,7 @@ export class TextInputBuilder extends ComponentBuilder<APITextInputComponent> {
|
||||
*/
|
||||
public toJSON(validationOverride?: boolean): APITextInputComponent {
|
||||
const clone = structuredClone(this.data);
|
||||
|
||||
if (validationOverride ?? isValidationEnabled()) {
|
||||
textInputPredicate.parse(clone);
|
||||
}
|
||||
validate(textInputPredicate, clone, validationOverride);
|
||||
|
||||
return clone as APITextInputComponent;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user