Skip to content

Commit

Permalink
Document rule for attachment names in embeds (serenity-rs#2959)
Browse files Browse the repository at this point in the history
Co-authored-by: Ivin <[email protected]>
  • Loading branch information
ivinjabraham and Ivin authored Oct 20, 2024
1 parent 85739d9 commit f1253f9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/builder/create_embed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ impl CreateEmbed {
self
}

/// Set the image associated with the embed. This only supports HTTP(S).
/// Set the image associated with the embed.
///
/// Refer [Discord Documentation](https://discord.com/developers/docs/reference#uploading-files)
/// for rules on naming local attachments.
#[inline]
pub fn image(mut self, url: impl Into<String>) -> Self {
self.0.image = Some(EmbedImage {
Expand All @@ -112,7 +115,7 @@ impl CreateEmbed {
self
}

/// Set the thumbnail of the embed. This only supports HTTP(S).
/// Set the thumbnail of the embed.
#[inline]
pub fn thumbnail(mut self, url: impl Into<String>) -> Self {
self.0.thumbnail = Some(EmbedThumbnail {
Expand Down Expand Up @@ -163,6 +166,8 @@ impl CreateEmbed {
/// Note however, you have to be sure you set an attachment (with [`ChannelId::send_files`])
/// with the provided filename. Or else this won't work.
///
/// Refer [`Self::image`] for rules on naming local attachments.
///
/// [`ChannelId::send_files`]: crate::model::id::ChannelId::send_files
#[inline]
pub fn attachment(self, filename: impl Into<String>) -> Self {
Expand Down Expand Up @@ -299,7 +304,9 @@ impl CreateEmbedFooter {
self
}

/// Set the icon URL's value. This only supports HTTP(S).
/// Set the icon URL's value.
///
/// Refer [`CreateEmbed::image`] for rules on naming local attachments.
pub fn icon_url(mut self, icon_url: impl Into<String>) -> Self {
self.0.icon_url = Some(icon_url.into());
self
Expand Down

0 comments on commit f1253f9

Please sign in to comment.