mirror of
https://github.com/danbulant/discord.js
synced 2026-06-06 08:11:50 +00:00
docs: rateLimit event
This commit is contained in:
parent
0d90798c6c
commit
6f02be2b2e
2 changed files with 11 additions and 4 deletions
|
|
@ -59,6 +59,7 @@ class BurstRequestHandler extends RequestHandler {
|
||||||
limit: this.limit,
|
limit: this.limit,
|
||||||
timeDifference: this.timeDifference,
|
timeDifference: this.timeDifference,
|
||||||
path: item.request.path,
|
path: item.request.path,
|
||||||
|
method: item.request.method,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@ class SequentialRequestHandler extends RequestHandler {
|
||||||
constructor(restManager, endpoint) {
|
constructor(restManager, endpoint) {
|
||||||
super(restManager, endpoint);
|
super(restManager, endpoint);
|
||||||
|
|
||||||
this.manager = restManager;
|
/**
|
||||||
|
* The client that instantiated this handler
|
||||||
|
* @type {Client}
|
||||||
|
*/
|
||||||
this.client = restManager.client;
|
this.client = restManager.client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -85,14 +88,17 @@ class SequentialRequestHandler extends RequestHandler {
|
||||||
/**
|
/**
|
||||||
* Emitted when the client hits a rate limit while making a request
|
* Emitted when the client hits a rate limit while making a request
|
||||||
* @event Client#rateLimit
|
* @event Client#rateLimit
|
||||||
* @prop {number} requestLimit Number of requests that can be made to this endpoint
|
* @param {Object} rateLimitInfo Object containing the rate limit info
|
||||||
* @prop {number} timeDifference Delta-T in ms between your system and Discord servers
|
* @prop {number} rateLimitInfo.requestLimit Number of requests that can be made to this endpoint
|
||||||
* @prop {string} path Path used for request that triggered this event
|
* @prop {number} rateLimitInfo.timeDifference Delta-T in ms between your system and Discord servers
|
||||||
|
* @param {string} rateLimitInfo.method HTTP method used for request that triggered this event
|
||||||
|
* @prop {string} rateLimitInfo.path Path used for request that triggered this event
|
||||||
*/
|
*/
|
||||||
this.client.emit(RATE_LIMIT, {
|
this.client.emit(RATE_LIMIT, {
|
||||||
limit: this.requestLimit,
|
limit: this.requestLimit,
|
||||||
timeDifference: this.timeDifference,
|
timeDifference: this.timeDifference,
|
||||||
path: item.request.path,
|
path: item.request.path,
|
||||||
|
method: item.request.method,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.restManager.client.setTimeout(
|
this.restManager.client.setTimeout(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue