aboutsummaryrefslogtreecommitdiff
path: root/src/builder
diff options
context:
space:
mode:
authoralex <[email protected]>2017-06-28 10:41:30 +0200
committerGitHub <[email protected]>2017-06-28 10:41:30 +0200
commitc68d4d5230e60ab48c5620f3d7daff666ded4a11 (patch)
tree0fb357f946acc69a8c6d4b97e2264fa6199841ee /src/builder
parentMake CommandOrAlias and CommandGroup.commands public (#117) (diff)
downloadserenity-c68d4d5230e60ab48c5620f3d7daff666ded4a11.tar.xz
serenity-c68d4d5230e60ab48c5620f3d7daff666ded4a11.zip
Add support for sending attachments in embeds (#95)
Diffstat (limited to 'src/builder')
-rw-r--r--src/builder/create_embed.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/builder/create_embed.rs b/src/builder/create_embed.rs
index fd0f58c..17f164b 100644
--- a/src/builder/create_embed.rs
+++ b/src/builder/create_embed.rs
@@ -267,6 +267,16 @@ impl CreateEmbed {
CreateEmbed(self.0)
}
+
+ /// Same as calling [`image`] with "attachment://filename.(jpg, png)".
+ ///
+ /// 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.
+ ///
+ /// [`ChannelId::send_files`]: ../model/struct.ChannelId.html#send_files
+ pub fn attachment(self, filename: &str) -> Self {
+ self.image(&format!("attachment://{}", filename))
+ }
}
impl Default for CreateEmbed {