diff options
| author | Zeyla Hellyer <[email protected]> | 2017-06-21 15:18:46 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-06-21 15:18:46 -0700 |
| commit | 45868cd2cedd6bd418ea1c1d795a74c0ef6af975 (patch) | |
| tree | 7f0a78158e24073606c0abed6c575e25e91c0b5e /src | |
| parent | Extract Discord close codes to constants (diff) | |
| download | serenity-45868cd2cedd6bd418ea1c1d795a74c0ef6af975.tar.xz serenity-45868cd2cedd6bd418ea1c1d795a74c0ef6af975.zip | |
Update dependencies
Diffstat (limited to 'src')
| -rw-r--r-- | src/framework/buckets.rs | 4 | ||||
| -rw-r--r-- | src/gateway/shard.rs | 4 | ||||
| -rw-r--r-- | src/http/ratelimiting.rs | 4 | ||||
| -rw-r--r-- | src/internal/timer.rs | 12 | ||||
| -rw-r--r-- | src/model/permissions.rs | 56 |
5 files changed, 40 insertions, 40 deletions
diff --git a/src/framework/buckets.rs b/src/framework/buckets.rs index 711c0fd..8fdaf37 100644 --- a/src/framework/buckets.rs +++ b/src/framework/buckets.rs @@ -1,4 +1,4 @@ -use chrono::UTC; +use chrono::Utc; use std::collections::HashMap; use std::default::Default; @@ -30,7 +30,7 @@ pub(crate) struct Bucket { impl Bucket { pub fn take(&mut self, user_id: u64) -> i64 { - let time = UTC::now().timestamp(); + let time = Utc::now().timestamp(); let user = self.users.entry(user_id) .or_insert_with(MemberRatelimit::default); diff --git a/src/gateway/shard.rs b/src/gateway/shard.rs index ecc837a..3477946 100644 --- a/src/gateway/shard.rs +++ b/src/gateway/shard.rs @@ -1,4 +1,4 @@ -use chrono::UTC; +use chrono::Utc; use serde_json::Value; use std::env::consts; use std::io::Write; @@ -887,7 +887,7 @@ impl Shard { fn update_presence(&mut self) { let (ref game, status, afk) = self.current_presence; - let now = UTC::now().timestamp() as u64; + let now = Utc::now().timestamp() as u64; let msg = json!({ "op": OpCode::StatusUpdate.num(), diff --git a/src/http/ratelimiting.rs b/src/http/ratelimiting.rs index dd56d6d..a674537 100644 --- a/src/http/ratelimiting.rs +++ b/src/http/ratelimiting.rs @@ -40,7 +40,7 @@ //! [Taken from]: https://discordapp.com/developers/docs/topics/rate-limits#rate-limits #![allow(zero_ptr)] -use chrono::UTC; +use chrono::Utc; use hyper::client::{RequestBuilder, Response}; use hyper::header::Headers; use hyper::status::StatusCode; @@ -439,7 +439,7 @@ impl RateLimit { return; } - let current_time = UTC::now().timestamp(); + let current_time = Utc::now().timestamp(); // The reset was in the past, so we're probably good. if current_time > self.reset { diff --git a/src/internal/timer.rs b/src/internal/timer.rs index 677ece1..1b51dda 100644 --- a/src/internal/timer.rs +++ b/src/internal/timer.rs @@ -1,9 +1,9 @@ -use chrono::{DateTime, Duration, UTC}; +use chrono::{DateTime, Duration, Utc}; use std::thread; use std::time::Duration as StdDuration; pub struct Timer { - due: DateTime<UTC>, + due: DateTime<Utc>, duration: Duration, } @@ -12,7 +12,7 @@ impl Timer { let duration = Duration::milliseconds(duration_in_ms as i64); Timer { - due: UTC::now() + duration, + due: Utc::now() + duration, duration: duration, } } @@ -20,7 +20,7 @@ impl Timer { pub fn await(&mut self) { let due_time = (self.due.timestamp() * 1000) + self.due.timestamp_subsec_millis() as i64; let now_time = { - let now = UTC::now(); + let now = Utc::now(); (now.timestamp() * 1000) + now.timestamp_subsec_millis() as i64 }; @@ -37,7 +37,7 @@ impl Timer { } pub fn check(&mut self) -> bool { - if UTC::now() >= self.due { + if Utc::now() >= self.due { self.due = self.due + self.duration; true @@ -47,6 +47,6 @@ impl Timer { } pub fn reset(&mut self) { - self.due = UTC::now() + self.duration; + self.due = Utc::now() + self.duration; } } diff --git a/src/model/permissions.rs b/src/model/permissions.rs index 383a8d4..40e75ce 100644 --- a/src/model/permissions.rs +++ b/src/model/permissions.rs @@ -183,31 +183,31 @@ bitflags! { /// [`PermissionOverwrite`]: ../struct.PermissionOverwrite.html /// [`Role`]: ../struct.Role.html /// [`User`]: ../struct.User.html - pub flags Permissions: u64 { + pub struct Permissions: u64 { /// Allows for the creation of [`RichInvite`]s. /// /// [`RichInvite`]: ../struct.RichInvite.html - const CREATE_INVITE = 0b00000000000000000000000000000001, + const CREATE_INVITE = 0b00000000000000000000000000000001; /// Allows for the kicking of guild [member]s. /// /// [member]: ../struct.Member.html - const KICK_MEMBERS = 0b00000000000000000000000000000010, + const KICK_MEMBERS = 0b00000000000000000000000000000010; /// Allows the banning of guild [member]s. /// /// [member]: ../struct.Member.html - const BAN_MEMBERS = 0b00000000000000000000000000000100, + const BAN_MEMBERS = 0b00000000000000000000000000000100; /// Allows all permissions, bypassing channel [permission overwrite]s. /// /// [permission overwrite]: ../struct.PermissionOverwrite.html - const ADMINISTRATOR = 0b00000000000000000000000000001000, + const ADMINISTRATOR = 0b00000000000000000000000000001000; /// Allows management and editing of guild [channel]s. /// /// [channel]: ../struct.GuildChannel.html - const MANAGE_CHANNELS = 0b00000000000000000000000000010000, + const MANAGE_CHANNELS = 0b00000000000000000000000000010000; /// Allows management and editing of the [guild]. /// /// [guild]: ../struct.Guild.html - const MANAGE_GUILD = 0b00000000000000000000000000100000, + const MANAGE_GUILD = 0b00000000000000000000000000100000; /// [`Member`]s with this permission can add new [`Reaction`]s to a /// [`Message`]. Members can still react using reactions already added /// to messages without this permission. @@ -215,68 +215,68 @@ bitflags! { /// [`Member`]: ../struct.Member.html /// [`Message`]: ../struct.Message.html /// [`Reaction`]: ../struct.Reaction.html - const ADD_REACTIONS = 0b00000000000000000000000001000000, + const ADD_REACTIONS = 0b00000000000000000000000001000000; /// Allows reading messages in a guild channel. If a user does not have /// this permission, then they will not be able to see the channel. - const READ_MESSAGES = 0b00000000000000000000010000000000, + const READ_MESSAGES = 0b00000000000000000000010000000000; /// Allows sending messages in a guild channel. - const SEND_MESSAGES = 0b00000000000000000000100000000000, + const SEND_MESSAGES = 0b00000000000000000000100000000000; /// Allows the sending of text-to-speech messages in a channel. - const SEND_TTS_MESSAGES = 0b00000000000000000001000000000000, + const SEND_TTS_MESSAGES = 0b00000000000000000001000000000000; /// Allows the deleting of other messages in a guild channel. /// /// **Note**: This does not allow the editing of other messages. - const MANAGE_MESSAGES = 0b00000000000000000010000000000000, + const MANAGE_MESSAGES = 0b00000000000000000010000000000000; /// Allows links from this user - or users of this role - to be /// embedded, with potential data such as a thumbnail, description, and /// page name. - const EMBED_LINKS = 0b00000000000000000100000000000000, + const EMBED_LINKS = 0b00000000000000000100000000000000; /// Allows uploading of files. - const ATTACH_FILES = 0b00000000000000001000000000000000, + const ATTACH_FILES = 0b00000000000000001000000000000000; /// Allows the reading of a channel's message history. - const READ_MESSAGE_HISTORY = 0b00000000000000010000000000000000, + const READ_MESSAGE_HISTORY = 0b00000000000000010000000000000000; /// Allows the usage of the `@everyone` mention, which will notify all /// users in a channel. The `@here` mention will also be available, and /// can be used to mention all non-offline users. /// /// **Note**: You probably want this to be disabled for most roles and /// users. - const MENTION_EVERYONE = 0b00000000000000100000000000000000, + const MENTION_EVERYONE = 0b00000000000000100000000000000000; /// Allows the usage of custom emojis from other guilds. /// /// This does not dictate whether custom emojis in this guild can be /// used in other guilds. - const USE_EXTERNAL_EMOJIS = 0b00000000000001000000000000000000, + const USE_EXTERNAL_EMOJIS = 0b00000000000001000000000000000000; /// Allows the joining of a voice channel. - const CONNECT = 0b00000000000100000000000000000000, + const CONNECT = 0b00000000000100000000000000000000; /// Allows the user to speak in a voice channel. - const SPEAK = 0b00000000001000000000000000000000, + const SPEAK = 0b00000000001000000000000000000000; /// Allows the muting of members in a voice channel. - const MUTE_MEMBERS = 0b00000000010000000000000000000000, + const MUTE_MEMBERS = 0b00000000010000000000000000000000; /// Allows the deafening of members in a voice channel. - const DEAFEN_MEMBERS = 0b00000000100000000000000000000000, + const DEAFEN_MEMBERS = 0b00000000100000000000000000000000; /// Allows the moving of members from one voice channel to another. - const MOVE_MEMBERS = 0b00000001000000000000000000000000, + const MOVE_MEMBERS = 0b00000001000000000000000000000000; /// Allows the usage of voice-activity-detection in a [voice] channel. /// /// If this is disabled, then [`Member`]s must use push-to-talk. /// /// [`Member`]: ../struct.Member.html /// [voice]: ../enum.ChannelType.html#variant.Voice - const USE_VAD = 0b00000010000000000000000000000000, + const USE_VAD = 0b00000010000000000000000000000000; /// Allows members to change their own nickname in the guild. - const CHANGE_NICKNAME = 0b00000100000000000000000000000000, + const CHANGE_NICKNAME = 0b00000100000000000000000000000000; /// Allows members to change other members' nicknames. - const MANAGE_NICKNAMES = 0b00001000000000000000000000000000, + const MANAGE_NICKNAMES = 0b00001000000000000000000000000000; /// Allows management and editing of roles below their own. - const MANAGE_ROLES = 0b00010000000000000000000000000000, + const MANAGE_ROLES = 0b00010000000000000000000000000000; /// Allows management of webhooks. - const MANAGE_WEBHOOKS = 0b00100000000000000000000000000000, + const MANAGE_WEBHOOKS = 0b00100000000000000000000000000000; /// Allows management of emojis created without the use of an /// [`Integration`]. /// /// [`Integration`]: ../struct.Integration.html - const MANAGE_EMOJIS = 0b01000000000000000000000000000000, + const MANAGE_EMOJIS = 0b01000000000000000000000000000000; } } |