fix Client#login from other invalid things (#2013)

This commit is contained in:
Gus Caplan
2017-10-08 19:39:52 -05:00
committed by Crawl
parent 97823bc376
commit 69dcfa0708

View File

@@ -259,7 +259,7 @@ class Client extends BaseClient {
*/
login(token) {
return new Promise((resolve, reject) => {
if (typeof token !== 'string') throw new Error('TOKEN_INVALID');
if (!token || typeof token !== 'string') throw new Error('TOKEN_INVALID');
token = token.replace(/^Bot\s*/i, '');
this.manager.connectToWebSocket(token, resolve, reject);
}).catch(e => {