Skip to content

Commit

Permalink
Fix the framework example so that it makes sense and is runnable
Browse files Browse the repository at this point in the history
  • Loading branch information
arqunis committed May 5, 2018
1 parent f6541dc commit 63fe032
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/framework/mod.rs
Expand Up @@ -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!")?;
//! });
//! ```
//!
Expand Down

0 comments on commit 63fe032

Please sign in to comment.