Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(options): Gateway Options #1426

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 42 additions & 9 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ declare namespace Eris {
type GuildTextChannelTypes = Constants["ChannelTypes"][keyof Pick<Constants["ChannelTypes"], "GUILD_TEXT" | "GUILD_NEWS">];
type GuildThreadChannelTypes = Constants["ChannelTypes"][keyof Pick<Constants["ChannelTypes"], "GUILD_NEWS_THREAD" | "GUILD_PRIVATE_THREAD" | "GUILD_PUBLIC_THREAD">];
type GuildPublicThreadChannelTypes = Exclude<GuildThreadChannelTypes, Constants["ChannelTypes"]["GUILD_PRIVATE_THREAD"]>;
type GuildVoiceChannelTypes = Constants["ChannelTypes"][keyof Pick<Constants["ChannelTypes"], "GUILD_VOICE" | "GUILD_STAGE_VOICE">];
type PrivateChannelTypes = Constants["ChannelTypes"][keyof Pick<Constants["ChannelTypes"], "DM" | "GROUP_DM">];
type TextVoiceChannelTypes = Constants["ChannelTypes"][keyof Pick<Constants["ChannelTypes"], "GUILD_VOICE" | "GUILD_STAGE">];
type TextVoiceChannelTypes = Constants["ChannelTypes"][keyof Pick<Constants["ChannelTypes"], "GUILD_VOICE">];

// Command
type CommandGenerator = CommandGeneratorFunction | MessageContent | MessageContent[] | CommandGeneratorFunction[];
Expand Down Expand Up @@ -384,33 +385,48 @@ declare namespace Eris {
/** @deprecated */
agent?: HTTPSAgent;
allowedMentions?: AllowedMentions;
/** @deprecated */
autoreconnect?: boolean;
/** @deprecated */
compress?: boolean;
/** @deprecated */
connectionTimeout?: number;
defaultImageFormat?: string;
defaultImageSize?: number;
disableEvents?: { [s: string]: boolean };
/** @deprecated */
disableEvents?: Record<string, boolean>;
/** @deprecated */
firstShardID?: number;
gateway?: GatewayOptions;
/** @deprecated */
getAllUsers?: boolean;
/** @deprecated */
guildCreateTimeout?: number;
intents: number | (IntentStrings | number)[];
/** @deprecated */
intents?: number | (IntentStrings | number)[];
/** @deprecated */
largeThreshold?: number;
/** @deprecated */
lastShardID?: number;
/** @deprecated */
latencyThreshold?: number;
/** @deprecated */
maxReconnectAttempts?: number;
/** @deprecated */
maxResumeAttempts?: number;
/** @deprecated */
maxShards?: number | "auto";
messageLimit?: number;
opusOnly?: boolean;
/** @deprecated */
ratelimiterOffset?: number;
/** @deprecated */
reconnectDelay?: ReconnectDelayFunction;
requestTimeout?: number;
rest?: RequestHandlerOptions;
restMode?: boolean;
/** @deprecated */
seedVoiceConnections?: boolean;
shardConcurrency?: number | "auto";
ws?: unknown;
}
interface CommandClientOptions {
Expand Down Expand Up @@ -823,6 +839,24 @@ declare namespace Eris {
}

// Gateway/REST
interface GatewayOptions {
autoreconnect?: boolean;
compress?: boolean;
connectionTimeout?: number;
disableEvents?: Record<string, boolean>;
firstShardID?: number;
getAllUsers?: boolean;
guildCreateTimeout?: number;
intents?: number | (IntentStrings | number)[];
largeThreshold?: number;
lastShardID?: number;
maxReconnectAttempts?: number;
maxResumeAttempts?: number;
maxConcurrency?: number | "auto";
maxShards?: number | "auto";
reconnectDelay?: ReconnectDelayFunction;
seedVoiceConnections?: boolean;
}
interface HTTPResponse {
code: number;
message: string;
Expand Down Expand Up @@ -856,9 +890,6 @@ declare namespace Eris {
res: (value: Member[]) => void;
timeout: NodeJS.Timeout;
}
interface ShardManagerOptions {
concurrency?: number | "auto";
}

// Guild
interface CreateGuildOptions {
Expand Down Expand Up @@ -3538,7 +3569,9 @@ declare namespace Eris {
buckets: Map<number, number>;
connectQueue: Shard[];
connectTimeout: NodeJS.Timer | null;
constructor(client: Client, options: ShardManagerOptions);
lastConnect: number;
options: GatewayOptions;
constructor(client: Client, options?: GatewayOptions);
connect(shard: Shard): void;
spawn(id: number): void;
tryConnect(): void;
Expand Down Expand Up @@ -3738,7 +3771,7 @@ declare namespace Eris {
export class VoiceChannel extends GuildChannel implements Invitable {
bitrate: number;
rtcRegion: string | null;
type: TextVoiceChannelTypes;
type: GuildVoiceChannelTypes;
userLimit: number;
videoQualityMode: VideoQualityMode;
voiceMembers: Collection<Member>;
Expand Down
Loading