mirror of
https://github.com/danbulant/discord.js
synced 2026-05-26 05:22:15 +00:00
friendlier notification of an invalid token (#997)
* friendlier notification of an invalid token * fixed * even fixeder * no token -> invalid token * eslint * Update RESTMethods.js
This commit is contained in:
parent
6c38b83923
commit
736fa7c611
2 changed files with 2 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ class RESTMethods {
|
|||
|
||||
login(token = this.rest.client.token) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (typeof token !== 'string') throw new Error(Constants.Errors.INVALID_TOKEN);
|
||||
token = token.replace(/^Bot\s*/i, '');
|
||||
this.rest.client.manager.connectToWebSocket(token, resolve, reject);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ exports.Errors = {
|
|||
INVALID_RATE_LIMIT_METHOD: 'Unknown rate limiting method.',
|
||||
BAD_LOGIN: 'Incorrect login details were provided.',
|
||||
INVALID_SHARD: 'Invalid shard settings were provided.',
|
||||
INVALID_TOKEN: 'An invalid token was provided.',
|
||||
};
|
||||
|
||||
const PROTOCOL_VERSION = exports.PROTOCOL_VERSION = 6;
|
||||
|
|
|
|||
Loading…
Reference in a new issue