diff options
| author | Austin Hellyer <[email protected]> | 2017-01-24 08:55:49 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2017-01-24 08:55:49 -0800 |
| commit | 47510594e5c939406ebccec8af7e3107a338c7bc (patch) | |
| tree | 8def4138c4d6d33ae40e290c51a39c131ae2850d /examples/02_transparent_guild_sharding | |
| parent | Code style (diff) | |
| download | serenity-47510594e5c939406ebccec8af7e3107a338c7bc.tar.xz serenity-47510594e5c939406ebccec8af7e3107a338c7bc.zip | |
Update examples for OOP style update
Diffstat (limited to 'examples/02_transparent_guild_sharding')
| -rw-r--r-- | examples/02_transparent_guild_sharding/Cargo.toml | 4 | ||||
| -rw-r--r-- | examples/02_transparent_guild_sharding/src/main.rs | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/02_transparent_guild_sharding/Cargo.toml b/examples/02_transparent_guild_sharding/Cargo.toml index 620c7af..808b5c1 100644 --- a/examples/02_transparent_guild_sharding/Cargo.toml +++ b/examples/02_transparent_guild_sharding/Cargo.toml @@ -3,5 +3,5 @@ name = "02_transparent_guild_sharding" version = "0.1.0" authors = ["my name <[email protected]>"] -[dependencies.serenity] -path = "../../" +[dependencies] +serenity = { path = "../../" } diff --git a/examples/02_transparent_guild_sharding/src/main.rs b/examples/02_transparent_guild_sharding/src/main.rs index 1e3446f..b0a639a 100644 --- a/examples/02_transparent_guild_sharding/src/main.rs +++ b/examples/02_transparent_guild_sharding/src/main.rs @@ -27,26 +27,26 @@ fn main() { .expect("Expected a token in the environment"); let mut client = Client::login_bot(&token); - client.on_message(|context, message| { + client.on_message(|ctx, message| { if message.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 = context.shard.lock().unwrap(); + let shard = ctx.shard.lock().unwrap(); if let Some(shard_info) = shard.shard_info() { println!("Shard {}", shard_info[0]); } } - if let Err(why) = context.say("Pong!") { + if let Err(why) = ctx.say("Pong!") { println!("Error sending message: {:?}", why); } } }); - client.on_ready(|_context, ready| { + client.on_ready(|_ctx, ready| { println!("{} is connected!", ready.user.name); }); |