Implement http requests related to soundboard - #2528
Conversation
raventhyme
left a comment
There was a problem hiding this comment.
Discord API docs commit documenting this: discord/discord-api-docs@90b8e8c
| pub const SOUNDBOARD_SOUND_NAME_LENGTH_MAX: usize = 100; | ||
|
|
||
| /// Minimum length of a soundboard sound's name. | ||
| pub const SOUNDBOARD_SOUND_NAME_LENGTH_MIN: usize = 1; |
There was a problem hiding this comment.
| pub const SOUNDBOARD_SOUND_NAME_LENGTH_MIN: usize = 1; | |
| pub const SOUNDBOARD_SOUND_NAME_LENGTH_MIN: usize = 2; |
| }; | ||
|
|
||
| /// Maximum length of a soundboard sound's name. | ||
| pub const SOUNDBOARD_SOUND_NAME_LENGTH_MAX: usize = 100; |
There was a problem hiding this comment.
| pub const SOUNDBOARD_SOUND_NAME_LENGTH_MAX: usize = 100; | |
| pub const SOUNDBOARD_SOUND_NAME_LENGTH_MAX: usize = 32; |
| #[derive(Debug)] | ||
| #[non_exhaustive] | ||
| pub enum SoundboardValidationErrorType { | ||
| /// The length of the name is either fewer than 2 characters or more than 32 |
There was a problem hiding this comment.
This doc comment can drift if the constants change. Elsewhere we reference constants.
| /// The length of the name is either fewer than 2 characters or more than 32 | ||
| /// characters. | ||
| NameInvalid, | ||
| /// The volume can be between 0 and 1 inclusive. |
| pub guild_id: Option<Id<GuildMarker>>, | ||
| /// Wwhether this sound can be used, may be false due to loss of Server Boosts. | ||
| pub available: bool, | ||
| /// Uhe user who created this sound. |
There was a problem hiding this comment.
| /// Uhe user who created this sound. | |
| /// The user who created this sound. |
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub emoji_name: Option<String>, | ||
| /// The id of the guild this sound is in. | ||
| pub guild_id: Option<Id<GuildMarker>>, |
There was a problem hiding this comment.
Meanwhile, Discord documents this as being an optional key but not as a nullable string. This should be
| pub guild_id: Option<Id<GuildMarker>>, | |
| #[serde(skip_serializing_if = "Option::is_none")] | |
| pub guild_id: Option<Id<GuildMarker>>, |
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub emoji_name: Option<String>, |
There was a problem hiding this comment.
Discord documents this as being a nullable string but not as an optional key
| #[serde(skip_serializing_if = "Option::is_none")] | |
| pub emoji_name: Option<String>, | |
| pub emoji_name: Option<String>, |
| VolumeInvalid, | ||
| } | ||
|
|
||
| /// The name of a soundboard sound can have a length between 2 and 32 characters. |
| } | ||
| } | ||
|
|
||
| /// The volume of a soundboard sound must be between 0 and 1 inclusive. |
| /// The data URI of the mp3 or ogg sound data, base64 encoded, similar to image data | ||
| sound: &'a str, |
There was a problem hiding this comment.
Outside of the scope of the pull request: It would be nice to validate the contents of data strings.
No description provided.