@@ -4,17 +4,17 @@ import { embedLength } from '../../util/componentUtil.js';
4
4
5
5
const namePredicate = z . string ( ) . max ( 256 ) ;
6
6
7
- const iconURLPredicate = z
7
+ const URLPredicate = z
8
8
. string ( )
9
9
. url ( )
10
- . refine ( refineURLPredicate ( [ 'http:' , 'https:' , 'attachment:' ] ) , {
11
- message : 'Invalid protocol for icon URL. Must be http:, https:, or attachment:' ,
12
- } ) ;
10
+ . refine ( refineURLPredicate ( [ 'http:' , 'https:' ] ) , { message : 'Invalid protocol for URL. Must be http: or https:' } ) ;
13
11
14
- const URLPredicate = z
12
+ const URLWithAttachmentProtocolPredicate = z
15
13
. string ( )
16
14
. url ( )
17
- . refine ( refineURLPredicate ( [ 'http:' , 'https:' ] ) , { message : 'Invalid protocol for URL. Must be http: or https:' } ) ;
15
+ . refine ( refineURLPredicate ( [ 'http:' , 'https:' , 'attachment:' ] ) , {
16
+ message : 'Invalid protocol for URL. Must be http:, https:, or attachment:' ,
17
+ } ) ;
18
18
19
19
export const embedFieldPredicate = z . object ( {
20
20
name : namePredicate ,
@@ -24,13 +24,13 @@ export const embedFieldPredicate = z.object({
24
24
25
25
export const embedAuthorPredicate = z . object ( {
26
26
name : namePredicate . min ( 1 ) ,
27
- icon_url : iconURLPredicate . optional ( ) ,
27
+ icon_url : URLWithAttachmentProtocolPredicate . optional ( ) ,
28
28
url : URLPredicate . optional ( ) ,
29
29
} ) ;
30
30
31
31
export const embedFooterPredicate = z . object ( {
32
32
text : z . string ( ) . min ( 1 ) . max ( 2_048 ) ,
33
- icon_url : iconURLPredicate . optional ( ) ,
33
+ icon_url : URLWithAttachmentProtocolPredicate . optional ( ) ,
34
34
} ) ;
35
35
36
36
export const embedPredicate = z
@@ -41,8 +41,8 @@ export const embedPredicate = z
41
41
timestamp : z . string ( ) . optional ( ) ,
42
42
color : z . number ( ) . int ( ) . min ( 0 ) . max ( 0xffffff ) . optional ( ) ,
43
43
footer : embedFooterPredicate . optional ( ) ,
44
- image : z . object ( { url : URLPredicate } ) . optional ( ) ,
45
- thumbnail : z . object ( { url : URLPredicate } ) . optional ( ) ,
44
+ image : z . object ( { url : URLWithAttachmentProtocolPredicate } ) . optional ( ) ,
45
+ thumbnail : z . object ( { url : URLWithAttachmentProtocolPredicate } ) . optional ( ) ,
46
46
author : embedAuthorPredicate . optional ( ) ,
47
47
fields : z . array ( embedFieldPredicate ) . max ( 25 ) . optional ( ) ,
48
48
} )
0 commit comments