mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
http rewrite (actually works this time!!1!) (#1257)
* rewrite http * browser fun * all the mimes dammit * i need a newline * whoops * forgot about this * use promises and HTTPRequest.method * fluent * move httpclient to external module * branding * middleware * revert middleware
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const superagent = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
const Constants = require('./Constants');
|
||||
|
||||
/**
|
||||
@@ -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(Constants.Endpoints.gateway.bot)
|
||||
snekfetch.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