Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(connect): add token check #1283

Merged
merged 9 commits into from
Jun 8, 2022
3 changes: 3 additions & 0 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ class Client extends EventEmitter {
* @returns {Promise} Resolves when all shards are initialized
*/
async connect() {
if(typeof this._token !== "string") {
throw new Error(`Invalid token "${this._token}"`);
}
try {
const data = await (this.options.maxShards === "auto" || (this.options.shardConcurrency === "auto" && this.bot) ? this.getBotGateway() : this.getGateway());
if(!data.url || (this.options.maxShards === "auto" && !data.shards)) {
Expand Down