diff options
| author | acdenisSK <[email protected]> | 2017-11-16 16:59:05 +0100 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-11-16 16:59:05 +0100 |
| commit | d930758c09cf3f7d56a50f941a6b526dee288e9b (patch) | |
| tree | dff088597c58860f999c4a3f7eb82cc5cb3dba1b /src/framework | |
| parent | Document that application owners bypass checks (#218) (diff) | |
| download | serenity-d930758c09cf3f7d56a50f941a6b526dee288e9b.tar.xz serenity-d930758c09cf3f7d56a50f941a6b526dee288e9b.zip | |
Fix doc-tests
Diffstat (limited to 'src/framework')
| -rw-r--r-- | src/framework/standard/configuration.rs | 12 | ||||
| -rw-r--r-- | src/framework/standard/create_command.rs | 2 | ||||
| -rw-r--r-- | src/framework/standard/help_commands.rs | 4 | ||||
| -rw-r--r-- | src/framework/standard/mod.rs | 20 |
4 files changed, 27 insertions, 11 deletions
diff --git a/src/framework/standard/configuration.rs b/src/framework/standard/configuration.rs index 6a17146..a481c6d 100644 --- a/src/framework/standard/configuration.rs +++ b/src/framework/standard/configuration.rs @@ -169,7 +169,11 @@ impl Configuration { /// let disabled = vec!["ping"].into_iter().map(|x| x.to_string()).collect(); /// /// client.with_framework(StandardFramework::new() - /// .command("ping", |c| c.exec_str("pong!")) + /// .on("ping", |_, msg, _| { + /// msg.channel_id.say("Pong!")?; + /// + /// Ok(()) + /// )) /// .configure(|c| c.disabled_commands(disabled))); /// ``` pub fn disabled_commands(mut self, commands: HashSet<String>) -> Self { @@ -197,7 +201,11 @@ impl Configuration { /// use serenity::framework::StandardFramework; /// /// client.with_framework(StandardFramework::new() - /// .command("ping", |c| c.exec_str("Pong!")) + /// .on("ping", |_, msg, _| { + /// msg.channel_id.say("Pong!")?; + /// + /// Ok(()) + /// )) /// .configure(|c| c.dynamic_prefix(|_, msg| { /// Some(if msg.channel_id.0 % 5 == 0 { /// "!" diff --git a/src/framework/standard/create_command.rs b/src/framework/standard/create_command.rs index d083300..e5c9208 100644 --- a/src/framework/standard/create_command.rs +++ b/src/framework/standard/create_command.rs @@ -65,7 +65,7 @@ impl CreateCommand { /// } /// /// fn owner_check(_context: &mut Context, message: &Message, _: &mut Args, _: - /// &Arc<CommandOptions>) -> bool { + /// &CommandOptions) -> bool { /// // replace with your user ID /// message.author.id == 7 /// } diff --git a/src/framework/standard/help_commands.rs b/src/framework/standard/help_commands.rs index 20fed5d..8111cea 100644 --- a/src/framework/standard/help_commands.rs +++ b/src/framework/standard/help_commands.rs @@ -88,7 +88,7 @@ pub fn has_all_requirements(cmd: &Arc<CommandOptions>, msg: &Message) -> bool { /// use serenity::framework::standard::{StandardFramework, help_commands}; /// /// client.with_framework(StandardFramework::new() -/// .command("help", |c| c.exec_help(help_commands::with_embeds))); +/// .help(help_commands::with_embeds)); /// ``` pub fn with_embeds(_: &mut Context, msg: &Message, @@ -262,7 +262,7 @@ pub fn with_embeds(_: &mut Context, /// use serenity::framework::standard::{StandardFramework, help_commands}; /// /// client.with_framework(StandardFramework::new() -/// .command("help", |c| c.exec_help(help_commands::plain))); +/// .help(help_commands::plain)); /// ``` pub fn plain(_: &mut Context, msg: &Message, diff --git a/src/framework/standard/mod.rs b/src/framework/standard/mod.rs index 106d64c..4148827 100644 --- a/src/framework/standard/mod.rs +++ b/src/framework/standard/mod.rs @@ -283,7 +283,11 @@ impl StandardFramework { /// .bucket("basic", 2, 10, 3) /// .command("ping", |c| c /// .bucket("basic") - /// .exec_str("pong!"))); + /// .exec(|_, msg, _| { + /// msg.channel_id.say("pong!")?; + /// + /// Ok(()) + /// }))); /// ``` pub fn bucket(mut self, s: &str, delay: i64, time_span: i64, limit: i32) -> Self { self.buckets.insert( @@ -325,7 +329,11 @@ impl StandardFramework { /// }) /// .command("ping", |c| c /// .bucket("basic") - /// .exec_str("pong!"))); + /// .exec(|_, msg, _| { + /// msg.channel_id.say("pong!")?; + /// + /// Ok(()) + /// }))); /// ``` /// /// [`bucket`]: #method.bucket @@ -425,7 +433,7 @@ impl StandardFramework { /// .simple_bucket("simple", 2) /// .command("ping", |c| c /// .bucket("simple") - /// .exec_str("pong!"))); + /// .exec(|_, msg, _| { msg.channel_id.say("pong!")?; Ok(()) }))); /// ``` pub fn simple_bucket<S>(mut self, s: &str, delay: i64) -> Self { self.buckets.insert( @@ -616,7 +624,7 @@ impl StandardFramework { /// # /// use serenity::framework::StandardFramework; /// - /// client.with_framework(StandardFramework::new().on("ping", ping)); + /// client.with_framework(StandardFramework::new().cmd("ping", ping)); /// /// command!(ping(_ctx, msg) { /// let _ = msg.channel_id.say("pong!"); @@ -739,8 +747,8 @@ impl StandardFramework { /// /// client.with_framework(StandardFramework::new() /// .group("ping-pong", |g| g - /// .command("ping", |c| c.exec_str("pong!")) - /// .command("pong", |c| c.exec_str("ping!")))); + /// .on("ping", |_, msg, _| { msg.channel_id.say("pong!")?; Ok(()) }) + /// .on("pong", |_, msg, _| { msg.channel_id.say("ping!")?; Ok(()) }))); /// ``` pub fn group<F, S>(mut self, group_name: S, f: F) -> Self where F: FnOnce(CreateGroup) -> CreateGroup, S: Into<String> { |