style: order typings alphabetically

This commit is contained in:
NotSugden
2020-02-26 23:06:54 +00:00
parent 2a36dff43a
commit 0080f5dbc7

467
typings/index.d.ts vendored
View File

@@ -244,17 +244,6 @@ declare module 'discord.js' {
public once(event: string, listener: (...args: any[]) => void): this;
}
export class ClientVoiceManager {
constructor(client: Client);
public readonly client: Client;
public connections: Collection<Snowflake, VoiceConnection>;
public broadcasts: VoiceBroadcast[];
private joinChannel(channel: VoiceChannel): Promise<VoiceConnection>;
public createBroadcast(): VoiceBroadcast;
}
export class ClientApplication extends Base {
constructor(client: Client, data: object);
public botPublic: boolean | null;
@@ -275,34 +264,6 @@ declare module 'discord.js' {
public toString(): string;
}
export class Team extends Base {
constructor(client: Client, data: object);
public id: Snowflake;
public name: string;
public icon: string | null;
public ownerID: Snowflake | null;
public members: Collection<Snowflake, TeamMember>;
public readonly owner: TeamMember;
public readonly createdAt: Date;
public readonly createdTimestamp: number;
public iconURL(options?: ImageURLOptions): string;
public toJSON(): object;
public toString(): string;
}
export class TeamMember extends Base {
constructor(team: Team, data: object);
public team: Team;
public readonly id: Snowflake;
public permissions: string[];
public membershipState: MembershipStates;
public user: User;
public toString(): string;
}
export class ClientUser extends User {
public mfaEnabled: boolean;
public verified: boolean;
@@ -315,6 +276,17 @@ declare module 'discord.js' {
public setUsername(username: string): Promise<ClientUser>;
}
export class ClientVoiceManager {
constructor(client: Client);
public readonly client: Client;
public connections: Collection<Snowflake, VoiceConnection>;
public broadcasts: VoiceBroadcast[];
private joinChannel(channel: VoiceChannel): Promise<VoiceConnection>;
public createBroadcast(): VoiceBroadcast;
}
export abstract class Collector<K, V> extends EventEmitter {
constructor(client: Client, filter: CollectorFilter, options?: CollectorOptions);
private _timeout: NodeJS.Timer | null;
@@ -822,18 +794,6 @@ declare module 'discord.js' {
public updateOverwrite(userOrRole: RoleResolvable | UserResolvable, options: PermissionOverwriteOption, reason?: string): Promise<this>;
}
export class StoreChannel extends GuildChannel {
constructor(guild: Guild, data?: object);
public nsfw: boolean;
}
export class PartialGroupDMChannel extends Channel {
constructor(client: Client, data: object);
public name: string;
public icon: string | null;
public iconURL(options?: ImageURLOptions): string | null;
}
export class GuildEmoji extends Emoji {
constructor(client: Client, data: object, guild: Guild);
private _roles: string[];
@@ -889,6 +849,14 @@ declare module 'discord.js' {
public valueOf(): string;
}
export class HTTPError extends Error {
constructor(message: string, name: string, code: number, method: string, path: string);
public code: number;
public method: string;
public name: string;
public path: string;
}
export class Integration extends Base {
constructor(client: Client, data: object, guild: Guild);
public account: IntegrationAccount;
@@ -908,14 +876,6 @@ declare module 'discord.js' {
public sync(): Promise<Integration>;
}
export class HTTPError extends Error {
constructor(message: string, name: string, code: number, method: string, path: string);
public code: number;
public method: string;
public name: string;
public path: string;
}
export class Invite extends Base {
constructor(client: Client, data: object);
public channel: GuildChannel | PartialGroupDMChannel;
@@ -941,11 +901,6 @@ declare module 'discord.js' {
public toString(): string;
}
export class MessageFlags extends BitField<MessageFlagsString> {
public static FLAGS: Record<MessageFlagsString, number>;
public static resolve(bit?: BitFieldResolvable<MessageFlagsString>): number;
}
export class Message extends Base {
constructor(client: Client, data: object, channel: TextChannel | DMChannel);
private _edits: Message[];
@@ -1071,6 +1026,11 @@ declare module 'discord.js' {
public static normalizeFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): Required<EmbedFieldData>[];
}
export class MessageFlags extends BitField<MessageFlagsString> {
public static FLAGS: Record<MessageFlagsString, number>;
public static resolve(bit?: BitFieldResolvable<MessageFlagsString>): number;
}
export class MessageMentions {
constructor(message: Message, users: object[] | Collection<Snowflake, User>, roles: Snowflake[] | Collection<Snowflake, Role>, everyone: boolean);
private _channels: Collection<Snowflake, GuildChannel> | null;
@@ -1113,6 +1073,23 @@ declare module 'discord.js' {
public toJSON(): object;
}
export class NewsChannel extends TextBasedChannel(GuildChannel) {
constructor(guild: Guild, data?: object);
public messages: MessageManager;
public nsfw: boolean;
public topic: string | null;
public createWebhook(name: string, options?: { avatar?: BufferResolvable | Base64Resolvable; reason?: string; }): Promise<Webhook>;
public setNSFW(nsfw: boolean, reason?: string): Promise<NewsChannel>;
public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
}
export class PartialGroupDMChannel extends Channel {
constructor(client: Client, data: object);
public name: string;
public icon: string | null;
public iconURL(options?: ImageURLOptions): string | null;
}
export class PermissionOverwrites {
constructor(guildChannel: GuildChannel, data?: object);
public allow: Readonly<Permissions>;
@@ -1320,7 +1297,15 @@ declare module 'discord.js' {
public static generate(timestamp?: number | Date): Snowflake;
}
function VolumeMixin<T>(base: Constructable<T>): Constructable<T & VolumeInterface>;
export class Speaking extends BitField<SpeakingString> {
public static FLAGS: Record<SpeakingString, number>;
public static resolve(bit?: BitFieldResolvable<SpeakingString>): number;
}
export class StoreChannel extends GuildChannel {
constructor(guild: Guild, data?: object);
public nsfw: boolean;
}
class StreamDispatcher extends VolumeMixin(Writable) {
constructor(player: object, options?: StreamOptions, streams?: object);
@@ -1356,11 +1341,6 @@ declare module 'discord.js' {
public once(event: string, listener: (...args: any[]) => void): this;
}
export class Speaking extends BitField<SpeakingString> {
public static FLAGS: Record<SpeakingString, number>;
public static resolve(bit?: BitFieldResolvable<SpeakingString>): number;
}
export class Structures {
public static get<K extends keyof Extendable>(structure: K): Extendable[K];
public static get(structure: string): (...args: any[]) => void;
@@ -1373,6 +1353,34 @@ declare module 'discord.js' {
public static resolve(bit?: BitFieldResolvable<SystemChannelFlagsString>): number;
}
export class Team extends Base {
constructor(client: Client, data: object);
public id: Snowflake;
public name: string;
public icon: string | null;
public ownerID: Snowflake | null;
public members: Collection<Snowflake, TeamMember>;
public readonly owner: TeamMember;
public readonly createdAt: Date;
public readonly createdTimestamp: number;
public iconURL(options?: ImageURLOptions): string;
public toJSON(): object;
public toString(): string;
}
export class TeamMember extends Base {
constructor(team: Team, data: object);
public team: Team;
public readonly id: Snowflake;
public permissions: string[];
public membershipState: MembershipStates;
public user: User;
public toString(): string;
}
export class TextChannel extends TextBasedChannel(GuildChannel) {
constructor(guild: Guild, data?: object);
public messages: MessageManager;
@@ -1385,16 +1393,6 @@ declare module 'discord.js' {
public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
}
export class NewsChannel extends TextBasedChannel(GuildChannel) {
constructor(guild: Guild, data?: object);
public messages: MessageManager;
public nsfw: boolean;
public topic: string | null;
public createWebhook(name: string, options?: { avatar?: BufferResolvable | Base64Resolvable; reason?: string; }): Promise<Webhook>;
public setNSFW(nsfw: boolean, reason?: string): Promise<NewsChannel>;
public fetchWebhooks(): Promise<Collection<Snowflake, Webhook>>;
}
export class User extends PartialTextBasedChannel(Base) {
constructor(client: Client, data: object);
public avatar: string | null;
@@ -1746,6 +1744,22 @@ declare module 'discord.js' {
public resolveID(resolvable: R): K | null;
}
export class GuildChannelManager extends BaseManager<Snowflake, GuildChannel, GuildChannelResolvable> {
constructor(guild: Guild, iterable?: Iterable<any>);
public guild: Guild;
public create(name: string, options: GuildCreateChannelOptions & { type: 'voice'; }): Promise<VoiceChannel>;
public create(name: string, options: GuildCreateChannelOptions & { type: 'category'; }): Promise<CategoryChannel>;
public create(name: string, options?: GuildCreateChannelOptions & { type?: 'text'; }): Promise<TextChannel>;
public create(name: string, options: GuildCreateChannelOptions): Promise<TextChannel | VoiceChannel | CategoryChannel>;
}
export class GuildEmojiManager extends BaseManager<Snowflake, GuildEmoji, EmojiResolvable> {
constructor(guild: Guild, iterable?: Iterable<any>);
public guild: Guild;
public create(attachment: BufferResolvable | Base64Resolvable, name: string, options?: GuildEmojiCreateOptions): Promise<GuildEmoji>;
public resolveIdentifier(emoji: EmojiIdentifierResolvable): string | null;
}
export class GuildEmojiRoleManager {
constructor(emoji: GuildEmoji);
public emoji: GuildEmoji;
@@ -1756,26 +1770,20 @@ declare module 'discord.js' {
public remove(roleOrRoles: RoleResolvable | RoleResolvable[] | Collection<Snowflake, Role>): Promise<GuildEmoji>;
}
export class GuildEmojiManager extends BaseManager<Snowflake, GuildEmoji, EmojiResolvable> {
constructor(guild: Guild, iterable?: Iterable<any>);
public guild: Guild;
public create(attachment: BufferResolvable | Base64Resolvable, name: string, options?: GuildEmojiCreateOptions): Promise<GuildEmoji>;
public resolveIdentifier(emoji: EmojiIdentifierResolvable): string | null;
export class GuildManager extends BaseManager<Snowflake, Guild, GuildResolvable> {
constructor(client: Client, iterable?: Iterable<any>);
public create(name: string, options?: { region?: string; icon: BufferResolvable | Base64Resolvable | null; }): Promise<Guild>;
}
export class GuildChannelManager extends BaseManager<Snowflake, GuildChannel, GuildChannelResolvable> {
export class GuildMemberManager extends BaseManager<Snowflake, GuildMember, GuildMemberResolvable> {
constructor(guild: Guild, iterable?: Iterable<any>);
public guild: Guild;
public create(name: string, options: GuildCreateChannelOptions & { type: 'voice'; }): Promise<VoiceChannel>;
public create(name: string, options: GuildCreateChannelOptions & { type: 'category'; }): Promise<CategoryChannel>;
public create(name: string, options?: GuildCreateChannelOptions & { type?: 'text'; }): Promise<TextChannel>;
public create(name: string, options: GuildCreateChannelOptions): Promise<TextChannel | VoiceChannel | CategoryChannel>;
}
// Hacky workaround because changing the signature of an overridden method errors
class OverridableManager<V, K, R = any> extends BaseManager<V, K, R> {
public add(data: any, cache: any): any;
public set(key: any): any;
public ban(user: UserResolvable, options?: BanOptions): Promise<GuildMember | User | Snowflake>;
public fetch(options: UserResolvable | FetchMemberOptions): Promise<GuildMember>;
public fetch(options?: FetchMembersOptions): Promise<Collection<Snowflake, GuildMember>>;
public prune(options: GuildPruneMembersOptions & { dry?: false; count: false; }): Promise<null>;
public prune(options?: GuildPruneMembersOptions): Promise<number>;
public unban(user: UserResolvable, reason?: string): Promise<User>;
}
export class GuildMemberRoleManager extends OverridableManager<Snowflake, Role, RoleResolvable> {
@@ -1791,22 +1799,6 @@ declare module 'discord.js' {
public remove(roleOrRoles: RoleResolvable | RoleResolvable[] | Collection<Snowflake, Role>, reason?: string): Promise<GuildMember>;
}
export class GuildMemberManager extends BaseManager<Snowflake, GuildMember, GuildMemberResolvable> {
constructor(guild: Guild, iterable?: Iterable<any>);
public guild: Guild;
public ban(user: UserResolvable, options?: BanOptions): Promise<GuildMember | User | Snowflake>;
public fetch(options: UserResolvable | FetchMemberOptions): Promise<GuildMember>;
public fetch(options?: FetchMembersOptions): Promise<Collection<Snowflake, GuildMember>>;
public prune(options: GuildPruneMembersOptions & { dry?: false; count: false; }): Promise<null>;
public prune(options?: GuildPruneMembersOptions): Promise<number>;
public unban(user: UserResolvable, reason?: string): Promise<User>;
}
export class GuildManager extends BaseManager<Snowflake, Guild, GuildResolvable> {
constructor(client: Client, iterable?: Iterable<any>);
public create(name: string, options?: { region?: string; icon: BufferResolvable | Base64Resolvable | null; }): Promise<Guild>;
}
export class MessageManager extends BaseManager<Snowflake, Message, MessageResolvable> {
constructor(channel: TextChannel | DMChannel, iterable?: Iterable<any>);
public channel: TextBasedChannelFields;
@@ -1817,6 +1809,12 @@ declare module 'discord.js' {
public delete(message: MessageResolvable, reason?: string): Promise<void>;
}
// Hacky workaround because changing the signature of an overridden method errors
class OverridableManager<V, K, R = any> extends BaseManager<V, K, R> {
public add(data: any, cache: any): any;
public set(key: any): any;
}
export class PresenceManager extends BaseManager<Snowflake, Presence, PresenceResolvable> {
constructor(client: Client, iterable?: Iterable<any>);
}
@@ -1891,6 +1889,8 @@ declare module 'discord.js' {
function WebhookMixin<T>(Base?: Constructable<T>): Constructable<T & WebhookFields>;
function VolumeMixin<T>(base: Constructable<T>): Constructable<T & VolumeInterface>;
interface WebhookFields {
readonly client: Client;
id: Snowflake;
@@ -1930,11 +1930,13 @@ declare module 'discord.js' {
| 'WATCHING'
| 'CUSTOM_STATUS';
type MessageFlagsString = 'CROSSPOSTED'
| 'IS_CROSSPOST'
| 'SUPPRESS_EMBEDS'
| 'SOURCE_MESSAGE_DELETED'
| 'URGENT';
interface AddGuildMemberOptions {
accessToken: string;
nick?: string;
roles?: Collection<Snowflake, Role> | RoleResolvable[];
mute?: boolean;
deaf?: boolean;
}
interface APIErrror {
UNKNOWN_ACCOUNT: number;
@@ -1983,25 +1985,12 @@ declare module 'discord.js' {
REACTION_BLOCKED: number;
}
interface AddGuildMemberOptions {
accessToken: string;
nick?: string;
roles?: Collection<Snowflake, Role> | RoleResolvable[];
mute?: boolean;
deaf?: boolean;
}
interface AuditLogChange {
key: string;
old?: any;
new?: any;
}
interface ImageURLOptions {
format?: ImageExt;
size?: ImageSize;
}
interface AwaitMessagesOptions extends MessageCollectorOptions {
errors?: string[];
}
@@ -2082,6 +2071,21 @@ declare module 'discord.js' {
http?: HTTPOptions;
}
type ClientPresenceStatus = 'online' | 'idle' | 'dnd';
interface ClientPresenceStatusData {
web?: ClientPresenceStatus;
mobile?: ClientPresenceStatus;
desktop?: ClientPresenceStatus;
}
interface CloseEvent {
wasClean: boolean;
code: number;
reason: string;
target: WebSocket;
}
type CollectorFilter = (...args: any[]) => boolean;
interface CollectorOptions {
@@ -2120,6 +2124,13 @@ declare module 'discord.js' {
| number
| string;
interface CrosspostedChannel {
channelID: Snowflake;
guildID: Snowflake;
type: keyof typeof ChannelType;
name: string;
}
interface DeconstructedSnowflake {
timestamp: number;
readonly date: Date;
@@ -2131,11 +2142,6 @@ declare module 'discord.js' {
type DefaultMessageNotifications = 'ALL' | 'MENTIONS';
interface GuildEmojiEditData {
name?: string;
roles?: Collection<Snowflake, Role> | RoleResolvable[];
}
interface EmbedField {
name: string;
value: string;
@@ -2152,6 +2158,25 @@ declare module 'discord.js' {
type EmojiResolvable = Snowflake | GuildEmoji | ReactionEmoji;
interface ErrorEvent {
error: any;
message: string;
type: string;
target: WebSocket;
}
interface EscapeMarkdownOptions {
codeBlock?: boolean;
inlineCode?: boolean;
bold?: boolean;
italic?: boolean;
underline?: boolean;
strikethrough?: boolean;
spoiler?: boolean;
inlineCodeContent?: boolean;
codeBlockContent?: boolean;
}
interface Extendable {
GuildEmoji: typeof GuildEmoji;
DMChannel: typeof DMChannel;
@@ -2185,17 +2210,6 @@ declare module 'discord.js' {
name?: string;
}
interface MessageActivity {
partyID: string;
type: number;
}
interface MessageReference {
channelID: string;
guildID: string;
messageID: string | null;
}
type GuildAuditLogsAction = keyof GuildAuditLogsActions;
interface GuildAuditLogsActions {
@@ -2284,11 +2298,6 @@ declare module 'discord.js' {
name?: string;
}
interface GuildEmojiCreateOptions {
roles?: Collection<Snowflake, Role> | RoleResolvable[];
reason?: string;
}
interface GuildEditData {
name?: string;
region?: string;
@@ -2310,6 +2319,16 @@ declare module 'discord.js' {
channel: GuildChannelResolvable | null;
}
interface GuildEmojiCreateOptions {
roles?: Collection<Snowflake, Role> | RoleResolvable[];
reason?: string;
}
interface GuildEmojiEditData {
name?: string;
roles?: Collection<Snowflake, Role> | RoleResolvable[];
}
type GuildFeatures = 'ANIMATED_ICON'
| 'BANNER'
| 'COMMERCE'
@@ -2364,6 +2383,11 @@ declare module 'discord.js' {
| 1024
| 2048;
interface ImageURLOptions {
format?: ImageExt;
size?: ImageSize;
}
interface IntegrationData {
id: string;
type: string;
@@ -2392,13 +2416,18 @@ declare module 'discord.js' {
type MembershipStates = 'INVITED'
| 'ACCEPTED';
type MessageAdditions = MessageEmbed | MessageAttachment | (MessageEmbed | MessageAttachment)[];
interface MessageActivity {
partyID: string;
type: number;
}
interface MessageCollectorOptions extends CollectorOptions {
max?: number;
maxProcessed?: number;
}
type MessageAdditions = MessageEmbed | MessageAttachment | (MessageEmbed | MessageAttachment)[];
interface MessageEditOptions {
content?: string;
embed?: MessageEmbedOptions | null;
@@ -2406,6 +2435,26 @@ declare module 'discord.js' {
flags?: BitFieldResolvable<MessageFlagsString>;
}
interface MessageEmbedAuthor {
name?: string;
url?: string;
iconURL?: string;
proxyIconURL?: string;
}
interface MessageEmbedFooter {
text?: string;
iconURL?: string;
proxyIconURL?: string;
}
interface MessageEmbedImage {
url: string;
proxyURL?: string;
height?: number;
width?: number;
}
interface MessageEmbedOptions {
title?: string;
description?: string;
@@ -2421,11 +2470,9 @@ declare module 'discord.js' {
footer?: Partial<MessageEmbedFooter> & { icon_url?: string; proxy_icon_url?: string; };
}
interface MessageEmbedAuthor {
name?: string;
url?: string;
iconURL?: string;
proxyIconURL?: string;
interface MessageEmbedProvider {
name: string;
url: string;
}
interface MessageEmbedThumbnail {
@@ -2435,24 +2482,6 @@ declare module 'discord.js' {
width?: number;
}
interface MessageEmbedFooter {
text?: string;
iconURL?: string;
proxyIconURL?: string;
}
interface MessageEmbedImage {
url: string;
proxyURL?: string;
height?: number;
width?: number;
}
interface MessageEmbedProvider {
name: string;
url: string;
}
interface MessageEmbedVideo {
url?: string;
proxyURL?: string;
@@ -2460,6 +2489,18 @@ declare module 'discord.js' {
width?: number;
}
interface MessageEvent {
data: WebSocket.Data;
type: string;
target: WebSocket;
}
type MessageFlagsString = 'CROSSPOSTED'
| 'IS_CROSSPOST'
| 'SUPPRESS_EMBEDS'
| 'SOURCE_MESSAGE_DELETED'
| 'URGENT';
interface MessageOptions {
tts?: boolean;
nonce?: string;
@@ -2474,6 +2515,12 @@ declare module 'discord.js' {
type MessageReactionResolvable = MessageReaction | Snowflake;
interface MessageReference {
channelID: string;
guildID: string;
messageID: string | null;
}
type MessageResolvable = Message | Snowflake;
type MessageTarget = TextChannel | DMChannel | User | GuildMember | Webhook | WebhookClient;
@@ -2511,6 +2558,8 @@ declare module 'discord.js' {
interface PermissionOverwriteOption extends Partial<Record<PermissionString, boolean | null>> { }
type PermissionResolvable = BitFieldResolvable<PermissionString>;
type PermissionString = 'CREATE_INSTANT_INVITE'
| 'KICK_MEMBERS'
| 'BAN_MEMBERS'
@@ -2544,8 +2593,6 @@ declare module 'discord.js' {
interface RecursiveArray<T> extends Array<T | RecursiveArray<T>> { }
type PermissionResolvable = BitFieldResolvable<PermissionString>;
interface PermissionOverwriteOptions {
allow: PermissionResolvable;
deny: PermissionResolvable;
@@ -2567,20 +2614,6 @@ declare module 'discord.js' {
type PresenceResolvable = Presence | UserResolvable | Snowflake;
type ClientPresenceStatus = 'online' | 'idle' | 'dnd';
interface ClientPresenceStatusData {
web?: ClientPresenceStatus;
mobile?: ClientPresenceStatus;
desktop?: ClientPresenceStatus;
}
type PartialTypes = 'USER'
| 'CHANNEL'
| 'GUILD_MEMBER'
| 'MESSAGE'
| 'REACTION';
type Partialize<T> = {
id: string;
partial: true;
@@ -2589,11 +2622,17 @@ declare module 'discord.js' {
[K in keyof Omit<T, 'id' | 'partial'>]: T[K] | null;
};
interface PartialMessage extends Partialize<Message> {}
interface PartialChannel extends Partialize<Channel> {}
interface PartialGuildMember extends Partialize<GuildMember> {}
interface PartialMessage extends Partialize<Message> {}
interface PartialUser extends Partialize<User> {}
type PartialTypes = 'USER'
| 'CHANNEL'
| 'GUILD_MEMBER'
| 'MESSAGE'
| 'REACTION';
type PresenceStatus = ClientPresenceStatus | 'offline';
type PresenceStatusData = ClientPresenceStatus | 'invisible';
@@ -2741,47 +2780,7 @@ declare module 'discord.js' {
| 'PRESENCE_UPDATE'
| 'TYPING_START'
| 'VOICE_STATE_UPDATE'
| 'VOICE_SERVER_UPDATE'
| 'WEBHOOKS_UPDATE';
interface MessageEvent {
data: WebSocket.Data;
type: string;
target: WebSocket;
}
interface CloseEvent {
wasClean: boolean;
code: number;
reason: string;
target: WebSocket;
}
interface ErrorEvent {
error: any;
message: string;
type: string;
target: WebSocket;
}
interface CrosspostedChannel {
channelID: Snowflake;
guildID: Snowflake;
type: keyof typeof ChannelType;
name: string;
}
interface EscapeMarkdownOptions {
codeBlock?: boolean;
inlineCode?: boolean;
bold?: boolean;
italic?: boolean;
underline?: boolean;
strikethrough?: boolean;
spoiler?: boolean;
inlineCodeContent?: boolean;
codeBlockContent?: boolean;
}
| 'VOICE_SERVER_UPDATE';
//#endregion
}