11import { ButtonStyle , ChannelType , ComponentType , SelectMenuDefaultValueType } from 'discord-api-types/v10' ;
22import { z } from 'zod' ;
3- import { idPredicate , customIdPredicate } from '../Assertions.js' ;
3+ import { idPredicate , customIdPredicate , snowflakePredicate } from '../Assertions.js' ;
44
55const labelPredicate = z . string ( ) . min ( 1 ) . max ( 80 ) ;
66
77export const emojiPredicate = z
88 . strictObject ( {
9- id : z . string ( ) . optional ( ) ,
9+ id : snowflakePredicate . optional ( ) ,
1010 name : z . string ( ) . min ( 2 ) . max ( 32 ) . optional ( ) ,
1111 animated : z . boolean ( ) . optional ( ) ,
1212 } )
@@ -39,7 +39,7 @@ const buttonLinkPredicate = buttonPredicateBase.extend({
3939
4040const buttonPremiumPredicate = buttonPredicateBase . extend ( {
4141 style : z . literal ( ButtonStyle . Premium ) ,
42- sku_id : z . string ( ) ,
42+ sku_id : snowflakePredicate ,
4343} ) ;
4444
4545export const buttonPredicate = z . discriminatedUnion ( 'style' , [
@@ -64,7 +64,7 @@ export const selectMenuChannelPredicate = selectMenuBasePredicate.extend({
6464 type : z . literal ( ComponentType . ChannelSelect ) ,
6565 channel_types : z . enum ( ChannelType ) . array ( ) . optional ( ) ,
6666 default_values : z
67- . object ( { id : z . string ( ) , type : z . literal ( SelectMenuDefaultValueType . Channel ) } )
67+ . object ( { id : snowflakePredicate , type : z . literal ( SelectMenuDefaultValueType . Channel ) } )
6868 . array ( )
6969 . max ( 25 )
7070 . optional ( ) ,
@@ -74,7 +74,7 @@ export const selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
7474 type : z . literal ( ComponentType . MentionableSelect ) ,
7575 default_values : z
7676 . object ( {
77- id : z . string ( ) ,
77+ id : snowflakePredicate ,
7878 type : z . literal ( [ SelectMenuDefaultValueType . Role , SelectMenuDefaultValueType . User ] ) ,
7979 } )
8080 . array ( )
@@ -85,7 +85,7 @@ export const selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
8585export const selectMenuRolePredicate = selectMenuBasePredicate . extend ( {
8686 type : z . literal ( ComponentType . RoleSelect ) ,
8787 default_values : z
88- . object ( { id : z . string ( ) , type : z . literal ( SelectMenuDefaultValueType . Role ) } )
88+ . object ( { id : snowflakePredicate , type : z . literal ( SelectMenuDefaultValueType . Role ) } )
8989 . array ( )
9090 . max ( 25 )
9191 . optional ( ) ,
@@ -142,7 +142,7 @@ export const selectMenuStringPredicate = selectMenuBasePredicate
142142export const selectMenuUserPredicate = selectMenuBasePredicate . extend ( {
143143 type : z . literal ( ComponentType . UserSelect ) ,
144144 default_values : z
145- . object ( { id : z . string ( ) , type : z . literal ( SelectMenuDefaultValueType . User ) } )
145+ . object ( { id : snowflakePredicate , type : z . literal ( SelectMenuDefaultValueType . User ) } )
146146 . array ( )
147147 . max ( 25 )
148148 . optional ( ) ,
0 commit comments