aboutsummaryrefslogtreecommitdiff
path: root/src/framework/mod.rs
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2018-05-05 14:58:17 +0200
committeracdenisSK <[email protected]>2018-05-05 14:58:17 +0200
commit63fe032eaa29bbee51b6efd3f19392cc41b992e0 (patch)
tree0bf49b72ff97b318039d0d323cfacaae0df31e6b /src/framework/mod.rs
parentRemove discord-rs from related projects (diff)
downloadserenity-63fe032eaa29bbee51b6efd3f19392cc41b992e0.tar.xz
serenity-63fe032eaa29bbee51b6efd3f19392cc41b992e0.zip
Fix the framework example so that it makes sense and is runnable
Diffstat (limited to 'src/framework/mod.rs')
-rw-r--r--src/framework/mod.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/framework/mod.rs b/src/framework/mod.rs
index 47141c1..359882c 100644
--- a/src/framework/mod.rs
+++ b/src/framework/mod.rs
@@ -40,15 +40,21 @@
//!
//! client.with_framework(|f| f
//! .configure(|c| c.prefix("~"))
-//! .command("about", |c| c.exec_str("A simple test bot"))
-//! .command("ping", |c| c.exec(ping)));
+//! .on("about", |_, msg, _| {
+//! msg.channel_id.say("A simple test bot")?;
+//!
+//! // The `command!` macro implicitly puts an `Ok(())` at the end of each command definiton;
+//! // signifying successful execution.
+//! //
+//! // However since we're using `on` that requires a function with the definition `Fn(Context, Message, Args) -> Result<(), _>`,
+//! // we need to manually put the `Ok` ourselves.
+//! Ok(())
+//! })
+//! .cmd("ping", ping));
//!
-//! command!(about(_context, message) {
-//! let _ = message.channel_id.say("A simple test bot");
-//! });
//!
//! command!(ping(_context, message) {
-//! let _ = message.channel_id.say("Pong!");
+//! message.channel_id.say("Pong!")?;
//! });
//! ```
//!