@@ -2,8 +2,6 @@ import { ButtonStyle, ChannelType, ComponentType, SelectMenuDefaultValueType } f
22import { z } from 'zod' ;
33import { idPredicate , customIdPredicate } from '../Assertions.js' ;
44
5- const labelPredicate = z . string ( ) . min ( 1 ) . max ( 80 ) ;
6-
75export const emojiPredicate = z
86 . strictObject ( {
97 id : z . string ( ) . optional ( ) ,
@@ -19,11 +17,13 @@ const buttonPredicateBase = z.strictObject({
1917 disabled : z . boolean ( ) . optional ( ) ,
2018} ) ;
2119
20+ const buttonLabelPredicate = z . string ( ) . min ( 1 ) . max ( 80 ) ;
21+
2222const buttonCustomIdPredicateBase = buttonPredicateBase
2323 . extend ( {
2424 custom_id : customIdPredicate ,
2525 emoji : emojiPredicate . optional ( ) ,
26- label : z . string ( ) . min ( 1 ) . max ( 80 ) . optional ( ) ,
26+ label : buttonLabelPredicate . optional ( ) ,
2727 } )
2828 . refine ( ( data ) => data . emoji !== undefined || data . label !== undefined , {
2929 message : 'Buttons with a custom id must have either an emoji or a label.' ,
@@ -38,7 +38,7 @@ const buttonLinkPredicate = buttonPredicateBase.extend({
3838 style : z . literal ( ButtonStyle . Link ) ,
3939 url : z . url ( { protocol : / ^ (?: h t t p s ? | d i s c o r d ) $ / } ) . max ( 512 ) ,
4040 emoji : emojiPredicate . optional ( ) ,
41- label : labelPredicate ,
41+ label : buttonLabelPredicate . optional ( ) ,
4242} ) ;
4343
4444const buttonPremiumPredicate = buttonPredicateBase . extend ( {
@@ -96,7 +96,7 @@ export const selectMenuRolePredicate = selectMenuBasePredicate.extend({
9696} ) ;
9797
9898export const selectMenuStringOptionPredicate = z . object ( {
99- label : labelPredicate ,
99+ label : z . string ( ) . min ( 1 ) . max ( 100 ) ,
100100 value : z . string ( ) . min ( 1 ) . max ( 100 ) ,
101101 description : z . string ( ) . min ( 1 ) . max ( 100 ) . optional ( ) ,
102102 emoji : emojiPredicate . optional ( ) ,
0 commit comments