From c51921efece800905452eaf167286a8ab3c00ee6 Mon Sep 17 00:00:00 2001 From: SiroTM Date: Wed, 9 Jun 2021 09:47:29 -0400 Subject: [PATCH 1/6] refactor(Structures): Channel --- structures/Channel.ts | 8 +++++++- structures/index.ts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/structures/Channel.ts b/structures/Channel.ts index 998f073..2d2209e 100644 --- a/structures/Channel.ts +++ b/structures/Channel.ts @@ -14,7 +14,7 @@ export default interface Channel extends Base { nsfw?: boolean; owner_id?: string; parent_id?: string | null; - permission_overwrites?: unknown[]; // TODO Overwrite + permission_overwrites?: PermissionOverwrite[]; position?: number; rate_limit_per_user?: number; recipients?: [unknown]; // TODO User @@ -67,3 +67,9 @@ export enum VideoQuality { AUTO = 1, FULL, } + +export interface PermissionOverwrite extends Base { + allow: string; + deny: string; + type: 0 | 1; +} diff --git a/structures/index.ts b/structures/index.ts index 7aa54cd..c343d06 100644 --- a/structures/index.ts +++ b/structures/index.ts @@ -1,6 +1,6 @@ export { default as Base } from './Base'; export { default as BotGateway } from './BotGateway'; -export { default as Channel, ChannelPartial, WebhookChannel, ChannelType, ThreadMember, ThreadMetadata, VideoQuality } from './Channel'; +export { default as Channel, ChannelPartial, WebhookChannel, ChannelType, ThreadMember, ThreadMetadata, VideoQuality, PermissionOverwrite } from './Channel'; export { default as Emoji, PartialEmoji } from './Emoji'; export { default as Guild, InviteGuild, TemplateGuild, WebhookGuild, DefaultMessageNotificationLevel, ExplicitContentFilterLevel, GuildFeatures, MFALevel, PremiumTier, SystemChannelFlags, VerificationLevel, WelcomeScreen, WelcomeScreenChannel } from './Guild'; export { default as GuildIntegration, BotIntegration, IntegrationAccount, IntegrationApplication, IntegrationExpireBehaviour, InterationType } from './GuildIntegration'; From 884da2724be4e3b7ddad28e67e8f42799b694755 Mon Sep 17 00:00:00 2001 From: SiroTM Date: Wed, 9 Jun 2021 10:07:37 -0400 Subject: [PATCH 2/6] moved PermissionOverwrite to Permissions.ts --- structures/Channel.ts | 7 +------ structures/Permissions.ts | 6 ++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/structures/Channel.ts b/structures/Channel.ts index 2d2209e..b476ffa 100644 --- a/structures/Channel.ts +++ b/structures/Channel.ts @@ -1,4 +1,5 @@ import Base from './Base'; +import { PermissionOverwrite } from './Permissions'; export default interface Channel extends Base { application_id?: string; @@ -67,9 +68,3 @@ export enum VideoQuality { AUTO = 1, FULL, } - -export interface PermissionOverwrite extends Base { - allow: string; - deny: string; - type: 0 | 1; -} diff --git a/structures/Permissions.ts b/structures/Permissions.ts index 186bd0c..ebfe1cd 100644 --- a/structures/Permissions.ts +++ b/structures/Permissions.ts @@ -2,6 +2,7 @@ // @ts-nocheck // NOTE Can't enun bigints, but reverse mappings will cast bigints to stringified keys. // NOTE See https://github.com/microsoft/TypeScript/issues/40793 and https://github.com/microsoft/TypeScript/issues/37783 +import Base from './Base'; enum Permissions { CREATE_INSTANT_INVITE = 1n << 0n, @@ -43,5 +44,10 @@ enum Permissions { USE_PRIVATE_THREADS = 1n << 36n, } +export interface PermissionOverwrite extends Base { + allow: string; + deny: string; + type: 0 | 1; +} export default Permissions; From 9ab44d85f93ae297e38f281b6407bc7d532e5528 Mon Sep 17 00:00:00 2001 From: SiroTM Date: Wed, 9 Jun 2021 10:24:53 -0400 Subject: [PATCH 3/6] move PermissionOverwrite in index.ts --- structures/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/structures/index.ts b/structures/index.ts index a178043..cc8a11b 100644 --- a/structures/index.ts +++ b/structures/index.ts @@ -1,5 +1,5 @@ export { default as Base } from './Base'; -export { default as Channel, ChannelPartial, WebhookChannel, ChannelType, ThreadMember, ThreadMetadata, VideoQuality, PermissionOverwrite } from './Channel'; +export { default as Channel, ChannelPartial, WebhookChannel, ChannelType, ThreadMember, ThreadMetadata, VideoQuality } from './Channel'; export { default as BotGateway } from './Gateway'; export { default as Emoji, PartialEmoji } from './Emoji'; export { default as Guild, InviteGuild, TemplateGuild, WebhookGuild, DefaultMessageNotificationLevel, ExplicitContentFilterLevel, GuildFeatures, MFALevel, PremiumTier, SystemChannelFlags, VerificationLevel, WelcomeScreen, WelcomeScreenChannel } from './Guild'; @@ -9,7 +9,7 @@ export { default as GuildPreview } from './GuildPreview'; export { default as GuildTemplate } from './GuildTemplate'; export { default as Invite, InviteMetadata, InviteTargetType } from './Invite'; export { default as Message, MessageActivity, MessageActivityType, MessageFlags, MessageReference, MessageType, Reaction } from './Message'; -export { default as Permissions } from './Permissions'; +export { default as Permissions, PermissionOverwrite } from './Permissions'; export { default as UserConnection, ConnectionVisibilityType } from './UserConnections'; export { default as VoiceRegion } from './VoiceRegion'; export { default as VoiceState } from './VoiceState'; From 15cad8f8d5f81ff980574c85799c70cf2bb8875b Mon Sep 17 00:00:00 2001 From: SiroTM Date: Thu, 10 Jun 2021 08:43:42 -0400 Subject: [PATCH 4/6] PermissionOverwriteType --- structures/Permissions.ts | 7 ++++++- structures/index.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/structures/Permissions.ts b/structures/Permissions.ts index ebfe1cd..e6a52a6 100644 --- a/structures/Permissions.ts +++ b/structures/Permissions.ts @@ -47,7 +47,12 @@ enum Permissions { export interface PermissionOverwrite extends Base { allow: string; deny: string; - type: 0 | 1; + type: PermissionOverwriteType; +} + +export enum PermissionOverwriteType { + ROLE, + MEMBER, } export default Permissions; diff --git a/structures/index.ts b/structures/index.ts index cc8a11b..6f0da18 100644 --- a/structures/index.ts +++ b/structures/index.ts @@ -9,7 +9,7 @@ export { default as GuildPreview } from './GuildPreview'; export { default as GuildTemplate } from './GuildTemplate'; export { default as Invite, InviteMetadata, InviteTargetType } from './Invite'; export { default as Message, MessageActivity, MessageActivityType, MessageFlags, MessageReference, MessageType, Reaction } from './Message'; -export { default as Permissions, PermissionOverwrite } from './Permissions'; +export { default as Permissions, PermissionOverwrite, PermissionOverwriteType } from './Permissions'; export { default as UserConnection, ConnectionVisibilityType } from './UserConnections'; export { default as VoiceRegion } from './VoiceRegion'; export { default as VoiceState } from './VoiceState'; From 03389f4c5247ee21bec42c0dee3e6f585d594e08 Mon Sep 17 00:00:00 2001 From: SiroTM Date: Thu, 10 Jun 2021 08:48:33 -0400 Subject: [PATCH 5/6] replace export gateway --- structures/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/structures/index.ts b/structures/index.ts index 6f0da18..4255343 100644 --- a/structures/index.ts +++ b/structures/index.ts @@ -1,6 +1,6 @@ export { default as Base } from './Base'; -export { default as Channel, ChannelPartial, WebhookChannel, ChannelType, ThreadMember, ThreadMetadata, VideoQuality } from './Channel'; export { default as BotGateway } from './Gateway'; +export { default as Channel, ChannelPartial, WebhookChannel, ChannelType, ThreadMember, ThreadMetadata, VideoQuality } from './Channel'; export { default as Emoji, PartialEmoji } from './Emoji'; export { default as Guild, InviteGuild, TemplateGuild, WebhookGuild, DefaultMessageNotificationLevel, ExplicitContentFilterLevel, GuildFeatures, MFALevel, PremiumTier, SystemChannelFlags, VerificationLevel, WelcomeScreen, WelcomeScreenChannel } from './Guild'; export { default as GuildIntegration, BotIntegration, IntegrationAccount, IntegrationApplication, IntegrationExpireBehaviour, InterationType } from './GuildIntegration'; From d4c4638be0eb36f7e1fd5d5f052692c2bfe14ce0 Mon Sep 17 00:00:00 2001 From: SiroTM Date: Sun, 13 Jun 2021 19:10:14 -0400 Subject: [PATCH 6/6] Permissions type --- structures/Permissions.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/structures/Permissions.ts b/structures/Permissions.ts index e6a52a6..95e4cad 100644 --- a/structures/Permissions.ts +++ b/structures/Permissions.ts @@ -45,8 +45,8 @@ enum Permissions { } export interface PermissionOverwrite extends Base { - allow: string; - deny: string; + allow: Permissions; + deny: Permissions; type: PermissionOverwriteType; }