mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
Backports (#1813)
* Backported OAuth2Application201ecd25a2* Backported retry on 50057b6980313* Backportedb8034525e3andfa5c4efa2b
This commit is contained in:
@@ -878,7 +878,8 @@ class RESTMethods {
|
||||
}
|
||||
|
||||
resetApplication(id) {
|
||||
return this.rest.makeRequest('post', Endpoints.OAUTH2.Application(id).reset, true)
|
||||
return this.rest.makeRequest('post', Endpoints.OAUTH2.Application(id).resetToken, true)
|
||||
.then(() => this.rest.makeRequest('post', Endpoints.OAUTH2.Application(id).resetSecret, true))
|
||||
.then(app => new OAuth2Application(this.client, app));
|
||||
}
|
||||
|
||||
@@ -908,6 +909,10 @@ class RESTMethods {
|
||||
patchUserSettings(data) {
|
||||
return this.rest.makeRequest('patch', Constants.Endpoints.User('@me').settings, true, data);
|
||||
}
|
||||
|
||||
patchClientUserGuildSettings(guildID, data) {
|
||||
return this.rest.makeRequest('patch', Constants.Endpoints.User('@me').Guild(guildID).settings, true, data);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RESTMethods;
|
||||
|
||||
@@ -40,6 +40,12 @@ class BurstRequestHandler extends RequestHandler {
|
||||
this.handle();
|
||||
this.resetTimeout = null;
|
||||
}, Number(res.headers['retry-after']) + this.client.options.restTimeOffset);
|
||||
} else if (err.status >= 500 && err.status < 600) {
|
||||
this.queue.unshift(item);
|
||||
this.resetTimeout = this.client.setTimeout(() => {
|
||||
this.handle();
|
||||
this.resetTimeout = null;
|
||||
}, 1e3 + this.client.options.restTimeOffset);
|
||||
} else {
|
||||
item.reject(err.status === 400 ? new DiscordAPIError(res.body) : err);
|
||||
this.handle();
|
||||
|
||||
@@ -64,6 +64,9 @@ class SequentialRequestHandler extends RequestHandler {
|
||||
resolve();
|
||||
}, Number(res.headers['retry-after']) + this.restManager.client.options.restTimeOffset);
|
||||
if (res.headers['x-ratelimit-global']) this.globalLimit = true;
|
||||
} else if (err.status >= 500 && err.status < 600) {
|
||||
this.queue.unshift(item);
|
||||
this.restManager.client.setTimeout(resolve, 1e3 + this.client.options.restTimeOffset);
|
||||
} else {
|
||||
item.reject(err.status >= 400 && err.status < 500 ? new DiscordAPIError(res.body) : err);
|
||||
resolve(err);
|
||||
|
||||
Reference in New Issue
Block a user