Skip to content

Commit

Permalink
feat: add new APIErrors (#5794)
Browse files Browse the repository at this point in the history
  • Loading branch information
iShibi committed Jun 10, 2021
1 parent ea0e06f commit e0ab836
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/util/Constants.js
Expand Up @@ -622,6 +622,8 @@ exports.VerificationLevels = ['NONE', 'LOW', 'MEDIUM', 'HIGH', 'VERY_HIGH'];
* * MAXIMUM_CHANNELS
* * MAXIMUM_ATTACHMENTS
* * MAXIMUM_INVITES
* * MAXIMUM_ANIMATED_EMOJIS
* * MAXIMUM_SERVER_MEMBERS
* * GUILD_ALREADY_HAS_TEMPLATE
* * UNAUTHORIZED
* * ACCOUNT_VERIFICATION_REQUIRED
Expand Down Expand Up @@ -691,6 +693,8 @@ exports.APIErrors = {
MAXIMUM_CHANNELS: 30013,
MAXIMUM_ATTACHMENTS: 30015,
MAXIMUM_INVITES: 30016,
MAXIMUM_ANIMATED_EMOJIS: 30018,
MAXIMUM_SERVER_MEMBERS: 30019,
GUILD_ALREADY_HAS_TEMPLATE: 30031,
UNAUTHORIZED: 40001,
ACCOUNT_VERIFICATION_REQUIRED: 40002,
Expand Down
40 changes: 31 additions & 9 deletions typings/index.d.ts
Expand Up @@ -1653,8 +1653,14 @@ declare module 'discord.js' {
public readonly ids: number[];
public mode: ShardingManagerMode;
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>(fn: (client: Client, context: P) => T, { shard: number, context: P }: BroadcastEvalOptions): Promise<T>;
public broadcastEval<T, P>(
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, shard: number): Promise<any>;
public respawnAll(options?: { shardDelay?: number; respawnDelay?: number; timeout?: number }): Promise<void>;
Expand All @@ -1677,8 +1683,14 @@ declare module 'discord.js' {
public totalShards: number | 'auto';
public shardList: number[] | 'auto';
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>(fn: (client: Client, context: P) => T, { shard: number, context: P }: BroadcastEvalOptions): Promise<T>;
public broadcastEval<T, P>(
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 fetchClientValues(prop: string): Promise<any[]>;
public fetchClientValues(prop: string, shard: number): Promise<any>;
Expand Down Expand Up @@ -1946,9 +1958,7 @@ declare module 'discord.js' {
): Promise<RawMessage>;
public fetchMessage(message: Snowflake, cache?: boolean): Promise<RawMessage>;
public send(options: string | APIMessage | (WebhookMessageOptions & { split?: false })): Promise<RawMessage>;
public send(
options: APIMessage | (WebhookMessageOptions & { split: true | SplitOptions }),
): Promise<RawMessage[]>;
public send(options: APIMessage | (WebhookMessageOptions & { split: true | SplitOptions })): Promise<RawMessage[]>;
}

export class WebSocketManager extends EventEmitter {
Expand Down Expand Up @@ -2125,8 +2135,18 @@ declare module 'discord.js' {
name: string,
options: GuildCreateChannelOptions,
): 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(id?: Snowflake, cache?: boolean, force?: boolean): Promise<Collection<Snowflake, TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel>>;
public fetch(
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 {
Expand Down Expand Up @@ -2404,6 +2424,8 @@ declare module 'discord.js' {
MAXIMUM_CHANNELS: 30013;
MAXIMUM_ATTACHMENTS: 30015;
MAXIMUM_INVITES: 30016;
MAXIMUM_ANIMATED_EMOJIS: 30018;
MAXIMUM_SERVER_MEMBERS: 30019;
GUILD_ALREADY_HAS_TEMPLATE: 30031;
UNAUTHORIZED: 40001;
ACCOUNT_VERIFICATION_REQUIRED: 40002;
Expand Down

0 comments on commit e0ab836

Please sign in to comment.