Skip to content

Commit

Permalink
Fix ping bot example (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatsNoMoon authored and arqunis committed Oct 31, 2017
1 parent d3eddc6 commit 800e58f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,17 @@ A basic ping-pong bot looks like:
#[macro_use] extern crate serenity;
use serenity::client::Client;
use serenity::prelude::EventHandler;
use serenity::framework::standard::StandardFramework;
use std::env;
struct Handler;
impl EventHandler for Handler {}
fn main() {
// Login with a bot token from the environment
let mut client = Client::new(&env::var("DISCORD_TOKEN").expect("token"));
let mut client = Client::new(&env::var("DISCORD_TOKEN").expect("token"), Handler);
client.with_framework(StandardFramework::new()
.configure(|c| c.prefix("~")) // set the bot's prefix to "~"
.on("ping", ping));
Expand Down
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,17 @@
//! #[macro_use] extern crate serenity;
//!
//! use serenity::client::Client;
//! use serenity::prelude::EventHandler;
//! use serenity::framework::standard::StandardFramework;
//! use std::env;
//!
//! struct Handler;
//!
//! impl EventHandler for Handler {}
//!
//! fn main() {
//! // Login with a bot token from the environment
//! let mut client = Client::new(&env::var("DISCORD_TOKEN").expect("token"));
//! let mut client = Client::new(&env::var("DISCORD_TOKEN").expect("token"), Handler);
//! client.with_framework(StandardFramework::new()
//! .configure(|c| c.prefix("~")) // set the bot's prefix to "~"
//! .on("ping", ping));
Expand Down

0 comments on commit 800e58f

Please sign in to comment.