feat: add new APIErrors (#5794)

This commit is contained in:
Shubham Parihar
2021-06-10 21:35:37 +05:30
committed by GitHub
parent ea0e06f980
commit e0ab836b2d
2 changed files with 35 additions and 9 deletions

View File

@@ -622,6 +622,8 @@ exports.VerificationLevels = ['NONE', 'LOW', 'MEDIUM', 'HIGH', 'VERY_HIGH'];
* * MAXIMUM_CHANNELS * * MAXIMUM_CHANNELS
* * MAXIMUM_ATTACHMENTS * * MAXIMUM_ATTACHMENTS
* * MAXIMUM_INVITES * * MAXIMUM_INVITES
* * MAXIMUM_ANIMATED_EMOJIS
* * MAXIMUM_SERVER_MEMBERS
* * GUILD_ALREADY_HAS_TEMPLATE * * GUILD_ALREADY_HAS_TEMPLATE
* * UNAUTHORIZED * * UNAUTHORIZED
* * ACCOUNT_VERIFICATION_REQUIRED * * ACCOUNT_VERIFICATION_REQUIRED
@@ -691,6 +693,8 @@ exports.APIErrors = {
MAXIMUM_CHANNELS: 30013, MAXIMUM_CHANNELS: 30013,
MAXIMUM_ATTACHMENTS: 30015, MAXIMUM_ATTACHMENTS: 30015,
MAXIMUM_INVITES: 30016, MAXIMUM_INVITES: 30016,
MAXIMUM_ANIMATED_EMOJIS: 30018,
MAXIMUM_SERVER_MEMBERS: 30019,
GUILD_ALREADY_HAS_TEMPLATE: 30031, GUILD_ALREADY_HAS_TEMPLATE: 30031,
UNAUTHORIZED: 40001, UNAUTHORIZED: 40001,
ACCOUNT_VERIFICATION_REQUIRED: 40002, ACCOUNT_VERIFICATION_REQUIRED: 40002,

40
typings/index.d.ts vendored
View File

@@ -1653,8 +1653,14 @@ declare module 'discord.js' {
public readonly ids: number[]; public readonly ids: number[];
public mode: ShardingManagerMode; public mode: ShardingManagerMode;
public parentPort: any | null; public parentPort: any | null;
public broadcastEval<T, P>(fn: (client: Client, context: P) => T, { shard: undefined, context: P }?: BroadcastEvalOptions): Promise<T[]>; public broadcastEval<T, P>(
public broadcastEval<T, P>(fn: (client: Client, context: P) => T, { shard: number, context: P }: BroadcastEvalOptions): Promise<T>; fn: (client: Client, context: P) => T,
{ shard: undefined, context: P }?: BroadcastEvalOptions,
): Promise<T[]>;
public broadcastEval<T, P>(
fn: (client: Client, context: P) => T,
{ shard: number, context: P }: BroadcastEvalOptions,
): Promise<T>;
public fetchClientValues(prop: string): Promise<any[]>; public fetchClientValues(prop: string): Promise<any[]>;
public fetchClientValues(prop: string, shard: number): Promise<any>; public fetchClientValues(prop: string, shard: number): Promise<any>;
public respawnAll(options?: { shardDelay?: number; respawnDelay?: number; timeout?: number }): Promise<void>; public respawnAll(options?: { shardDelay?: number; respawnDelay?: number; timeout?: number }): Promise<void>;
@@ -1677,8 +1683,14 @@ declare module 'discord.js' {
public totalShards: number | 'auto'; public totalShards: number | 'auto';
public shardList: number[] | 'auto'; public shardList: number[] | 'auto';
public broadcast(message: any): Promise<Shard[]>; public broadcast(message: any): Promise<Shard[]>;
public broadcastEval<T, P>(fn: (client: Client, context: P) => T, { shard: undefined, context: P }?: BroadcastEvalOptions): Promise<T[]>; public broadcastEval<T, P>(
public broadcastEval<T, P>(fn: (client: Client, context: P) => T, { shard: number, context: P }: BroadcastEvalOptions): Promise<T>; fn: (client: Client, context: P) => T,
{ shard: undefined, context: P }?: BroadcastEvalOptions,
): Promise<T[]>;
public broadcastEval<T, P>(
fn: (client: Client, context: P) => T,
{ shard: number, context: P }: BroadcastEvalOptions,
): Promise<T>;
public createShard(id: number): Shard; public createShard(id: number): Shard;
public fetchClientValues(prop: string): Promise<any[]>; public fetchClientValues(prop: string): Promise<any[]>;
public fetchClientValues(prop: string, shard: number): Promise<any>; public fetchClientValues(prop: string, shard: number): Promise<any>;
@@ -1946,9 +1958,7 @@ declare module 'discord.js' {
): Promise<RawMessage>; ): Promise<RawMessage>;
public fetchMessage(message: Snowflake, cache?: boolean): Promise<RawMessage>; public fetchMessage(message: Snowflake, cache?: boolean): Promise<RawMessage>;
public send(options: string | APIMessage | (WebhookMessageOptions & { split?: false })): Promise<RawMessage>; public send(options: string | APIMessage | (WebhookMessageOptions & { split?: false })): Promise<RawMessage>;
public send( public send(options: APIMessage | (WebhookMessageOptions & { split: true | SplitOptions })): Promise<RawMessage[]>;
options: APIMessage | (WebhookMessageOptions & { split: true | SplitOptions }),
): Promise<RawMessage[]>;
} }
export class WebSocketManager extends EventEmitter { export class WebSocketManager extends EventEmitter {
@@ -2125,8 +2135,18 @@ declare module 'discord.js' {
name: string, name: string,
options: GuildCreateChannelOptions, options: GuildCreateChannelOptions,
): Promise<TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel>; ): Promise<TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel>;
public fetch(id: Snowflake, cache?: boolean, force?: boolean): Promise<TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel | null>; public fetch(
public fetch(id?: Snowflake, cache?: boolean, force?: boolean): Promise<Collection<Snowflake, TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel>>; id: Snowflake,
cache?: boolean,
force?: boolean,
): Promise<TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel | null>;
public fetch(
id?: Snowflake,
cache?: boolean,
force?: boolean,
): Promise<
Collection<Snowflake, TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel>
>;
} }
export class GuildEmojiManager extends BaseGuildEmojiManager { export class GuildEmojiManager extends BaseGuildEmojiManager {
@@ -2404,6 +2424,8 @@ declare module 'discord.js' {
MAXIMUM_CHANNELS: 30013; MAXIMUM_CHANNELS: 30013;
MAXIMUM_ATTACHMENTS: 30015; MAXIMUM_ATTACHMENTS: 30015;
MAXIMUM_INVITES: 30016; MAXIMUM_INVITES: 30016;
MAXIMUM_ANIMATED_EMOJIS: 30018;
MAXIMUM_SERVER_MEMBERS: 30019;
GUILD_ALREADY_HAS_TEMPLATE: 30031; GUILD_ALREADY_HAS_TEMPLATE: 30031;
UNAUTHORIZED: 40001; UNAUTHORIZED: 40001;
ACCOUNT_VERIFICATION_REQUIRED: 40002; ACCOUNT_VERIFICATION_REQUIRED: 40002;