diff options
| author | Zeyla Hellyer <[email protected]> | 2017-06-04 20:32:25 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-06-06 10:12:13 -0700 |
| commit | 990e611a56f37f64fbce74fbc487c7dcc4aa4e28 (patch) | |
| tree | 399c69583bd256d31668affc227f235386814552 /src/framework/mod.rs | |
| parent | Add CurrentUser::face(), User::face() (diff) | |
| download | serenity-990e611a56f37f64fbce74fbc487c7dcc4aa4e28.tar.xz serenity-990e611a56f37f64fbce74fbc487c7dcc4aa4e28.zip | |
Use chrono for struct timestamp fields
Chrono is easier to use than timestamped strings, so they should be
automatically deserialized and available for the user, instead of having
the user deserialize the strings themselves.
These fields have been changed to use a type of `DateTime<FixedOffset>`:
- `ChannelPinsUpdateEvent.last_pin_timestamp`
- `Group.last_pin_timestamp`
- `Guild.joined_at`
- `GuildChannel.last_pin_timestamp`
- `Invite.created_at`
- `Member.joined_at`
- `Message.edited_timestamp
- `Message.timestamp`
- `MessageUpdateEvent.edited_timestamp`
- `MessageUpdateEvent.timestamp`
- `PrivateChannel.last_pin_timestamp`
`Member.joined_at` is now also an `Option`. Previously, if a Guild
Member Update was received for a member not in the cache, a new Member
would be instantiated with a default String value. This is incorrect
behaviour, and has now been replaced with being set to `None` in that
case.
Id methods' `created_at()` method now return a `chrono::NaiveDateTime`
instead of a `time::Timespec`, and `User::created_at` has been updated
to reflect that.
Additionally, drop `time` as a direct dependency and use chrono for
internals.
Diffstat (limited to 'src/framework/mod.rs')
| -rw-r--r-- | src/framework/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/framework/mod.rs b/src/framework/mod.rs index ba0aa36..38615c8 100644 --- a/src/framework/mod.rs +++ b/src/framework/mod.rs @@ -591,7 +591,7 @@ impl Framework { /// ```rust /// # #[macro_use] extern crate serenity; /// command!(ping(_ctx, msg) { - /// msg.channel_id.say("pong!"); + /// msg.channel_id.say("pong!"); /// }); /// # /// # fn main() { @@ -700,7 +700,7 @@ impl Framework { /// # use serenity::Client; /// # let mut client = Client::login("token"); /// use serenity::framework::DispatchError::{NotEnoughArguments, TooManyArguments}; - /// + /// /// client.with_framework(|f| f /// .on_dispatch_error(|ctx, msg, error| { /// match error { @@ -711,7 +711,7 @@ impl Framework { /// msg.channel_id.say(&format!("Max arguments allowed is {}, but got {}.", max, given)); /// } /// _ => println!("Unhandled dispatch error.") - /// } + /// } /// })); /// ``` pub fn on_dispatch_error<F>(mut self, f: F) -> Self |