aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-02-15 09:27:39 -0800
committerZeyla Hellyer <[email protected]>2017-02-15 09:27:39 -0800
commit1787e00eab126680932076e24ac820cad0bfc383 (patch)
tree54aab4f5dc5a1f211a76af4272d1b983cc049a84 /src/utils
parentUpdate README for `methods` feature removal (diff)
downloadserenity-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/utils')
-rw-r--r--src/utils/builder/create_invite.rs4
-rw-r--r--src/utils/builder/create_message.rs7
-rw-r--r--src/utils/builder/edit_profile.rs2
-rw-r--r--src/utils/builder/edit_role.rs4
-rw-r--r--src/utils/builder/search.rs12
5 files changed, 14 insertions, 15 deletions
diff --git a/src/utils/builder/create_invite.rs b/src/utils/builder/create_invite.rs
index 0f16b27..b3592d0 100644
--- a/src/utils/builder/create_invite.rs
+++ b/src/utils/builder/create_invite.rs
@@ -17,9 +17,9 @@ use std::default::Default;
///
/// let mut client = Client::login_bot(&env::var("DISCORD_BOT_TOKEN").unwrap());
///
-/// client.on_message(|context, message| {
+/// client.on_message(|_, message| {
/// if message.content == "!invite" {
-/// let invite = context.create_invite(message.channel_id, |i| i
+/// let invite = message.channel_id.create_invite(|i| i
/// .max_age(3600)
/// .max_uses(10));
/// }
diff --git a/src/utils/builder/create_message.rs b/src/utils/builder/create_message.rs
index 5386c78..90a1f65 100644
--- a/src/utils/builder/create_message.rs
+++ b/src/utils/builder/create_message.rs
@@ -21,10 +21,9 @@ use super::CreateEmbed;
/// Sending a message with a content of `"test"` and applying text-to-speech:
///
/// ```rust,ignore
-/// // assuming you are in a context
-/// context.send_message(message.channel_id, |m|
-/// .content("test")
-/// .tts(true));
+/// // assuming a `channel_id` has been bound
+///
+/// channel_id.say(|m| m.content("test").tts(true));
/// ```
///
/// [`Context::say`]: ../../client/struct.Context.html#method.say
diff --git a/src/utils/builder/edit_profile.rs b/src/utils/builder/edit_profile.rs
index 4d25f00..83f1da2 100644
--- a/src/utils/builder/edit_profile.rs
+++ b/src/utils/builder/edit_profile.rs
@@ -22,7 +22,7 @@ impl EditProfile {
/// ```rust,ignore
/// use serenity::utils;
///
- /// // assuming you are in a context
+ /// // assuming a `context` has been bound
///
/// let base64 = utils::read_image("./my_image.jpg")
/// .expect("Failed to read image");
diff --git a/src/utils/builder/edit_role.rs b/src/utils/builder/edit_role.rs
index 3410417..e9b86e9 100644
--- a/src/utils/builder/edit_role.rs
+++ b/src/utils/builder/edit_role.rs
@@ -19,8 +19,8 @@ use ::model::{Permissions, Role, permissions};
/// Create a hoisted, mentionable role named "a test role":
///
/// ```rust,ignore
-/// // assuming you are in a `context` and a `guild_id` has been bound
-/// let role = context.create_role(guild_id, |r| r
+/// // assuming a `channel_id` and `guild_id` has been bound
+/// let role = channel_id.create_role(guild_id, |r| r
/// .hoist(true)
/// .mentionable(true)
/// .name("a test role"));
diff --git a/src/utils/builder/search.rs b/src/utils/builder/search.rs
index 6aaffca..904c580 100644
--- a/src/utils/builder/search.rs
+++ b/src/utils/builder/search.rs
@@ -90,9 +90,9 @@ impl SortingOrder {
/// ascending order, and limiting to 5 results:
///
/// ```rust,ignore
-/// // assuming you are in a context
+/// // assuming a `channel_id` has been bound
///
-/// let res = context.search_channel(message.channel_id, |s| s
+/// let res = channel_id.search(|s| s
/// .content("rust")
/// .has_embed(false)
/// .has_attachment(false)
@@ -124,7 +124,7 @@ impl SortingOrder {
/// let query = args.join(" ");
///
/// if query.is_empty() {
-/// let _ = context.say("You must provide a query");
+/// let _ = message.channel_id.say("You must provide a query");
///
/// return Ok(());
/// }
@@ -138,7 +138,7 @@ impl SortingOrder {
/// .map(|c| c.id)
/// .collect();
///
-/// let search = context.search_guild(guild.id, channel_ids, |s| s
+/// let search = guild.search(guild.id, channel_ids, |s| s
/// .content(&query)
/// .context_size(0)
/// .has_attachment(true)
@@ -152,13 +152,13 @@ impl SortingOrder {
/// Err(why) => {
/// println!("Error performing search '{}': {:?}", query, why);
///
-/// let _ = context.say("Error occurred while searching");
+/// let _ = message.channel_id.say("Error occurred while searching");
///
/// return Ok(());
/// },
/// };
///
-/// let _ = context.send_message(message.channel_id, |m| m
+/// let _ = message.channel_id.send_message(|m| m
/// .content(&format!("Found {} total results", messages.total))
/// .embed(|mut e| {
/// for (i, messages) in messages.results.iter_mut().enumerate() {