diff options
| author | Austin Hellyer <[email protected]> | 2016-11-21 13:47:25 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-21 13:47:25 -0800 |
| commit | d89739a0084b368f29673a0487af74409d68965c (patch) | |
| tree | d6462ed17555602ff499678959bbe2ede2a87be6 /src/model/user.rs | |
| parent | Make Context::channel_id public (diff) | |
| download | serenity-d89739a0084b368f29673a0487af74409d68965c.tar.xz serenity-d89739a0084b368f29673a0487af74409d68965c.zip | |
Add created_at method to Ids and User
Returns a Timespec of when the Id (or User) was created.
Diffstat (limited to 'src/model/user.rs')
| -rw-r--r-- | src/model/user.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/model/user.rs b/src/model/user.rs index efe41fd..68c46ec 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -18,6 +18,8 @@ use serde_json::builder::ObjectBuilder; #[cfg(feature = "methods")] use super::Message; #[cfg(feature = "methods")] +use time::Timespec; +#[cfg(feature = "methods")] use ::client::http; #[cfg(feature = "state")] @@ -38,6 +40,13 @@ impl User { format!(cdn_concat!("/avatars/{}/{}.jpg"), self.id, av)) } + /// Retrieves the time that this user was created at. + #[cfg(feature = "methods")] + #[inline] + pub fn created_at(&self) -> Timespec { + self.id.created_at() + } + /// This is an alias of [direct_message]. /// /// [direct_message]: #method.direct_message |