Skip to content

Implement http requests related to soundboard - #2528

Open
Erk- wants to merge 3 commits into
mainfrom
erk/soundboard
Open

Implement http requests related to soundboard#2528
Erk- wants to merge 3 commits into
mainfrom
erk/soundboard

Conversation

@Erk-

@Erk- Erk- commented May 25, 2026

Copy link
Copy Markdown
Member

No description provided.

@github-actions github-actions Bot added c-http Affects the http crate c-model Affects the model crate c-validate Affects the validate crate labels May 25, 2026

@raventhyme raventhyme left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// 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>>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meanwhile, Discord documents this as being an optional key but not as a nullable string. This should be

Suggested change
pub guild_id: Option<Id<GuildMarker>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub guild_id: Option<Id<GuildMarker>>,

Comment on lines +22 to +23
#[serde(skip_serializing_if = "Option::is_none")]
pub emoji_name: Option<String>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discord documents this as being a nullable string but not as an optional key

Suggested change
#[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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

}
}

/// The volume of a soundboard sound must be between 0 and 1 inclusive.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Comment on lines +25 to +26
/// The data URI of the mp3 or ogg sound data, base64 encoded, similar to image data
sound: &'a str,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outside of the scope of the pull request: It would be nice to validate the contents of data strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c-http Affects the http crate c-model Affects the model crate c-validate Affects the validate crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants