feat(Client): add apiResponse and apiRequest events (#6739)

Co-authored-by: Shubham Parihar <shubhamparihar391@gmail.com>
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: SpaceEEC <24881032+SpaceEEC@users.noreply.github.com>
This commit is contained in:
ckohen
2021-10-09 04:56:25 -07:00
committed by GitHub
parent 0d599a1a76
commit 26f927b9fe
5 changed files with 97 additions and 3 deletions

13
typings/index.d.ts vendored
View File

@@ -49,6 +49,7 @@ import {
import { ChildProcess } from 'node:child_process';
import { EventEmitter } from 'node:events';
import { AgentOptions } from 'node:https';
import { Response } from 'node-fetch';
import { Stream } from 'node:stream';
import { MessagePort, Worker } from 'node:worker_threads';
import * as WebSocket from 'ws';
@@ -3129,6 +3130,14 @@ export interface APIErrors {
STICKER_ANIMATION_DURATION_EXCEEDS_MAXIMUM_OF_5_SECONDS: 170007;
}
export interface APIRequest {
method: 'get' | 'post' | 'delete' | 'patch' | 'put';
options: unknown;
path: string;
retries: number;
route: string;
}
export interface ApplicationAsset {
name: string;
id: Snowflake;
@@ -3439,6 +3448,8 @@ export interface ChannelWebhookCreateOptions {
}
export interface ClientEvents {
apiResponse: [request: APIRequest, response: Response];
apiRequest: [request: APIRequest];
applicationCommandCreate: [command: ApplicationCommand];
applicationCommandDelete: [command: ApplicationCommand];
applicationCommandUpdate: [oldCommand: ApplicationCommand | null, newCommand: ApplicationCommand];
@@ -3677,6 +3688,8 @@ export interface ConstantsColors {
export interface ConstantsEvents {
RATE_LIMIT: 'rateLimit';
INVALID_REQUEST_WARNING: 'invalidRequestWarning';
API_RESPONSE: 'apiResponse';
API_REQUEST: 'apiRequest';
CLIENT_READY: 'ready';
APPLICATION_COMMAND_CREATE: 'applicationCommandCreate';
APPLICATION_COMMAND_DELETE: 'applicationCommandDelete';