diff --git a/src/client/BaseClient.js b/src/client/BaseClient.js
index e0ee6a413..3bf037fae 100644
--- a/src/client/BaseClient.js
+++ b/src/client/BaseClient.js
@@ -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
+ */
diff --git a/src/client/Client.js b/src/client/Client.js
index b79f1683b..c5b38699f 100644
--- a/src/client/Client.js
+++ b/src/client/Client.js
@@ -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}
diff --git a/src/rest/RequestHandler.js b/src/rest/RequestHandler.js
index 8ec808224..bb907498b 100644
--- a/src/rest/RequestHandler.js
+++ b/src/rest/RequestHandler.js
@@ -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.
* This is an informational event that is emitted quite frequently,
* it is highly recommended to check `request.path` to filter the data.
- * @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.
* This is an informational event that is emitted quite frequently,
* it is highly recommended to check `request.path` to filter the data.
- * @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, {
diff --git a/typings/index.d.ts b/typings/index.d.ts
index 619ceaff1..ed82df9ee 100644
--- a/typings/index.d.ts
+++ b/typings/index.d.ts
@@ -265,6 +265,39 @@ export class BaseClient extends EventEmitter {
private decrementMaxListeners(): void;
private incrementMaxListeners(): void;
+ public on(
+ event: K,
+ listener: (...args: BaseClientEvents[K]) => Awaitable,
+ ): this;
+ public on(
+ event: Exclude,
+ listener: (...args: any[]) => Awaitable,
+ ): this;
+
+ public once(
+ event: K,
+ listener: (...args: BaseClientEvents[K]) => Awaitable,
+ ): this;
+ public once(
+ event: Exclude,
+ listener: (...args: any[]) => Awaitable,
+ ): this;
+
+ public emit(event: K, ...args: BaseClientEvents[K]): boolean;
+ public emit(event: Exclude, ...args: unknown[]): boolean;
+
+ public off(
+ event: K,
+ listener: (...args: BaseClientEvents[K]) => Awaitable,
+ ): this;
+ public off(
+ event: Exclude,
+ listener: (...args: any[]) => Awaitable,
+ ): this;
+
+ public removeAllListeners(event?: K): this;
+ public removeAllListeners(event?: Exclude): this;
+
public options: ClientOptions | WebhookClientOptions;
public destroy(): void;
public toJSON(...props: Record[]): unknown;
@@ -3553,9 +3586,15 @@ export interface ChannelWebhookCreateOptions {
reason?: string;
}
-export interface ClientEvents {
+export interface BaseClientEvents {
apiResponse: [request: APIRequest, response: Response];
apiRequest: [request: APIRequest];
+ debug: [message: string];
+ rateLimit: [rateLimitData: RateLimitData];
+ invalidRequestWarning: [invalidRequestWarningData: InvalidRequestWarningData];
+}
+
+export interface ClientEvents extends BaseClientEvents {
/** @deprecated See [this issue](https://github.com/discord/discord-api-docs/issues/3690) for more information. */
applicationCommandCreate: [command: ApplicationCommand];
/** @deprecated See [this issue](https://github.com/discord/discord-api-docs/issues/3690) for more information. */
@@ -3566,7 +3605,6 @@ export interface ClientEvents {
channelDelete: [channel: DMChannel | GuildChannel];
channelPinsUpdate: [channel: TextBasedChannels, date: Date];
channelUpdate: [oldChannel: DMChannel | GuildChannel, newChannel: DMChannel | GuildChannel];
- debug: [message: string];
warn: [message: string];
emojiCreate: [emoji: GuildEmoji];
emojiDelete: [emoji: GuildEmoji];
@@ -3604,8 +3642,6 @@ export interface ClientEvents {
messageReactionRemove: [reaction: MessageReaction | PartialMessageReaction, user: User | PartialUser];
messageUpdate: [oldMessage: Message | PartialMessage, newMessage: Message | PartialMessage];
presenceUpdate: [oldPresence: Presence | null, newPresence: Presence];
- rateLimit: [rateLimitData: RateLimitData];
- invalidRequestWarning: [invalidRequestWarningData: InvalidRequestWarningData];
ready: [client: Client];
invalidated: [];
roleCreate: [role: Role];