@@ -23,7 +23,7 @@ pub struct CreateInteractionResponseFollowup<'a> {
2323 // [Omitting avatar_url: not supported in interaction followups]
2424 #[ serde( skip_serializing_if = "Option::is_none" ) ]
2525 tts : Option < bool > ,
26- embeds : Cow < ' a , [ CreateEmbed < ' a > ] > ,
26+ embeds : Option < Cow < ' a , [ CreateEmbed < ' a > ] > > ,
2727 #[ serde( skip_serializing_if = "Option::is_none" ) ]
2828 allowed_mentions : Option < CreateAllowedMentions < ' a > > ,
2929 #[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -41,7 +41,7 @@ impl<'a> CreateInteractionResponseFollowup<'a> {
4141
4242 #[ cfg( feature = "http" ) ]
4343 fn check_length ( & self ) -> Result < ( ) , ModelError > {
44- super :: check_lengths ( self . content . as_deref ( ) , Some ( & self . embeds ) , 0 )
44+ super :: check_lengths ( self . content . as_deref ( ) , self . embeds . as_deref ( ) , 0 )
4545 }
4646
4747 /// Set the content of the message.
@@ -87,13 +87,13 @@ impl<'a> CreateInteractionResponseFollowup<'a> {
8787
8888 /// Adds an embed to the message.
8989 pub fn add_embed ( mut self , embed : CreateEmbed < ' a > ) -> Self {
90- self . embeds . to_mut ( ) . push ( embed) ;
90+ self . embeds . get_or_insert_with ( Cow :: default ) . to_mut ( ) . push ( embed) ;
9191 self
9292 }
9393
9494 /// Adds multiple embeds to the message.
9595 pub fn add_embeds ( mut self , embeds : impl IntoIterator < Item = CreateEmbed < ' a > > ) -> Self {
96- self . embeds . to_mut ( ) . extend ( embeds) ;
96+ self . embeds . get_or_insert_with ( Cow :: default ) . to_mut ( ) . extend ( embeds) ;
9797 self
9898 }
9999
@@ -110,7 +110,7 @@ impl<'a> CreateInteractionResponseFollowup<'a> {
110110 /// Calling this multiple times will overwrite the embed list. To append embeds, call
111111 /// [`Self::add_embeds`] instead.
112112 pub fn embeds ( mut self , embeds : impl Into < Cow < ' a , [ CreateEmbed < ' a > ] > > ) -> Self {
113- self . embeds = embeds. into ( ) ;
113+ self . embeds = Some ( embeds. into ( ) ) ;
114114 self
115115 }
116116
0 commit comments