aboutsummaryrefslogtreecommitdiff
path: root/examples/02_transparent_guild_sharding/src
diff options
context:
space:
mode:
authorMaiddog <[email protected]>2017-08-27 17:54:16 -0500
committeralex <[email protected]>2017-08-28 00:54:16 +0200
commit4e360cf86a74051e2d4f98758c65ae29b97b7b8b (patch)
tree6f2a02381b507432b089dbdeeabeb89ff496efe8 /examples/02_transparent_guild_sharding/src
parentPrevent malformed opus data from crashing the bot process (#149) (diff)
downloadserenity-4e360cf86a74051e2d4f98758c65ae29b97b7b8b.tar.xz
serenity-4e360cf86a74051e2d4f98758c65ae29b97b7b8b.zip
Fix examples (#151)
Diffstat (limited to 'examples/02_transparent_guild_sharding/src')
-rw-r--r--examples/02_transparent_guild_sharding/src/main.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/examples/02_transparent_guild_sharding/src/main.rs b/examples/02_transparent_guild_sharding/src/main.rs
index 8546b0f..55b20c1 100644
--- a/examples/02_transparent_guild_sharding/src/main.rs
+++ b/examples/02_transparent_guild_sharding/src/main.rs
@@ -25,17 +25,15 @@ use std::env;
struct Handler;
impl EventHandler for Handler {
- fn on_message(&self, _: Context, msg: Message) {
+ fn on_message(&self, ctx: Context, msg: Message) {
if msg.content == "!ping" {
// The current shard needs to be unlocked so it can be read from, as
// multiple threads may otherwise attempt to read from or mutate it
// concurrently.
{
let shard = ctx.shard.lock();
-
- if let Some(shard_info) = shard.shard_info() {
- println!("Shard {}", shard_info[0]);
- }
+ let shard_info = shard.shard_info();
+ println!("Shard {}", shard_info[0]);
}
if let Err(why) = msg.channel_id.say("Pong!") {