aboutsummaryrefslogtreecommitdiff
path: root/examples/05_user_login/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/05_user_login/src/main.rs')
-rw-r--r--examples/05_user_login/src/main.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/examples/05_user_login/src/main.rs b/examples/05_user_login/src/main.rs
index bbc9303..0328042 100644
--- a/examples/05_user_login/src/main.rs
+++ b/examples/05_user_login/src/main.rs
@@ -7,11 +7,21 @@ fn main() {
// Configure the client with your Discord bot token in the environment.
let token = env::var("DISCORD_TOKEN")
.expect("Expected a token in the environment");
+
+ // Logging in is essentially equivilant to logging in as a user.
+ //
+ // The primary difference is that by using `login_user`, the "Bot " string
+ // is not prefixed to the token.
+ //
+ // Additionally, the Client will now know that you are a user, and will
+ // disallow you from performing bot-only commands.
let mut client = Client::login_user(&token);
client.on_ready(|_context, ready| {
println!("{} is connected!", ready.user.name);
});
- println!("{:?}", client.start());
+ if let Err(why) = client.start() {
+ println!("Client error: {:?}", why);
+ }
}