From 25d79ac7e07654dbf77166d46db33d186faf9885 Mon Sep 17 00:00:00 2001 From: Zeyla Hellyer Date: Sun, 17 Dec 2017 07:36:40 -0800 Subject: Trim given token in Client::new Trims the token given as an argument in Client::new, which will strip away whitespace that might occur due to including the token from a file. --- src/client/mod.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/client') diff --git a/src/client/mod.rs b/src/client/mod.rs index 57fa90e..58d411e 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -319,6 +319,8 @@ impl Client { /// ``` pub fn new(token: &str, handler: H) -> Result where H: EventHandler + Send + Sync + 'static { + let token = token.trim(); + let token = if token.starts_with("Bot ") { token.to_string() } else { -- cgit v1.2.3