mirror of
https://github.com/danbulant/discord.js
synced 2026-07-07 04:00:42 +00:00
Webpack build for branch master: ee1d4c53f2
This commit is contained in:
parent
c77857e767
commit
793724a3bb
2 changed files with 34 additions and 6 deletions
|
|
@ -264,6 +264,7 @@ exports.VoiceOPCodes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.Events = {
|
exports.Events = {
|
||||||
|
RATE_LIMIT: 'rateLimit',
|
||||||
READY: 'ready',
|
READY: 'ready',
|
||||||
RESUMED: 'resumed',
|
RESUMED: 'resumed',
|
||||||
GUILD_CREATE: 'guildCreate',
|
GUILD_CREATE: 'guildCreate',
|
||||||
|
|
@ -12794,7 +12795,7 @@ module.exports = function sequential() {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.busy = false;
|
this.busy = false;
|
||||||
this.handle();
|
this.handle();
|
||||||
}, timeout || (this.resetTime - Date.now() + this.timeDifference + this.client.options.restTimeOffset));
|
}, timeout);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -12811,7 +12812,7 @@ module.exports = function burst() {
|
||||||
this.client.setTimeout(() => {
|
this.client.setTimeout(() => {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.handle();
|
this.handle();
|
||||||
}, timeout || (this.resetTime - Date.now() + this.timeDifference + this.client.options.restTimeOffset));
|
}, timeout);
|
||||||
});
|
});
|
||||||
this.remaining--;
|
this.remaining--;
|
||||||
this.handle();
|
this.handle();
|
||||||
|
|
@ -12823,6 +12824,7 @@ module.exports = function burst() {
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
const DiscordAPIError = __webpack_require__(37);
|
const DiscordAPIError = __webpack_require__(37);
|
||||||
|
const { Events: { RATE_LIMIT } } = __webpack_require__(0);
|
||||||
|
|
||||||
class RequestHandler {
|
class RequestHandler {
|
||||||
constructor(manager, handler) {
|
constructor(manager, handler) {
|
||||||
|
|
@ -12853,9 +12855,35 @@ class RequestHandler {
|
||||||
execute(item) {
|
execute(item) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const finish = timeout => {
|
const finish = timeout => {
|
||||||
// eslint-disable-next-line prefer-promise-reject-errors
|
if (timeout || this.limited) {
|
||||||
if (timeout || this.limited) reject({ timeout, limited: this.limited });
|
if (!timeout) {
|
||||||
else resolve();
|
timeout = this.resetTime - Date.now() + this.timeDifference + this.client.options.restTimeOffset;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line prefer-promise-reject-errors
|
||||||
|
reject({ timeout });
|
||||||
|
if (this.client.listenerCount(RATE_LIMIT)) {
|
||||||
|
/**
|
||||||
|
* Emitted when the client hits a rate limit while making a request
|
||||||
|
* @event Client#rateLimit
|
||||||
|
* @prop {number} timeout Timeout in ms
|
||||||
|
* @prop {number} limit Number of requests that can be made to this endpoint
|
||||||
|
* @prop {number} timeDifference Delta-T in ms between your system and Discord servers
|
||||||
|
* @prop {string} method HTTP method used for request that triggered this event
|
||||||
|
* @prop {string} path Path used for request that triggered this event
|
||||||
|
* @prop {string} route Route used for request that triggered this event
|
||||||
|
*/
|
||||||
|
this.client.emit(RATE_LIMIT, {
|
||||||
|
timeout,
|
||||||
|
limit: this.limit,
|
||||||
|
timeDifference: this.timeDifference,
|
||||||
|
method: item.request.method,
|
||||||
|
path: item.request.path,
|
||||||
|
route: item.request.route,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
item.request.gen().end((err, res) => {
|
item.request.gen().end((err, res) => {
|
||||||
if (res && res.headers) {
|
if (res && res.headers) {
|
||||||
|
|
|
||||||
2
discord.master.min.js
vendored
2
discord.master.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue