diff options
| author | Zeyla Hellyer <[email protected]> | 2017-02-15 09:27:39 -0800 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-02-15 09:27:39 -0800 |
| commit | 1787e00eab126680932076e24ac820cad0bfc383 (patch) | |
| tree | 54aab4f5dc5a1f211a76af4272d1b983cc049a84 /src/ext | |
| parent | Update README for `methods` feature removal (diff) | |
| download | serenity-1787e00eab126680932076e24ac820cad0bfc383.tar.xz serenity-1787e00eab126680932076e24ac820cad0bfc383.zip | |
Update doctests for Context changes
Due to the Context having many methods removed, the doctests were
failing.
Update the doctests to use alternative methods to accomplish the same.
Example:
Before:
```rust
context.say("hi");
```
After:
```rust
message.channel_id.say("hi")
```
Diffstat (limited to 'src/ext')
| -rw-r--r-- | src/ext/cache/mod.rs | 10 | ||||
| -rw-r--r-- | src/ext/framework/create_command.rs | 4 | ||||
| -rw-r--r-- | src/ext/framework/mod.rs | 12 |
3 files changed, 12 insertions, 14 deletions
diff --git a/src/ext/cache/mod.rs b/src/ext/cache/mod.rs index 064add0..b39f5ea 100644 --- a/src/ext/cache/mod.rs +++ b/src/ext/cache/mod.rs @@ -368,7 +368,7 @@ impl Cache { /// let channel = match cache.get_guild_channel(message.channel_id) { /// Some(channel) => channel, /// None => { - /// if let Err(why) = context.say("Could not find guild's channel data") { + /// if let Err(why) = message.channel_id.say("Could not find guild's channel data") { /// println!("Error sending message: {:?}", why); /// } /// @@ -414,14 +414,12 @@ impl Cache { /// ```rust,ignore /// use serenity::client::CACHE; /// - /// // assuming you are in a context - /// /// let cache = CACHE.read().unwrap(); /// let member = { /// let channel = match cache.get_guild_channel(message.channel_id) { /// Some(channel) => channel, /// None => { - /// if let Err(why) = context.say("Error finding channel data") { + /// if let Err(why) = message.channel_id.say("Error finding channel data") { /// println!("Error sending message: {:?}", why); /// } /// }, @@ -430,7 +428,7 @@ impl Cache { /// match cache.get_member(channel.guild_id, message.author.id) { /// Some(member) => member, /// None => { - /// if let Err(why) = context.say("Error finding member data") { + /// if let Err(why) = message.channel_id.say("Error finding member data") { /// println!("Error sending message: {:?}", why); /// } /// }, @@ -439,7 +437,7 @@ impl Cache { /// /// let msg = format!("You have {} roles", member.roles.len()); /// - /// if let Err(why) = context.say(&msg) { + /// if let Err(why) = message.channel_id.say(&msg) { /// println!("Error sending message: {:?}", why); /// } /// ``` diff --git a/src/ext/framework/create_command.rs b/src/ext/framework/create_command.rs index 357a597..68319af 100644 --- a/src/ext/framework/create_command.rs +++ b/src/ext/framework/create_command.rs @@ -54,8 +54,8 @@ impl CreateCommand { /// .desc("Replies to a ping with a pong") /// .exec(ping))); /// - /// fn ping(context: &mut Context, _message: &Message, _args: Vec<String>) -> Result<(), String> { - /// let _ = context.say("Pong!"); + /// fn ping(_context: &mut Context, message: &Message, _args: Vec<String>) -> Result<(), String> { + /// let _ = message.channel_id.say("Pong!"); /// /// Ok(()) /// } diff --git a/src/ext/framework/mod.rs b/src/ext/framework/mod.rs index 3c926a7..552ab93 100644 --- a/src/ext/framework/mod.rs +++ b/src/ext/framework/mod.rs @@ -43,12 +43,12 @@ //! .command("about", |c| c.exec_str("A simple test bot")) //! .command("ping", |c| c.exec(ping))); //! -//! command!(about(context) { -//! let _ = context.say("A simple test bot"); +//! command!(about(_context, message) { +//! let _ = message.channel_id.say("A simple test bot"); //! }); //! -//! command!(ping(context) { -//! let _ = context.say("Pong!"); +//! command!(ping(_context, message) { +//! let _ = message.channel_id.say("Pong!"); //! }); //! ``` //! @@ -703,8 +703,8 @@ impl Framework { /// .on("ping", ping) /// .set_check("ping", owner_check)); /// - /// command!(ping(context) { - /// let _ = context.say("Pong!"); + /// command!(ping(_context, message) { + /// let _ = message.channel_id.say("Pong!"); /// }); /// /// fn owner_check(_context: &mut Context, message: &Message) -> bool { |