add check for whitespace or newline characters to existing token validation
Checks to see if a token contains any illegal characters, like whitespace or a newline. If it is, throws an ArgumentException warning the user that their token may be invalid.
I considered only checking the first and last character, but given that a token containing whitespace or a newline wouldn't work either I figured this made sense.
/// Checks the validity of the supplied token of a specific type.
/// </summary>
@@ -131,6 +152,9 @@ namespace Discord
// A Null or WhiteSpace token of any type is invalid.
if (string.IsNullOrWhiteSpace(token))
throw new ArgumentNullException(paramName: nameof(token), message: "A token cannot be null, empty, or contain only whitespace.");
// ensure that there are no whitespace or newline characters
if (CheckContainsIllegalCharacters(token))
throw new ArgumentException(message: "The token contains a whitespace or newline character. Ensure that the token has been properly trimmed.", paramName: nameof(token));