mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
rewrite endpoints for consistancy and modularity (#1323)
* rewrite endpoints for consistancy and modularity * clean up a bit * add missing endpoint
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const superagent = require('superagent');
|
||||
const botGateway = require('./Constants').Endpoints.botGateway;
|
||||
const Constants = require('./Constants');
|
||||
|
||||
/**
|
||||
* Contains various general-purpose utility methods. These functions are also available on the base `Discord` object.
|
||||
@@ -54,7 +54,7 @@ class Util {
|
||||
static fetchRecommendedShards(token, guildsPerShard = 1000) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!token) throw new Error('A token must be provided.');
|
||||
superagent.get(botGateway)
|
||||
superagent.get(Constants.Endpoints.gateway.bot)
|
||||
.set('Authorization', `Bot ${token.replace(/^Bot\s*/i, '')}`)
|
||||
.end((err, res) => {
|
||||
if (err) reject(err);
|
||||
|
||||
Reference in New Issue
Block a user