diff options
| author | Zeyla Hellyer <[email protected]> | 2017-10-22 18:01:42 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-10-22 18:01:42 -0700 |
| commit | b328b3e09b0095abb54530dc4d50db6b4e3e1779 (patch) | |
| tree | 9af675bd9a608205dd2c29975038822327601a22 /examples | |
| parent | Remove setting of the afk field in shards (diff) | |
| download | serenity-b328b3e09b0095abb54530dc4d50db6b4e3e1779.tar.xz serenity-b328b3e09b0095abb54530dc4d50db6b4e3e1779.zip | |
Remove `on_` prefix to EventHandler tymethods
It was voted that the `on_` prefix is unnecessary, so these have been
dropped.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/01_basic_ping_bot/src/main.rs | 4 | ||||
| -rw-r--r-- | examples/02_transparent_guild_sharding/src/main.rs | 6 | ||||
| -rw-r--r-- | examples/03_struct_utilities/src/main.rs | 4 | ||||
| -rw-r--r-- | examples/04_message_builder/src/main.rs | 4 | ||||
| -rw-r--r-- | examples/05_command_framework/src/main.rs | 2 | ||||
| -rw-r--r-- | examples/06_voice/src/main.rs | 2 | ||||
| -rw-r--r-- | examples/08_env_logging/src/main.rs | 4 |
7 files changed, 13 insertions, 13 deletions
diff --git a/examples/01_basic_ping_bot/src/main.rs b/examples/01_basic_ping_bot/src/main.rs index 4c2f35c..cf0e6db 100644 --- a/examples/01_basic_ping_bot/src/main.rs +++ b/examples/01_basic_ping_bot/src/main.rs @@ -12,7 +12,7 @@ impl EventHandler for Handler { // // Event handlers are dispatched through multi-threading, and so multiple // of a single event can be dispatched simultaneously. - fn on_message(&self, _: Context, msg: Message) { + fn message(&self, _: Context, msg: Message) { if msg.content == "!ping" { // Sending a message can fail, due to a network error, an // authentication error, or lack of permissions to post in the @@ -30,7 +30,7 @@ impl EventHandler for Handler { // private channels, and more. // // In this case, just print what the current user's username is. - fn on_ready(&self, _: Context, ready: Ready) { + fn ready(&self, _: Context, ready: Ready) { println!("{} is connected!", ready.user.name); } } diff --git a/examples/02_transparent_guild_sharding/src/main.rs b/examples/02_transparent_guild_sharding/src/main.rs index 55b20c1..00b768c 100644 --- a/examples/02_transparent_guild_sharding/src/main.rs +++ b/examples/02_transparent_guild_sharding/src/main.rs @@ -25,7 +25,7 @@ use std::env; struct Handler; impl EventHandler for Handler { - fn on_message(&self, ctx: Context, msg: Message) { + fn 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 @@ -39,10 +39,10 @@ impl EventHandler for Handler { if let Err(why) = msg.channel_id.say("Pong!") { println!("Error sending message: {:?}", why); } - } + } } - fn on_ready(&self, _: Context, ready: Ready) { + fn ready(&self, _: Context, ready: Ready) { println!("{} is connected!", ready.user.name); } } diff --git a/examples/03_struct_utilities/src/main.rs b/examples/03_struct_utilities/src/main.rs index e08cf00..b9f09c4 100644 --- a/examples/03_struct_utilities/src/main.rs +++ b/examples/03_struct_utilities/src/main.rs @@ -7,7 +7,7 @@ use std::env; struct Handler; impl EventHandler for Handler { - fn on_message(&self, _: Context, msg: Message) { + fn message(&self, _: Context, msg: Message) { if msg.content == "!messageme" { // If the `methods` feature is enabled, then model structs will // have a lot of useful methods implemented, to avoid using an @@ -23,7 +23,7 @@ impl EventHandler for Handler { } } - fn on_ready(&self, _: Context, ready: Ready) { + fn ready(&self, _: Context, ready: Ready) { println!("{} is connected!", ready.user.name); } } diff --git a/examples/04_message_builder/src/main.rs b/examples/04_message_builder/src/main.rs index 713224b..f349333 100644 --- a/examples/04_message_builder/src/main.rs +++ b/examples/04_message_builder/src/main.rs @@ -8,7 +8,7 @@ use std::env; struct Handler; impl EventHandler for Handler { - fn on_message(&self, _: Context, msg: Message) { + fn message(&self, _: Context, msg: Message) { if msg.content == "!ping" { let channel = match msg.channel_id.get() { Ok(channel) => channel, @@ -37,7 +37,7 @@ impl EventHandler for Handler { } } - fn on_ready(&self, _: Context, ready: Ready) { + fn ready(&self, _: Context, ready: Ready) { println!("{} is connected!", ready.user.name); } } diff --git a/examples/05_command_framework/src/main.rs b/examples/05_command_framework/src/main.rs index 975e216..bd8e3dd 100644 --- a/examples/05_command_framework/src/main.rs +++ b/examples/05_command_framework/src/main.rs @@ -31,7 +31,7 @@ impl Key for CommandCounter { struct Handler; impl EventHandler for Handler { - fn on_ready(&self, _: Context, ready: Ready) { + fn ready(&self, _: Context, ready: Ready) { println!("{} is connected!", ready.user.name); } } diff --git a/examples/06_voice/src/main.rs b/examples/06_voice/src/main.rs index 4c40bb4..fd919e5 100644 --- a/examples/06_voice/src/main.rs +++ b/examples/06_voice/src/main.rs @@ -21,7 +21,7 @@ use std::env; struct Handler; impl EventHandler for Handler { - fn on_ready(&self, _: Context, ready: Ready) { + fn ready(&self, _: Context, ready: Ready) { println!("{} is connected!", ready.user.name); } } diff --git a/examples/08_env_logging/src/main.rs b/examples/08_env_logging/src/main.rs index db34037..874088a 100644 --- a/examples/08_env_logging/src/main.rs +++ b/examples/08_env_logging/src/main.rs @@ -11,12 +11,12 @@ use std::env; struct Handler; impl EventHandler for Handler { - fn on_ready(&self, _: Context, ready: Ready) { + fn ready(&self, _: Context, ready: Ready) { // Log at the INFO level. This is a macro from the `log` crate. info!("{} is connected!", ready.user.name); } - fn on_resume(&self, _: Context, resume: ResumedEvent) { + fn resume(&self, _: Context, resume: ResumedEvent) { // Log at the DEBUG level. // // In this example, this will not show up in the logs because DEBUG is |