aboutsummaryrefslogtreecommitdiff
path: root/examples/07_sample_bot_structure/src
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-11-01 20:47:08 -0700
committerZeyla Hellyer <[email protected]>2017-11-03 07:13:38 -0700
commitb19b031a5052a268f323a116403ea66ca71ea575 (patch)
tree0ca71c6736214c40768b409b3a2222f2a3c387ec /examples/07_sample_bot_structure/src
parentMake `Command::aliases` public (diff)
downloadserenity-b19b031a5052a268f323a116403ea66ca71ea575.tar.xz
serenity-b19b031a5052a268f323a116403ea66ca71ea575.zip
Make the Client return a Result
The client now returns a Result in preparation of a future commit. Upgrade path: Handle the case of an error via pattern matching, or unwrap the Result.
Diffstat (limited to 'examples/07_sample_bot_structure/src')
-rw-r--r--examples/07_sample_bot_structure/src/main.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/07_sample_bot_structure/src/main.rs b/examples/07_sample_bot_structure/src/main.rs
index 8962d55..7a0c216 100644
--- a/examples/07_sample_bot_structure/src/main.rs
+++ b/examples/07_sample_bot_structure/src/main.rs
@@ -21,7 +21,9 @@ use std::env;
struct Handler; impl EventHandler for Handler {}
fn main() {
- let mut client = Client::new(&env::var("DISCORD_TOKEN").unwrap(), Handler);
+ let token = env::var("DISCORD_TOKEN")
+ .expect("Expected a token in the environment");
+ let mut client = Client::new(&token, Handler).expect("Err creating client");
client.with_framework(StandardFramework::new()
.configure(|c| c.prefix("~"))