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/model | |
| 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/model')
| -rw-r--r-- | src/model/channel.rs | 14 | ||||
| -rw-r--r-- | src/model/guild.rs | 10 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/model/channel.rs b/src/model/channel.rs index 2c42405..1305472 100644 --- a/src/model/channel.rs +++ b/src/model/channel.rs @@ -58,13 +58,13 @@ impl Attachment { /// let token = env::var("DISCORD_TOKEN").expect("token in environment"); /// let mut client = Client::login_bot(&token); /// - /// client.on_message(|context, message| { + /// client.on_message(|_, message| { /// for attachment in message.attachments { /// let content = match attachment.download() { /// Ok(content) => content, /// Err(why) => { /// println!("Error downloading attachment: {:?}", why); - /// let _ = context.say("Error downloading attachment"); + /// let _ = message.channel_id.say("Error downloading attachment"); /// /// return; /// }, @@ -74,7 +74,7 @@ impl Attachment { /// Ok(file) => file, /// Err(why) => { /// println!("Error creating file: {:?}", why); - /// let _ = context.say("Error creating file"); + /// let _ = message.channel_id.say("Error creating file"); /// /// return; /// }, @@ -86,7 +86,7 @@ impl Attachment { /// return; /// } /// - /// let _ = context.say(&format!("Saved {:?}", attachment.filename)); + /// let _ = message.channel_id.say(&format!("Saved {:?}", attachment.filename)); /// } /// }); /// @@ -588,9 +588,9 @@ impl ChannelId { /// Change a voice channel's name and bitrate: /// /// ```rust,ignore - /// context.edit_channel(channel_id, |c| c - /// .name("test") - /// .bitrate(64000)); + /// // assuming a `channel_id` has been bound + /// + /// channel_id.edit(|c| c.name("test").bitrate(64000)); /// ``` /// /// # Errors diff --git a/src/model/guild.rs b/src/model/guild.rs index 0ee68fd..03c5cfc 100644 --- a/src/model/guild.rs +++ b/src/model/guild.rs @@ -358,9 +358,9 @@ impl Guild { /// Create a role which can be mentioned, with the name 'test': /// /// ```rust,ignore - /// let role = context.create_role(guild_id, |r| r - /// .hoist(true) - /// .name("role")); + /// // assuming a `guild` has been bound + /// + /// let role = guild.create_role(|r| r.hoist(true).name("role")); /// ``` /// /// # Errors @@ -2446,7 +2446,9 @@ impl Role { /// Make a role hoisted: /// /// ```rust,ignore - /// context.edit_role(guild_id, role_id, |r| r.hoist(true)); + /// // assuming a `guild` and `role_id` have been bound + // + /// guild.edit_role(role_id, |r| r.hoist(true)); /// ``` /// /// [`Role`]: struct.Role.html |