SpaceManiac / discord-rs

Rust library for the Discord chat client API
MIT License
387 stars 94 forks source link

Whitespace after bot key causes random failure #85

Closed Xaeroxe closed 7 years ago

Xaeroxe commented 7 years ago

I've spent the last few days trying to figure out what on earth I was doing wrong with this library, turns out that when I was using include_str! to import my bot key from a file that the file had a trailing new line, which causes the library to randomly return HTTP 400 errors. So that no one falls into the same trap I did I recommend one of two changes:

1: Run a trim() on the input inside from_bot_token

2: Return an error in from_bot_token stating that a key cannot contain whitespace.