diff options
| author | Zeyla Hellyer <[email protected]> | 2017-09-24 16:14:12 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-09-24 16:14:12 -0700 |
| commit | 5aaca63f9b2974f312e68adf6cb18bdadbdbb148 (patch) | |
| tree | b261633008490455f4ffc28ac4e55e2c82b3635a /src | |
| parent | Add a shard manager (diff) | |
| download | serenity-5aaca63f9b2974f312e68adf6cb18bdadbdbb148.tar.xz serenity-5aaca63f9b2974f312e68adf6cb18bdadbdbb148.zip | |
Fix tests and example 05
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/bridge/gateway/mod.rs | 1 | ||||
| -rw-r--r-- | src/client/bridge/gateway/shard_runner.rs | 4 | ||||
| -rw-r--r-- | src/framework/standard/create_command.rs | 11 | ||||
| -rw-r--r-- | src/voice/connection.rs | 10 |
4 files changed, 14 insertions, 12 deletions
diff --git a/src/client/bridge/gateway/mod.rs b/src/client/bridge/gateway/mod.rs index 0bfd4e6..24170e0 100644 --- a/src/client/bridge/gateway/mod.rs +++ b/src/client/bridge/gateway/mod.rs @@ -19,6 +19,7 @@ type LockedShard = Parked<Shard>; pub enum ShardManagerMessage { Restart(ShardId), Shutdown(ShardId), + #[allow(dead_code)] ShutdownAll, } diff --git a/src/client/bridge/gateway/shard_runner.rs b/src/client/bridge/gateway/shard_runner.rs index 8bdbb35..4595247 100644 --- a/src/client/bridge/gateway/shard_runner.rs +++ b/src/client/bridge/gateway/shard_runner.rs @@ -12,10 +12,6 @@ use websocket::WebSocketError; #[cfg(feature = "framework")] use framework::Framework; -enum EventRetrieval { - Some() -} - pub struct ShardRunner<H: EventHandler + 'static> { data: Arc<ParkingLotMutex<ShareMap>>, event_handler: Arc<H>, diff --git a/src/framework/standard/create_command.rs b/src/framework/standard/create_command.rs index a6068da..423d982 100644 --- a/src/framework/standard/create_command.rs +++ b/src/framework/standard/create_command.rs @@ -37,7 +37,12 @@ impl CreateCommand { /// # struct Handler; /// # impl EventHandler for Handler {} /// use serenity::client::{Client, Context}; - /// use serenity::framework::standard::{Args, Command, StandardFramework}; + /// use serenity::framework::standard::{ + /// Args, + /// Command, + /// CommandError, + /// StandardFramework, + /// }; /// use serenity::model::Message; /// use std::env; /// use std::sync::Arc; @@ -52,8 +57,8 @@ impl CreateCommand { /// .exec(ping))); /// /// fn ping(_context: &mut Context, message: &Message, _args: Args) -> Result<(), - /// String> { - /// let _ = message.channel_id.say("Pong!"); + /// CommandError> { + /// message.channel_id.say("Pong!")?; /// /// Ok(()) /// } diff --git a/src/voice/connection.rs b/src/voice/connection.rs index 620f19e..c134798 100644 --- a/src/voice/connection.rs +++ b/src/voice/connection.rs @@ -73,10 +73,10 @@ impl Connection { let hello = loop { match client.recv_json(VoiceEvent::decode)? { - VoiceEvent::Hello(received_hello) => { + Some(VoiceEvent::Hello(received_hello)) => { break received_hello; }, - VoiceEvent::Heartbeat(_) => continue, + Some(VoiceEvent::Heartbeat(_)) => continue, other => { debug!("[Voice] Expected hello/heartbeat; got: {:?}", other); @@ -388,7 +388,7 @@ fn generate_url(endpoint: &mut String) -> Result<WebsocketUrl> { fn encryption_key(client: &mut Client) -> Result<Key> { loop { match client.recv_json(VoiceEvent::decode)? { - VoiceEvent::Ready(ready) => { + Some(VoiceEvent::Ready(ready)) => { if ready.mode != CRYPTO_MODE { return Err(Error::Voice(VoiceError::VoiceModeInvalid)); } @@ -396,7 +396,7 @@ fn encryption_key(client: &mut Client) -> Result<Key> { return Key::from_slice(&ready.secret_key) .ok_or(Error::Voice(VoiceError::KeyGen)); }, - VoiceEvent::Unknown(op, value) => { + Some(VoiceEvent::Unknown(op, value)) => { debug!( "[Voice] Expected ready for key; got: op{}/v{:?}", op.num(), @@ -447,7 +447,7 @@ fn start_threads(client: Arc<Mutex<Client>>, udp: &UdpSocket) -> Result<ThreadIt let ws_thread = ThreadBuilder::new() .name(format!("{} WS", thread_name)) .spawn(move || loop { - while let Ok(msg) = client.lock().unwrap().recv_json(VoiceEvent::decode) { + while let Ok(Some(msg)) = client.lock().unwrap().recv_json(VoiceEvent::decode) { if tx_clone.send(ReceiverStatus::Websocket(msg)).is_ok() { return; } |