mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
Fix Util.js : fetchRecommendedShards() (#1532)
* Fix Util.js : fetchRecommendedShards()
I'm not sure who thought this was a good idea, but by removing gateway, it broke fetchRecommendedShards() in Util.js as it uses ${Constants.Endpoints.gateway.bot}.
* Update Constants.js
* Update Constants.js
* Update Util.js
* Update Constants.js
This commit is contained in:
@@ -134,6 +134,7 @@ exports.Endpoints = {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
invite: code => `https://discord.gg/${code}`,
|
invite: code => `https://discord.gg/${code}`,
|
||||||
|
botGateway: '/gateway/bot',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class Util {
|
|||||||
static fetchRecommendedShards(token, guildsPerShard = 1000) {
|
static fetchRecommendedShards(token, guildsPerShard = 1000) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (!token) throw new Error('A token must be provided.');
|
if (!token) throw new Error('A token must be provided.');
|
||||||
snekfetch.get(`${ConstantsHttp.host}/api/v${ConstantsHttp.version}${Constants.Endpoints.gateway.bot}`)
|
snekfetch.get(`${ConstantsHttp.host}/api/v${ConstantsHttp.version}${Constants.Endpoints.botGateway}`)
|
||||||
.set('Authorization', `Bot ${token.replace(/^Bot\s*/i, '')}`)
|
.set('Authorization', `Bot ${token.replace(/^Bot\s*/i, '')}`)
|
||||||
.end((err, res) => {
|
.end((err, res) => {
|
||||||
if (err) reject(err);
|
if (err) reject(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user