Discord.js v13.8.0
This commit is contained in:
March 7th
2022-06-06 11:21:36 +07:00
parent 832bc010c5
commit 305ccaac90
19 changed files with 382 additions and 240 deletions

75
typings/index.d.ts vendored
View File

@@ -443,26 +443,23 @@ export class BaseGuildEmoji extends Emoji {
export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel) {
protected constructor(guild: Guild, data?: RawGuildChannelData, client?: Client, immediatePatch?: boolean);
public defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
public messages: MessageManager;
public rateLimitPerUser: number | null;
public nsfw: boolean;
public threads: ThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
public topic: string | null;
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
public createWebhook(name: string, options?: ChannelWebhookCreateOptions): Promise<Webhook>;
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
public setDefaultAutoArchiveDuration(
defaultAutoArchiveDuration: ThreadAutoArchiveDuration | 'MAX',
reason?: string,
): Promise<this>;
public setNSFW(nsfw?: boolean, reason?: string): Promise<this>;
public setTopic(topic: string | null, reason?: string): Promise<this>;
public setType(type: Pick<typeof ChannelTypes, 'GUILD_TEXT'>, reason?: string): Promise<TextChannel>;
public setType(type: Pick<typeof ChannelTypes, 'GUILD_NEWS'>, reason?: string): Promise<NewsChannel>;
public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
}
export class BaseGuildVoiceChannel extends GuildChannel {
protected constructor(guild: Guild, data?: RawGuildChannelData);
public constructor(guild: Guild, data?: RawGuildChannelData);
public readonly members: Collection<Snowflake, GuildMember>;
public readonly full: boolean;
public readonly joinable: boolean;
@@ -936,9 +933,14 @@ export class DiscordAPIError extends Error {
public requestData: HTTPErrorData;
}
export class DMChannel extends TextBasedChannelMixin(Channel, ['bulkDelete']) {
export class DMChannel extends TextBasedChannelMixin(Channel, [
'bulkDelete',
'fetchWebhooks',
'createWebhook',
'setRateLimitPerUser',
'setNSFW',
]) {
private constructor(client: Client, data?: RawDMChannelData);
public messages: MessageManager;
public recipient: User;
public type: 'DM';
public fetch(force?: boolean): Promise<this>;
@@ -2056,7 +2058,13 @@ export class OAuth2Guild extends BaseGuild {
public permissions: Readonly<Permissions>;
}
export class PartialGroupDMChannel extends TextBasedChannelMixin(Channel, ['bulkDelete']) {
export class PartialGroupDMChannel extends TextBasedChannelMixin(Channel, [
'bulkDelete',
'fetchWebhooks',
'createWebhook',
'setRateLimitPerUser',
'setNSFW',
]) {
private constructor(client: Client, data: RawPartialGroupDMChannelData);
public name: string | null;
public icon: string | null;
@@ -2537,7 +2545,6 @@ export class TextChannel extends BaseGuildTextChannel {
public rateLimitPerUser: number;
public threads: ThreadManager<AllowedThreadTypeForTextChannel>;
public type: 'GUILD_TEXT';
public setRateLimitPerUser(rateLimitPerUser: number, reason?: string): Promise<TextChannel>;
public sendSlash(botID: Snowflake, commandName: string, args?: Options[]): Promise<undefined>;
}
@@ -2563,7 +2570,7 @@ export class TextInputComponent extends BaseMessageComponent {
public static resolveStyle(style: TextInputStyleResolvable): TextInputStyle;
}
export class ThreadChannel extends TextBasedChannelMixin(Channel) {
export class ThreadChannel extends TextBasedChannelMixin(Channel, ['fetchWebhooks', 'createWebhook', 'setNSFW']) {
private constructor(guild: Guild, data?: RawThreadChannelData, client?: Client, fromInteraction?: boolean);
public archived: boolean | null;
public readonly archivedAt: Date | null;
@@ -2585,7 +2592,6 @@ export class ThreadChannel extends TextBasedChannelMixin(Channel) {
public readonly sendable: boolean;
public memberCount: number | null;
public messageCount: number | null;
public messages: MessageManager;
public members: ThreadMemberManager;
public name: string;
public ownerId: Snowflake | null;
@@ -2618,7 +2624,6 @@ export class ThreadChannel extends TextBasedChannelMixin(Channel) {
public setInvitable(invitable?: boolean, reason?: string): Promise<ThreadChannel>;
public setLocked(locked?: boolean, reason?: string): Promise<ThreadChannel>;
public setName(name: string, reason?: string): Promise<ThreadChannel>;
public setRateLimitPerUser(rateLimitPerUser: number, reason?: string): Promise<ThreadChannel>;
}
export class ThreadMember extends Base {
@@ -2777,12 +2782,13 @@ export class Formatters extends null {
public static userMention: typeof userMention;
}
export class VoiceChannel extends BaseGuildVoiceChannel {
export class VoiceChannel extends TextBasedChannelMixin(BaseGuildVoiceChannel, ['lastPinTimestamp', 'lastPinAt']) {
public videoQualityMode: VideoQualityMode | null;
/** @deprecated Use manageable instead */
public readonly editable: boolean;
public readonly speakable: boolean;
public type: 'GUILD_VOICE';
public rateLimitPerUser: number | null;
public setBitrate(bitrate: number, reason?: string): Promise<VoiceChannel>;
public setUserLimit(userLimit: number, reason?: string): Promise<VoiceChannel>;
public setVideoQualityMode(videoQualityMode: VideoQualityMode | number, reason?: string): Promise<VoiceChannel>;
@@ -2914,6 +2920,8 @@ export class WebSocketShard extends EventEmitter {
private eventsAttached: boolean;
private expectedGuilds: Set<Snowflake> | null;
private readyTimeout: NodeJS.Timeout | null;
private closeEmitted: boolean;
private wsCloseTimeout: NodeJS.Timeout | null;
public manager: WebSocketManager;
public id: number;
@@ -2929,6 +2937,7 @@ export class WebSocketShard extends EventEmitter {
private onPacket(packet: unknown): void;
private checkReady(): void;
private setHelloTimeout(time?: number): void;
private setWsCloseTimeout(time?: number): void;
private setHeartbeatTimer(time: number): void;
private sendHeartbeat(): void;
private ackHeartbeat(): void;
@@ -2938,6 +2947,7 @@ export class WebSocketShard extends EventEmitter {
private _send(data: unknown): void;
private processQueue(): void;
private destroy(destroyOptions?: { closeCode?: number; reset?: boolean; emit?: boolean; log?: boolean }): void;
private emitClose(event?: CloseEvent): void;
private _cleanupConnection(): void;
private _emitDestroyed(): void;
@@ -3089,9 +3099,12 @@ export const Constants: {
};
WSCodes: {
1000: 'WS_CLOSE_REQUESTED';
1011: 'INTERNAL_ERROR';
4004: 'TOKEN_INVALID';
4010: 'SHARDING_INVALID';
4011: 'SHARDING_REQUIRED';
4013: 'INVALID_INTENTS';
4014: 'DISALLOWED_INTENTS';
};
Events: ConstantsEvents;
ShardEvents: ConstantsShardEvents;
@@ -3679,6 +3692,7 @@ export interface TextBasedChannelFields extends PartialTextBasedChannelFields {
readonly lastMessage: Message | null;
lastPinTimestamp: number | null;
readonly lastPinAt: Date | null;
messages: MessageManager;
awaitMessageComponent<T extends MessageComponentTypeResolvable = 'ACTION_ROW'>(
options?: AwaitMessageCollectorOptionsParams<T, true>,
): Promise<MappedInteractionTypes[T]>;
@@ -3691,6 +3705,10 @@ export interface TextBasedChannelFields extends PartialTextBasedChannelFields {
options?: MessageChannelCollectorOptionsParams<T, true>,
): InteractionCollector<MappedInteractionTypes[T]>;
createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
createWebhook(name: string, options?: ChannelWebhookCreateOptions): Promise<Webhook>;
setRateLimitPerUser(rateLimitPerUser: number, reason?: string): Promise<this>;
setNSFW(nsfw?: boolean, reason?: string): Promise<this>;
fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
sendTyping(): Promise<void>;
}
@@ -4017,7 +4035,7 @@ export interface ClientEvents extends BaseClientEvents {
userUpdate: [oldUser: User | PartialUser, newUser: User];
userSettingsUpdate: [setting: RawUserSettingsData];
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
webhookUpdate: [channel: TextChannel | NewsChannel];
webhookUpdate: [channel: TextChannel | NewsChannel | VoiceChannel];
/** @deprecated Use interactionCreate instead */
interaction: [interaction: Interaction];
interactionCreate: [interaction: Interaction | { nonce: Snowflake; id: Snowflake }];
@@ -4192,6 +4210,7 @@ export interface RawUserSettingsData {
export interface ClientOptions {
shards?: number | number[] | 'auto';
shardCount?: number;
closeTimeout?: number;
makeCache?: CacheFactory;
/** @deprecated Pass the value of this property as `lifetime` to `sweepers.messages` instead. */
messageCacheLifetime?: number;
@@ -4596,34 +4615,6 @@ export interface ClientFetchInviteOptions {
guildScheduledEventId?: Snowflake;
}
export interface ClientOptions {
shards?: number | number[] | 'auto';
shardCount?: number;
makeCache?: CacheFactory;
/** @deprecated Pass the value of this property as `lifetime` to `sweepers.messages` instead. */
messageCacheLifetime?: number;
/** @deprecated Pass the value of this property as `interval` to `sweepers.messages` instead. */
messageSweepInterval?: number;
allowedMentions?: MessageMentionOptions;
invalidRequestWarningInterval?: number;
partials?: PartialTypes[];
restWsBridgeTimeout?: number;
restTimeOffset?: number;
restRequestTimeout?: number;
restGlobalRateLimit?: number;
restSweepInterval?: number;
retryLimit?: number;
failIfNotExists?: boolean;
userAgentSuffix?: string[];
presence?: PresenceData;
intents?: BitFieldResolvable<IntentsString, number>;
waitGuildTimeout?: number;
sweepers?: SweeperOptions;
ws?: WebSocketOptions;
http?: HTTPOptions;
rejectOnRateLimit?: string[] | ((data: RateLimitData) => boolean | Promise<boolean>);
}
export type ClientPresenceStatus = 'online' | 'idle' | 'dnd';
export interface ClientPresenceStatusData {