From 335d39177a7f250cf1594bc667e9b9de87eb3b37 Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Sat, 30 Nov 2019 14:30:48 -0600 Subject: [PATCH 1/3] channel type numbers --- index.d.ts | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/index.d.ts b/index.d.ts index 489286a64..aced9f50a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -286,17 +286,17 @@ declare namespace Eris { USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2: 10; USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3: 11; CHANNEL_FOLLOW_ADD: 12; - }; - ChannelTypes: { - GUILD_TEXT: 0; - DM: 1; - GUILD_VOICE: 2; - GROUP_DM: 3; - GUILD_CATEGORY: 4; - GUILD_NEWS: 5; - GUILD_STORE: 6; - }; -} + }; + ChannelTypes: { + GUILD_TEXT: 0; + DM: 1; + GUILD_VOICE: 2; + GROUP_DM: 3; + GUILD_CATEGORY: 4; + GUILD_NEWS: 5; + GUILD_STORE: 6; + }; + } export const Constants: Constants; @@ -1144,9 +1144,9 @@ declare namespace Eris { } export class Channel extends Base { + type: 0 | 1 | 2 | 3 | 4 | 5 | 6; id: string; mention: string; - type: number; createdAt: number; constructor(data: BaseData); static from(data: object, client: Client): AnyChannel; @@ -1159,6 +1159,7 @@ declare namespace Eris { } export class GroupChannel extends PrivateChannel { + type: 3; recipients: Collection; name: string; icon?: string; @@ -1275,6 +1276,7 @@ declare namespace Eris { } export class GuildChannel extends Channel { + type: 0 | 2 | 4 | 5 | 6; guild: Guild; parentID?: string; name: string; @@ -1310,18 +1312,23 @@ declare namespace Eris { } export class CategoryChannel extends GuildChannel { + type: 4; channels: Collection; } - // Intentionally left empty as it has no unique properties from GuildChannel - export class StoreChannel extends GuildChannel {} + // Intentionally left mostly empty as it has no other unique properties from GuildChannel + export class StoreChannel extends GuildChannel { + type: 6; + } // News channel rate limit is always 0 export class NewsChannel extends TextChannel { + type: 5; rateLimitPerUser: 0; } export class TextChannel extends GuildChannel implements Textable, Invitable { + type: 0 | 5; topic?: string; lastMessageID: string; rateLimitPerUser: number; @@ -1357,6 +1364,7 @@ declare namespace Eris { } export class VoiceChannel extends GuildChannel implements Invitable { + type: 2; bitrate?: number; userLimit?: number; voiceMembers?: Collection; @@ -1524,6 +1532,7 @@ declare namespace Eris { } export class PrivateChannel extends Channel implements Textable { + type: 1 | 3; lastMessageID: string; recipient: User; messages: Collection; From 3269b6c9f812598ccaaa8407b163252dd7d9b08b Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Sat, 30 Nov 2019 15:09:10 -0600 Subject: [PATCH 2/3] separate classes --- index.d.ts | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/index.d.ts b/index.d.ts index aced9f50a..0808154bb 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1144,9 +1144,9 @@ declare namespace Eris { } export class Channel extends Base { - type: 0 | 1 | 2 | 3 | 4 | 5 | 6; id: string; mention: string; + type: 0 | 1 | 2 | 3 | 4 | 5 | 6; createdAt: number; constructor(data: BaseData); static from(data: object, client: Client): AnyChannel; @@ -1158,7 +1158,7 @@ declare namespace Eris { mfaEnabled: boolean; } - export class GroupChannel extends PrivateChannel { + export class GroupChannel extends PrivateTextableChannel { type: 3; recipients: Collection; name: string; @@ -1311,30 +1311,13 @@ declare namespace Eris { deletePermission(overwriteID: string, reason?: string): Promise; } - export class CategoryChannel extends GuildChannel { - type: 4; - channels: Collection; - } - - // Intentionally left mostly empty as it has no other unique properties from GuildChannel - export class StoreChannel extends GuildChannel { - type: 6; - } - - // News channel rate limit is always 0 - export class NewsChannel extends TextChannel { - type: 5; - rateLimitPerUser: 0; - } - - export class TextChannel extends GuildChannel implements Textable, Invitable { + export class GuildTextableChannel extends GuildChannel implements Textable, Invitable { type: 0 | 5; topic?: string; lastMessageID: string; rateLimitPerUser: number; messages: Collection; lastPinTimestamp?: number; - constructor(data: BaseData, guild: Guild, messageLimit: number); getInvites(): Promise; createInvite(options?: CreateInviteOptions, reason?: string): Promise; getWebhooks(): Promise; @@ -1363,6 +1346,27 @@ declare namespace Eris { unsendMessage(messageID: string): Promise; } + export class CategoryChannel extends GuildChannel { + type: 4; + channels: Collection; + } + + // Intentionally left mostly empty as it has no other unique properties from GuildChannel + export class StoreChannel extends GuildChannel { + type: 6; + } + + // News channel rate limit is always 0 + export class NewsChannel extends GuildTextableChannel implements Invitable, Textable { + type: 5; + rateLimitPerUser: 0; + } + + export class TextChannel extends GuildTextableChannel implements Invitable, Textable { + type: 0; + constructor(data: BaseData, guild: Guild, messageLimit: number); + } + export class VoiceChannel extends GuildChannel implements Invitable { type: 2; bitrate?: number; @@ -1531,7 +1535,7 @@ declare namespace Eris { constructor(data: { allow: number; deny: number }); } - export class PrivateChannel extends Channel implements Textable { + export class PrivateTextableChannel extends Channel implements Textable { type: 1 | 3; lastMessageID: string; recipient: User; @@ -1560,6 +1564,9 @@ declare namespace Eris { deleteMessage(messageID: string, reason?: string): Promise; unsendMessage(messageID: string): Promise; } + export class PrivateChannel extends PrivateTextableChannel implements Textable { + type: 1; + } export class Relationship { id: string; From 9da9338ad8d8868a565941c5f2cad626fe0f51e9 Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Sat, 30 Nov 2019 16:40:00 -0600 Subject: [PATCH 3/3] remove tslint comments --- index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 0808154bb..d9db1bc08 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1085,7 +1085,6 @@ declare namespace Eris { on(event: "data", listener: (data: Buffer, userID: string, timestamp: number, sequence: number) => void): this; } - // tslint:disable-next-line export class VoiceConnectionManager extends Collection implements SimpleJSON { // owo an undocumented class constructor(vcObject: new () => T); @@ -1110,7 +1109,6 @@ declare namespace Eris { tokenLimit: number; interval: number; constructor(tokenLimit: number, interval: number, latencyRef: { latency: number }); - // tslint:disable-next-line queue(func: Function): void; }