types(Events): rest events can be emitted on BaseClient (#6936)

This commit is contained in:
ckohen
2021-11-05 16:58:54 -07:00
committed by GitHub
parent dc6454104f
commit c297829d54
4 changed files with 50 additions and 14 deletions

View File

@@ -73,3 +73,9 @@ class BaseClient extends EventEmitter {
}
module.exports = BaseClient;
/**
* Emitted for general debugging information.
* @event BaseClient#debug
* @param {string} info The debug information
*/

View File

@@ -605,12 +605,6 @@ module.exports = Client;
* @param {string} info The warning
*/
/**
* Emitted for general debugging information.
* @event Client#debug
* @param {string} info The debug information
*/
/**
* @external Collection
* @see {@link https://discord.js.org/#/docs/collection/main/class/Collection}

View File

@@ -124,7 +124,7 @@ class RequestHandler {
if (this.manager.client.listenerCount(RATE_LIMIT)) {
/**
* Emitted when the client hits a rate limit while making a request
* @event Client#rateLimit
* @event BaseClient#rateLimit
* @param {RateLimitData} rateLimitData Object containing the rate limit info
*/
this.manager.client.emit(RATE_LIMIT, {
@@ -178,7 +178,7 @@ class RequestHandler {
* This event can emit several times for the same request, e.g. when hitting a rate limit.
* <info>This is an informational event that is emitted quite frequently,
* it is highly recommended to check `request.path` to filter the data.</info>
* @event Client#apiRequest
* @event BaseClient#apiRequest
* @param {APIRequest} request The request that is about to be sent
*/
this.manager.client.emit(API_REQUEST, {
@@ -210,7 +210,7 @@ class RequestHandler {
* This event does not necessarily correlate to completion of the request, e.g. when hitting a rate limit.
* <info>This is an informational event that is emitted quite frequently,
* it is highly recommended to check `request.path` to filter the data.</info>
* @event Client#apiResponse
* @event BaseClient#apiResponse
* @param {APIRequest} request The request that triggered this response
* @param {Response} response The response received from the Discord API
*/
@@ -285,7 +285,7 @@ class RequestHandler {
/**
* Emitted periodically when the process sends invalid requests to let users avoid the
* 10k invalid requests in 10 minutes threshold that causes a ban
* @event Client#invalidRequestWarning
* @event BaseClient#invalidRequestWarning
* @param {InvalidRequestWarningData} invalidRequestWarningData Object containing the invalid request info
*/
this.manager.client.emit(INVALID_REQUEST_WARNING, {