diff options
| author | acdenisSK <[email protected]> | 2017-11-04 23:12:17 +0100 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-11-04 23:12:17 +0100 |
| commit | 2032a402c387b1310f2ae62621f3e07c86b76aef (patch) | |
| tree | e34c35de1eb517d9b2469f02cd179ab9e6b34544 /src/gateway | |
| parent | Merge v0.4.3 (diff) | |
| download | serenity-2032a402c387b1310f2ae62621f3e07c86b76aef.tar.xz serenity-2032a402c387b1310f2ae62621f3e07c86b76aef.zip | |
Whoops. Add a `FromStr` impl for `ReactionType`
Diffstat (limited to 'src/gateway')
| -rw-r--r-- | src/gateway/shard.rs | 61 |
1 files changed, 3 insertions, 58 deletions
diff --git a/src/gateway/shard.rs b/src/gateway/shard.rs index 340e2e8..08a26a6 100644 --- a/src/gateway/shard.rs +++ b/src/gateway/shard.rs @@ -156,12 +156,9 @@ impl Shard { let user = http::get_current_user()?; Shard { -<<<<<<< HEAD manager: VoiceManager::new(tx, user.id), manager_rx: rx, -======= shutdown: false, ->>>>>>> v0.4.3 client, current_presence, heartbeat_instants, @@ -193,13 +190,11 @@ impl Shard { }) } -<<<<<<< HEAD /// Retrieves the current presence of the shard. #[inline] pub fn current_presence(&self) -> &CurrentPresence { &self.current_presence } -======= /// Whether the shard has permanently shutdown. /// /// This should normally happen due to manual calling of [`shutdown`] or @@ -212,31 +207,6 @@ impl Shard { self.shutdown } - /// Retrieves a copy of the current shard information. - /// - /// The first element is the _current_ shard - 0-indexed - while the second - /// element is the _total number_ of shards -- 1-indexed. - /// - /// For example, if using 3 shards in total, and if this is shard 1, then it - /// can be read as "the second of three shards". - /// - /// # Examples - /// - /// Retrieving the shard info for the second shard, out of two shards total: - /// - /// ```rust,no_run - /// # use serenity::client::gateway::Shard; - /// # use std::sync::{Arc, Mutex}; - /// # - /// # let mutex = Arc::new(Mutex::new("".to_string())); - /// # - /// # let shard = Shard::new(mutex.clone(), mutex, [1, 2]).unwrap(); - /// # - /// assert_eq!(shard.shard_info(), [1, 2]); - /// ``` - pub fn shard_info(&self) -> [u64; 2] { self.shard_info } ->>>>>>> v0.4.3 - /// Retrieves the heartbeat instants of the shard. /// /// This is the time of when a heartbeat was sent and when an @@ -265,7 +235,6 @@ impl Shard { /// /// # Errors /// -<<<<<<< HEAD /// Returns [`GatewayError::HeartbeatFailed`] if there was an error sending /// a heartbeat. /// @@ -317,8 +286,6 @@ impl Shard { self.session_id.as_ref() } - #[inline] -======= /// ```rust,no_run /// # #[cfg(feature = "model")] /// # fn main() { @@ -337,7 +304,7 @@ impl Shard { /// # #[cfg(not(feature = "model"))] /// # fn main() { } /// ``` ->>>>>>> v0.4.3 + #[inline] pub fn set_game(&mut self, game: Option<Game>) { self.current_presence.0 = game; } @@ -370,15 +337,12 @@ impl Shard { /// Retrieving the shard info for the second shard, out of two shards total: /// /// ```rust,no_run -<<<<<<< HEAD /// # extern crate parking_lot; /// # extern crate serenity; /// # /// # use parking_lot::Mutex; -======= /// # #[cfg(feature = "model")] /// # fn main() { ->>>>>>> v0.4.3 /// # use serenity::client::gateway::Shard; /// # use std::error::Error; /// # use std::sync::Arc; @@ -388,7 +352,6 @@ impl Shard { /// # /// # let shard = Shard::new(mutex.clone(), mutex, [1, 2]).unwrap(); /// # -<<<<<<< HEAD /// assert_eq!(shard.shard_info(), [1, 2]); /// # Ok(()) /// # } @@ -396,15 +359,6 @@ impl Shard { /// # fn main() { /// # try_main().unwrap(); /// # } -======= - /// use serenity::model::{Game, OnlineStatus}; - /// - /// shard.set_presence(Some(Game::playing("Heroes of the Storm")), OnlineStatus::Online, false); - /// # } - /// # - /// # #[cfg(not(feature = "model"))] - /// # fn main() { } ->>>>>>> v0.4.3 /// ``` pub fn shard_info(&self) -> [u64; 2] { self.shard_info } @@ -695,8 +649,6 @@ impl Shard { } /// Calculates the heartbeat latency between the shard and the gateway. -<<<<<<< HEAD -======= /// /// # Examples /// @@ -732,7 +684,6 @@ impl Shard { /// /// [`Client`]: ../struct.Client.html /// [`EventHandler::on_message`]: ../event_handler/trait.EventHandler.html#method.on_message ->>>>>>> v0.4.3 // Shamelessly stolen from brayzure's commit in eris: // <https://github.com/abalabahaha/eris/commit/0ce296ae9a542bcec0edf1c999ee2d9986bed5a6> pub fn latency(&self) -> Option<StdDuration> { @@ -766,14 +717,11 @@ impl Shard { pub(crate) fn cycle_voice_recv(&mut self) -> Vec<Value> { let mut messages = vec![]; -<<<<<<< HEAD while let Ok(v) = self.manager_rx.try_recv() { messages.push(v); } -======= self.shutdown = true; debug!("[Shard {:?}] Cleanly shutdown shard", self.shard_info); ->>>>>>> v0.4.3 messages } @@ -801,21 +749,18 @@ impl Shard { self.shard_info, ); - self.resume() + self.resume()?; } else { debug!( "[Shard {:?}] Autoreconnector choosing to reconnect", self.shard_info, ); -<<<<<<< HEAD - self.reconnect() + self.reconnect()?; } -======= self.shutdown = true; Ok(()) ->>>>>>> v0.4.3 } /// Requests that one or multiple [`Guild`]s be chunked. |