Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document rule for attachment names for proper functioning in embeds #2959

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
ivinjabraham marked this conversation as resolved.
Show resolved Hide resolved
///
/// 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
Loading