diff options
| author | Austin Hellyer <[email protected]> | 2016-11-15 20:25:32 -0700 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-15 20:25:08 -0800 |
| commit | 56011c411563670d0aa1625ece1218be0af8b09e (patch) | |
| tree | 52b895ccf5ddaaa8d399a2a2a38dee786910aa5b /src/model | |
| parent | Add state/framework/etc. conditional compile flags (diff) | |
| download | serenity-56011c411563670d0aa1625ece1218be0af8b09e.tar.xz serenity-56011c411563670d0aa1625ece1218be0af8b09e.zip | |
Add send_message rich embeds
Diffstat (limited to 'src/model')
| -rw-r--r-- | src/model/channel.rs | 2 | ||||
| -rw-r--r-- | src/model/user.rs | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/model/channel.rs b/src/model/channel.rs index 72a1f09..7348a1c 100644 --- a/src/model/channel.rs +++ b/src/model/channel.rs @@ -276,7 +276,7 @@ impl Embed { #[cfg(feature = "methods")] #[inline(always)] pub fn fake<F>(f: F) -> Value where F: FnOnce(CreateEmbed) -> CreateEmbed { - f(CreateEmbed::default()).0.build() + Value::Object(f(CreateEmbed::default()).0) } } diff --git a/src/model/user.rs b/src/model/user.rs index ce3d3a5..cd5072a 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -1,13 +1,14 @@ use std::fmt; use super::utils::{into_map, into_string, remove, warn_field}; use super::{ + CurrentUser, FriendSourceFlags, GuildContainer, GuildId, Mention, RoleId, UserSettings, - User + User, }; use ::internal::prelude::*; use ::utils::decode_array; @@ -22,6 +23,14 @@ use ::client::http; #[cfg(feature = "state")] use ::client::STATE; +impl CurrentUser { + /// Returns the formatted URL of the user's icon, if one exists. + pub fn avatar_url(&self) -> Option<String> { + self.avatar.as_ref().map(|av| + format!(cdn_concat!("/avatars/{}/{}.jpg"), self.id, av)) + } +} + impl User { /// Returns the formatted URL of the user's icon, if one exists. pub fn avatar_url(&self) -> Option<String> { |