@@ -10,14 +10,18 @@ use crate::model::prelude::*;
1010/// A builder to create a soundboard sound.
1111///
1212/// [Discord docs](https://discord.com/developers/docs/resources/soundboard#soundboard-resource)
13- #[ derive( Clone , Debug ) ]
13+ #[ derive( Clone , Debug , Serialize ) ]
1414#[ must_use]
1515pub struct CreateSoundboard < ' a > {
1616 name : String ,
1717 sound : String ,
1818 volume : f64 ,
19+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1920 emoji_id : Option < EmojiId > ,
21+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
2022 emoji_name : Option < String > ,
23+
24+ #[ serde( skip) ]
2125 audit_log_reason : Option < & ' a str > ,
2226}
2327
@@ -106,23 +110,6 @@ impl Builder for CreateSoundboard<'_> {
106110 Permissions :: CREATE_GUILD_EXPRESSIONS ,
107111 ) ?;
108112
109- #[ derive( serde:: Serialize ) ]
110- struct CreateSoundboard {
111- name : String ,
112- sound : String ,
113- volume : f64 ,
114- emoji_id : Option < EmojiId > ,
115- emoji_name : Option < String > ,
116- }
117-
118- let map = CreateSoundboard {
119- name : self . name ,
120- sound : self . sound ,
121- volume : self . volume ,
122- emoji_id : self . emoji_id ,
123- emoji_name : self . emoji_name ,
124- } ;
125-
126- cache_http. http ( ) . create_guild_soundboard ( ctx, & map, self . audit_log_reason ) . await
113+ cache_http. http ( ) . create_guild_soundboard ( ctx, & self , self . audit_log_reason ) . await
127114 }
128115}
0 commit comments