aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-30 07:16:59 -0800
committerAustin Hellyer <[email protected]>2016-11-30 07:16:59 -0800
commit18e87b36579e20ed20a9c213c296ac7a57097ea4 (patch)
tree581be5f42bef2555b8ffd2d2892523f83d75d9e5 /src/lib.rs
parentClarify some docs (diff)
downloadserenity-18e87b36579e20ed20a9c213c296ac7a57097ea4.tar.xz
serenity-18e87b36579e20ed20a9c213c296ac7a57097ea4.zip
Move the example in the readme
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs61
1 files changed, 32 insertions, 29 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 8afb89f..9e0068b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -29,6 +29,38 @@
//! need to be sure that some information piece is sanctioned by Discord, refer
//! to their own documentation.
//!
+//! # Example Bot
+//!
+//! A basic ping-pong bot looks like:
+//!
+//! ```rust,no-run
+//! extern crate serenity;
+//!
+//! use serenity::client::{Client, Context};
+//! use serenity::model::Message;
+//! use std::env;
+//!
+//! fn main() {
+//! // Login with a bot token from the environment
+//! let mut client = Client::login_bot(&env::var("DISCORD_TOKEN").expect("token"));
+//! client.with_framework(|f| f
+//! .configure(|c| c.prefix("~")) // set the bot's prefix to "~"
+//! .on("ping", ping));
+//!
+//! // start listening for events by starting a single shard
+//! let _ = client.start();
+//! }
+//!
+//! fn ping(_context: Context, message: Message, _args: Vec<String>) {
+//! let _ = message.reply("Pong!");
+//! }
+//! ```
+//!
+//! ### Full Examples
+//!
+//! Full examples, detailing and explaining usage of the basic functionality of the
+//! library, can be found in the [`examples`] directory.
+//!
//! # Features
//!
//! Features can be enabled or disabled by configuring the library through
@@ -79,35 +111,6 @@
//!
//! - youtube-dl (Arch: `community/youtube-dl`)
//!
-//! # Example Bot
-//!
-//! A basic ping-pong bot looks like:
-//!
-//! ```rust,no_run
-//! extern crate serenity;
-//!
-//! use serenity::Client;
-//! use std::env;
-//!
-//! fn main() {
-//! // Login with a bot token from the environment
-//! let mut client = Client::login_bot(&env::var("DISCORD_TOKEN")
-//! .expect("token"));
-//! client.with_framework(|f| f
-//! .configure(|c| c.prefix("~")) // set the bot's prefix to "~"
-//! .on("ping", |_context, message, _arguments| {
-//! let _ = message.reply("Pong!");
-//! }));
-//!
-//! // start listening for events by starting a single shard
-//! let _ = client.start();
-//! }
-//! ```
-//! ### Full Examples
-//!
-//! Full examples, detailing and explaining usage of the basic functionality of the
-//! library, can be found in the [`examples`] directory.
-//!
//! [`Cache`]: ext/cache/struct.Cache.html
//! [`Client::login_bot`]: client/struct.Client.html#method.login_bot
//! [`Client::login_user`]: client/struct.Client.html#method.login_user