From 5ff1e7908e90d5e540c248ccae0f0835a6b70769 Mon Sep 17 00:00:00 2001 From: almostSouji Date: Sat, 10 Apr 2021 13:16:41 +0200 Subject: [PATCH 01/17] feat: invite target application --- src/structures/GuildChannel.js | 24 ++++++++++++++- src/structures/IntegrationApplication.js | 37 ++++++++++++++++++++++++ src/structures/Invite.js | 20 +++++++++---- typings/index.d.ts | 15 ++++++++-- 4 files changed, 87 insertions(+), 9 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index c2bf5e367038..29ce42e2cab7 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -472,6 +472,13 @@ class GuildChannel extends Channel { }); } + /** + * Data that can be resolved to an Application. This can be: + * * A Application + * * A Snowflake + * @typedef {Application|Snowflake} ApplicationResolvable + */ + /** * Creates an invite to this guild channel. * @param {Object} [options={}] Options for the invite @@ -480,6 +487,9 @@ class GuildChannel extends Channel { * @param {number} [options.maxAge=86400] How long the invite should last (in seconds, 0 for forever) * @param {number} [options.maxUses=0] Maximum number of uses * @param {boolean} [options.unique=false] Create a unique invite, or use an existing one with similar settings + * @param {ApplicationResolvable} [options.targetApplication] The target application for the invite + * @param {UserResolvable} [options.targetUser] The target user for the invite + * @param {TargetType} [options.targetType] The type of the target for this invite * @param {string} [options.reason] Reason for creating this * @returns {Promise} * @example @@ -488,7 +498,16 @@ class GuildChannel extends Channel { * .then(invite => console.log(`Created an invite with a code of ${invite.code}`)) * .catch(console.error); */ - createInvite({ temporary = false, maxAge = 86400, maxUses = 0, unique, reason } = {}) { + createInvite({ + temporary = false, + maxAge = 86400, + maxUses = 0, + unique, + targetUser, + targetApplication, + targetType, + reason, + } = {}) { return this.client.api .channels(this.id) .invites.post({ @@ -497,6 +516,9 @@ class GuildChannel extends Channel { max_age: maxAge, max_uses: maxUses, unique, + target_user_id: this.client.users.resolveID(targetUser), + target_application_id: targetApplication, + target_type: targetType, }, reason, }) diff --git a/src/structures/IntegrationApplication.js b/src/structures/IntegrationApplication.js index d6372bfd0a22..eadd2ffe465a 100644 --- a/src/structures/IntegrationApplication.js +++ b/src/structures/IntegrationApplication.js @@ -15,6 +15,43 @@ class IntegrationApplication extends Application { * @type {?User} */ this.bot = data.bot ? this.client.users.add(data.bot) : this.bot ?? null; + + /** + * The url of the app's terms of service + * @type {?string} + */ + this.termsOfServiceURL = data.terms_of_service_url ?? this.terms_of_service_url ?? null; + + /** + * The url of the app's privacy policy + * @type {?string} + */ + this.privacyPolicyURL = data.privacyPolicyURL ?? this.data.privacyPolicyURL ?? null; + + /** + * The Array of RPC origin urls + * @type {string[]} + */ + this.rpcOrigins = data.rpc_origins ?? data.rpc_origins ?? []; + + /** + * The application summary + * @type {?string} + */ + this.summary = data.summary ?? this.summary ?? null; + + // TODO: What does #hook indicate? + + /** + * Unknown + * @type {?boolean} + */ + this.hook = data.hook ?? this.hook ?? null; + + /** + * The application's + */ + this.cover = data.cover_image ?? this.cover ?? null; } } diff --git a/src/structures/Invite.js b/src/structures/Invite.js index f252253a61eb..9c81c7280f90 100644 --- a/src/structures/Invite.js +++ b/src/structures/Invite.js @@ -1,6 +1,7 @@ 'use strict'; const Base = require('./Base'); +const IntegrationApplication = require('./IntegrationApplication'); const { Endpoints } = require('../util/Constants'); const Permissions = require('../util/Permissions'); @@ -71,22 +72,29 @@ class Invite extends Base { this.inviter = data.inviter ? this.client.users.add(data.inviter) : null; /** - * The target user for this invite + * The target user of this invite * @type {?User} */ this.targetUser = data.target_user ? this.client.users.add(data.target_user) : null; /** - * The type of the target user: + * The target application of this invite + * @type {?IntegrationApplication} + */ + this.targetApplication = data.target_application ? new IntegrationApplication(data.target_application) : null; + + /** + * The type of the invite target: * * 1: STREAM - * @typedef {number} TargetUser + * * 2: EMBEDDED_APPLICATION + * @typedef {number} TargetType */ /** - * The target user type - * @type {?TargetUser} + * The target type + * @type {?TargetType} */ - this.targetUserType = typeof data.target_user_type === 'number' ? data.target_user_type : null; + this.targetType = typeof data.target_type === 'number' ? data.target_type : null; /** * The channel the invite is for diff --git a/typings/index.d.ts b/typings/index.d.ts index 88be93f89d3a..0ed8bf274690 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -177,6 +177,7 @@ declare module 'discord.js' { public setPermissions(permissions: ApplicationCommandPermissionData[]): Promise; private static transformOption(option: ApplicationCommandOptionData, received?: boolean): object; } + type ApplicationResolvable = Application | Snowflake; export class ApplicationFlags extends BitField { public static FLAGS: Record; @@ -1034,6 +1035,12 @@ declare module 'discord.js' { export class IntegrationApplication extends Application { public bot: User | null; + public termsOfServiceURL: string | null; + public privacyPolicyURL: string | null; + public rpcOrigins: string[]; + public summary: string | null; + public hook: boolean | null; + public cover: string | null; } export class Intents extends BitField { @@ -1077,8 +1084,9 @@ declare module 'discord.js' { public maxUses: number | null; public memberCount: number; public presenceCount: number; + public targetApplication: IntegrationApplication | null; public targetUser: User | null; - public targetUserType: TargetUser | null; + public targetType: TargetType | null; public temporary: boolean | null; public readonly url: string; public uses: number | null; @@ -3091,6 +3099,9 @@ declare module 'discord.js' { maxUses?: number; unique?: boolean; reason?: string; + targetApplication?: ApplicationResolvable; + targetUser?: UserResolvable; + targetType?: TargetType; } type InviteResolvable = string; @@ -3560,7 +3571,7 @@ declare module 'discord.js' { type SystemMessageType = Exclude; - type TargetUser = number; + type TargetType = number; interface TypingData { user: User | PartialUser; From 92d9b13bdaa4eae912a649e807f0108b36a1b7e4 Mon Sep 17 00:00:00 2001 From: almostSouji Date: Sat, 10 Apr 2021 13:28:03 +0200 Subject: [PATCH 02/17] feat: consistent cover documentation --- src/structures/ClientApplication.js | 2 +- src/structures/IntegrationApplication.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/structures/ClientApplication.js b/src/structures/ClientApplication.js index aaefe1a2fd48..04971ea0dce3 100644 --- a/src/structures/ClientApplication.js +++ b/src/structures/ClientApplication.js @@ -30,7 +30,7 @@ class ClientApplication extends Application { this.flags = 'flags' in data ? new ApplicationFlags(data.flags) : this.flags; /** - * The app's cover image + * The hash of the application's cover image * @type {?string} */ this.cover = data.cover_image ?? this.cover ?? null; diff --git a/src/structures/IntegrationApplication.js b/src/structures/IntegrationApplication.js index eadd2ffe465a..dbd7dcc55c7b 100644 --- a/src/structures/IntegrationApplication.js +++ b/src/structures/IntegrationApplication.js @@ -49,7 +49,8 @@ class IntegrationApplication extends Application { this.hook = data.hook ?? this.hook ?? null; /** - * The application's + * The hash of the application's cover image + * @type {?string} */ this.cover = data.cover_image ?? this.cover ?? null; } From 1a66df29f247af9ea8e44dd85921737299c5fc75 Mon Sep 17 00:00:00 2001 From: almostSouji Date: Sat, 10 Apr 2021 13:29:04 +0200 Subject: [PATCH 03/17] feat(Application): rename coverImage to *URL --- src/structures/interfaces/Application.js | 2 +- typings/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/structures/interfaces/Application.js b/src/structures/interfaces/Application.js index c8b198fbb62b..5bcd89daa482 100644 --- a/src/structures/interfaces/Application.js +++ b/src/structures/interfaces/Application.js @@ -75,7 +75,7 @@ class Application extends Base { * @param {ImageURLOptions} [options={}] Options for the Image URL * @returns {?string} URL to the cover image */ - coverImage({ format, size } = {}) { + coverImageURL({ format, size } = {}) { if (!this.cover) return null; return Endpoints.CDN(this.client.options.http.cdn).AppIcon(this.id, this.cover, { format, size }); } diff --git a/typings/index.d.ts b/typings/index.d.ts index 0ed8bf274690..90280b26be89 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -153,7 +153,7 @@ declare module 'discord.js' { public icon: string | null; public id: Snowflake; public name: string | null; - public coverImage(options?: ImageURLOptions): string | null; + public coverImageURL(options?: ImageURLOptions): string | null; public fetchAssets(): Promise; public iconURL(options?: ImageURLOptions): string | null; public toJSON(): object; From 08dd6361b15105a10acf16929805b7ccdd02249a Mon Sep 17 00:00:00 2001 From: almostSouji Date: Sat, 10 Apr 2021 13:53:36 +0200 Subject: [PATCH 04/17] feat: verifyKey --- src/structures/IntegrationApplication.js | 6 ++++++ typings/index.d.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/src/structures/IntegrationApplication.js b/src/structures/IntegrationApplication.js index dbd7dcc55c7b..053338d8a42c 100644 --- a/src/structures/IntegrationApplication.js +++ b/src/structures/IntegrationApplication.js @@ -53,6 +53,12 @@ class IntegrationApplication extends Application { * @type {?string} */ this.cover = data.cover_image ?? this.cover ?? null; + + /** + * The verification key of the application + * @type {?string} + */ + this.verifyKey = data.verify_key ?? this.verifyKey ?? null; } } diff --git a/typings/index.d.ts b/typings/index.d.ts index 90280b26be89..6787190bb4a6 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1041,6 +1041,7 @@ declare module 'discord.js' { public summary: string | null; public hook: boolean | null; public cover: string | null; + public verifyKey: string | null; } export class Intents extends BitField { From 8c497ddc1905f38560249afc028d6417d828a695 Mon Sep 17 00:00:00 2001 From: almostSouji Date: Sat, 10 Apr 2021 13:53:50 +0200 Subject: [PATCH 05/17] fix: handle targetApplication as resolvable --- src/structures/GuildChannel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 29ce42e2cab7..793ad6cfd06e 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -517,7 +517,7 @@ class GuildChannel extends Channel { max_uses: maxUses, unique, target_user_id: this.client.users.resolveID(targetUser), - target_application_id: targetApplication, + target_application_id: targetApplication.id ?? targetApplication, target_type: targetType, }, reason, From 952c515d8e15cf8fbfd599f4e7e5b13c8a6d678b Mon Sep 17 00:00:00 2001 From: almostSouji Date: Sun, 11 Apr 2021 03:17:05 +0200 Subject: [PATCH 06/17] fix: target resolving and app constructing --- src/structures/GuildChannel.js | 2 +- src/structures/IntegrationApplication.js | 2 +- src/structures/Invite.js | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 793ad6cfd06e..9eb13a04b0f5 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -517,7 +517,7 @@ class GuildChannel extends Channel { max_uses: maxUses, unique, target_user_id: this.client.users.resolveID(targetUser), - target_application_id: targetApplication.id ?? targetApplication, + target_application_id: targetApplication?.applicationID ?? targetApplication, target_type: targetType, }, reason, diff --git a/src/structures/IntegrationApplication.js b/src/structures/IntegrationApplication.js index 053338d8a42c..208d301c3ca5 100644 --- a/src/structures/IntegrationApplication.js +++ b/src/structures/IntegrationApplication.js @@ -26,7 +26,7 @@ class IntegrationApplication extends Application { * The url of the app's privacy policy * @type {?string} */ - this.privacyPolicyURL = data.privacyPolicyURL ?? this.data.privacyPolicyURL ?? null; + this.privacyPolicyURL = data.privacyPolicyURL ?? this.privacyPolicyURL ?? null; /** * The Array of RPC origin urls diff --git a/src/structures/Invite.js b/src/structures/Invite.js index 9c81c7280f90..f48d7fb0431c 100644 --- a/src/structures/Invite.js +++ b/src/structures/Invite.js @@ -81,7 +81,9 @@ class Invite extends Base { * The target application of this invite * @type {?IntegrationApplication} */ - this.targetApplication = data.target_application ? new IntegrationApplication(data.target_application) : null; + this.targetApplication = data.target_application + ? new IntegrationApplication(this.client, data.target_application) + : null; /** * The type of the invite target: From be11017bc6d1b982991a82fc5694a5f38794659e Mon Sep 17 00:00:00 2001 From: almostSouji Date: Mon, 12 Apr 2021 10:36:57 +0200 Subject: [PATCH 07/17] docs: document IA#hook --- src/structures/IntegrationApplication.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/structures/IntegrationApplication.js b/src/structures/IntegrationApplication.js index 208d301c3ca5..3b76290274e8 100644 --- a/src/structures/IntegrationApplication.js +++ b/src/structures/IntegrationApplication.js @@ -40,10 +40,8 @@ class IntegrationApplication extends Application { */ this.summary = data.summary ?? this.summary ?? null; - // TODO: What does #hook indicate? - /** - * Unknown + * Whether the application has been associated with a webhook * @type {?boolean} */ this.hook = data.hook ?? this.hook ?? null; From 9a0d98d02d150a3bc6673520ac02398d4f8b8c89 Mon Sep 17 00:00:00 2001 From: almostSouji Date: Mon, 12 Apr 2021 10:38:28 +0200 Subject: [PATCH 08/17] chore: typo --- src/structures/GuildChannel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 9eb13a04b0f5..846a3da10c06 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -474,7 +474,7 @@ class GuildChannel extends Channel { /** * Data that can be resolved to an Application. This can be: - * * A Application + * * An Application * * A Snowflake * @typedef {Application|Snowflake} ApplicationResolvable */ From 5ceceb889df9fec796e4408c666ab8c5adfa4bc4 Mon Sep 17 00:00:00 2001 From: almostSouji Date: Mon, 12 Apr 2021 10:45:21 +0200 Subject: [PATCH 09/17] feat: allow Activity as ApplicationResolvable --- src/structures/GuildChannel.js | 3 ++- typings/index.d.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 846a3da10c06..5947c5d62ffa 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -475,6 +475,7 @@ class GuildChannel extends Channel { /** * Data that can be resolved to an Application. This can be: * * An Application + * * An Activity with associated Application * * A Snowflake * @typedef {Application|Snowflake} ApplicationResolvable */ @@ -517,7 +518,7 @@ class GuildChannel extends Channel { max_uses: maxUses, unique, target_user_id: this.client.users.resolveID(targetUser), - target_application_id: targetApplication?.applicationID ?? targetApplication, + target_application_id: targetApplication?.id ?? targetApplication?.applicationID ?? targetApplication, target_type: targetType, }, reason, diff --git a/typings/index.d.ts b/typings/index.d.ts index 6787190bb4a6..88e235ca5346 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -177,7 +177,8 @@ declare module 'discord.js' { public setPermissions(permissions: ApplicationCommandPermissionData[]): Promise; private static transformOption(option: ApplicationCommandOptionData, received?: boolean): object; } - type ApplicationResolvable = Application | Snowflake; + + type ApplicationResolvable = Application | Activity | Snowflake; export class ApplicationFlags extends BitField { public static FLAGS: Record; From 6d3160d976ebfcaf80eb458bcae234ef6cf7862a Mon Sep 17 00:00:00 2001 From: Souji Date: Mon, 12 Apr 2021 11:21:11 +0200 Subject: [PATCH 10/17] fix: correct fallback data access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Antonio Román --- src/structures/IntegrationApplication.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/structures/IntegrationApplication.js b/src/structures/IntegrationApplication.js index 3b76290274e8..09ae235d061a 100644 --- a/src/structures/IntegrationApplication.js +++ b/src/structures/IntegrationApplication.js @@ -26,13 +26,13 @@ class IntegrationApplication extends Application { * The url of the app's privacy policy * @type {?string} */ - this.privacyPolicyURL = data.privacyPolicyURL ?? this.privacyPolicyURL ?? null; + this.privacyPolicyURL = data.privacy_policy_url ?? this.privacyPolicyURL ?? null; /** * The Array of RPC origin urls * @type {string[]} */ - this.rpcOrigins = data.rpc_origins ?? data.rpc_origins ?? []; + this.rpcOrigins = data.rpc_origins ?? this.rpcOrigins ?? []; /** * The application summary From 93a32f75d91bb4755a2dbe7e778fb3e7815a1f9d Mon Sep 17 00:00:00 2001 From: Souji Date: Mon, 12 Apr 2021 12:45:13 +0200 Subject: [PATCH 11/17] refactor: naming consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Antonio Román --- src/structures/interfaces/Application.js | 2 +- typings/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/structures/interfaces/Application.js b/src/structures/interfaces/Application.js index 5bcd89daa482..af335a3ed3c8 100644 --- a/src/structures/interfaces/Application.js +++ b/src/structures/interfaces/Application.js @@ -75,7 +75,7 @@ class Application extends Base { * @param {ImageURLOptions} [options={}] Options for the Image URL * @returns {?string} URL to the cover image */ - coverImageURL({ format, size } = {}) { + coverURL({ format, size } = {}) { if (!this.cover) return null; return Endpoints.CDN(this.client.options.http.cdn).AppIcon(this.id, this.cover, { format, size }); } diff --git a/typings/index.d.ts b/typings/index.d.ts index 88e235ca5346..c8afafcacbc1 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -153,7 +153,7 @@ declare module 'discord.js' { public icon: string | null; public id: Snowflake; public name: string | null; - public coverImageURL(options?: ImageURLOptions): string | null; + public coverURL(options?: ImageURLOptions): string | null; public fetchAssets(): Promise; public iconURL(options?: ImageURLOptions): string | null; public toJSON(): object; From 8c516ff80c35868f48439dde7d6e637c54ec010d Mon Sep 17 00:00:00 2001 From: Souji Date: Sun, 18 Apr 2021 12:24:23 +0200 Subject: [PATCH 12/17] docs: improvements Co-authored-by: Advaith --- src/structures/GuildChannel.js | 6 +++--- src/structures/IntegrationApplication.js | 2 +- src/structures/Invite.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 5947c5d62ffa..f5467be69c73 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -488,9 +488,9 @@ class GuildChannel extends Channel { * @param {number} [options.maxAge=86400] How long the invite should last (in seconds, 0 for forever) * @param {number} [options.maxUses=0] Maximum number of uses * @param {boolean} [options.unique=false] Create a unique invite, or use an existing one with similar settings - * @param {ApplicationResolvable} [options.targetApplication] The target application for the invite - * @param {UserResolvable} [options.targetUser] The target user for the invite - * @param {TargetType} [options.targetType] The type of the target for this invite + * @param {ApplicationResolvable} [options.targetApplication] The user whose stream to display for this invite, required if `targetType` is 1, the user must be streaming in the channel + * @param {UserResolvable} [options.targetUser] The embedded application to open for this invite, required if `targetType` is 2, the application must have the `EMBEDDED` flag + * @param {TargetType} [options.targetType] The type of the target for this voice channel invite * @param {string} [options.reason] Reason for creating this * @returns {Promise} * @example diff --git a/src/structures/IntegrationApplication.js b/src/structures/IntegrationApplication.js index 09ae235d061a..9d5592a362e2 100644 --- a/src/structures/IntegrationApplication.js +++ b/src/structures/IntegrationApplication.js @@ -53,7 +53,7 @@ class IntegrationApplication extends Application { this.cover = data.cover_image ?? this.cover ?? null; /** - * The verification key of the application + * The hex-encoded key for verification in interactions and the GameSDK's GetTicket * @type {?string} */ this.verifyKey = data.verify_key ?? this.verifyKey ?? null; diff --git a/src/structures/Invite.js b/src/structures/Invite.js index f48d7fb0431c..50a5660aafdd 100644 --- a/src/structures/Invite.js +++ b/src/structures/Invite.js @@ -72,13 +72,13 @@ class Invite extends Base { this.inviter = data.inviter ? this.client.users.add(data.inviter) : null; /** - * The target user of this invite + * The user whose stream to display for this voice channel stream invite * @type {?User} */ this.targetUser = data.target_user ? this.client.users.add(data.target_user) : null; /** - * The target application of this invite + * The embedded application to open for this voice channel embedded application invite * @type {?IntegrationApplication} */ this.targetApplication = data.target_application From 0e9bfffeaab28cbe1efd9df0d9ea4a6db737d567 Mon Sep 17 00:00:00 2001 From: Souji Date: Sun, 18 Apr 2021 12:24:39 +0200 Subject: [PATCH 13/17] fix: default tos accessor Co-authored-by: Advaith --- src/structures/IntegrationApplication.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/IntegrationApplication.js b/src/structures/IntegrationApplication.js index 9d5592a362e2..c9ccf64b3bd5 100644 --- a/src/structures/IntegrationApplication.js +++ b/src/structures/IntegrationApplication.js @@ -20,7 +20,7 @@ class IntegrationApplication extends Application { * The url of the app's terms of service * @type {?string} */ - this.termsOfServiceURL = data.terms_of_service_url ?? this.terms_of_service_url ?? null; + this.termsOfServiceURL = data.terms_of_service_url ?? this.termsOfServiceURL ?? null; /** * The url of the app's privacy policy From 79bff36d63988c8e48be72297f35f857a7b2d8dd Mon Sep 17 00:00:00 2001 From: almostSouji Date: Sun, 18 Apr 2021 12:46:01 +0200 Subject: [PATCH 14/17] fix: lint --- src/structures/GuildChannel.js | 6 ++++-- src/structures/IntegrationApplication.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index f5467be69c73..9140b0c906fa 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -488,8 +488,10 @@ class GuildChannel extends Channel { * @param {number} [options.maxAge=86400] How long the invite should last (in seconds, 0 for forever) * @param {number} [options.maxUses=0] Maximum number of uses * @param {boolean} [options.unique=false] Create a unique invite, or use an existing one with similar settings - * @param {ApplicationResolvable} [options.targetApplication] The user whose stream to display for this invite, required if `targetType` is 1, the user must be streaming in the channel - * @param {UserResolvable} [options.targetUser] The embedded application to open for this invite, required if `targetType` is 2, the application must have the `EMBEDDED` flag + * @param {ApplicationResolvable} [options.targetApplication] The user whose stream to display for this invite, + * required if `targetType` is 1, the user must be streaming in the channel + * @param {UserResolvable} [options.targetUser] The embedded application to open for this invite, + * required if `targetType` is 2, the application must have the `EMBEDDED` flag * @param {TargetType} [options.targetType] The type of the target for this voice channel invite * @param {string} [options.reason] Reason for creating this * @returns {Promise} diff --git a/src/structures/IntegrationApplication.js b/src/structures/IntegrationApplication.js index c9ccf64b3bd5..c3d4de890967 100644 --- a/src/structures/IntegrationApplication.js +++ b/src/structures/IntegrationApplication.js @@ -53,7 +53,7 @@ class IntegrationApplication extends Application { this.cover = data.cover_image ?? this.cover ?? null; /** - * The hex-encoded key for verification in interactions and the GameSDK's GetTicket + * The hex-encoded key for verification in interactions and the GameSDK's GetTicket * @type {?string} */ this.verifyKey = data.verify_key ?? this.verifyKey ?? null; From e67e6987106d3f63e71f5526c77032886c247da9 Mon Sep 17 00:00:00 2001 From: almostSouji Date: Sun, 18 Apr 2021 13:10:51 +0200 Subject: [PATCH 15/17] fix: correct hook docstring --- src/structures/IntegrationApplication.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/IntegrationApplication.js b/src/structures/IntegrationApplication.js index c3d4de890967..b820331bccde 100644 --- a/src/structures/IntegrationApplication.js +++ b/src/structures/IntegrationApplication.js @@ -41,7 +41,7 @@ class IntegrationApplication extends Application { this.summary = data.summary ?? this.summary ?? null; /** - * Whether the application has been associated with a webhook + * Whether the application can be default hooked by the client * @type {?boolean} */ this.hook = data.hook ?? this.hook ?? null; From 2e5cfbd8c40d93f14e36cb2e4f98e4806a2e9092 Mon Sep 17 00:00:00 2001 From: almostSouji Date: Mon, 10 May 2021 21:54:43 +0200 Subject: [PATCH 16/17] fix: untangle target types and requirements --- src/structures/GuildChannel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 9140b0c906fa..3e4fd4abc3ab 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -488,9 +488,9 @@ class GuildChannel extends Channel { * @param {number} [options.maxAge=86400] How long the invite should last (in seconds, 0 for forever) * @param {number} [options.maxUses=0] Maximum number of uses * @param {boolean} [options.unique=false] Create a unique invite, or use an existing one with similar settings - * @param {ApplicationResolvable} [options.targetApplication] The user whose stream to display for this invite, + * @param {UserResolvable} [options.targetUser] The user whose stream to display for this invite, * required if `targetType` is 1, the user must be streaming in the channel - * @param {UserResolvable} [options.targetUser] The embedded application to open for this invite, + * @param {ApplicationResolvable} [options.targetApplication] The embedded application to open for this invite, * required if `targetType` is 2, the application must have the `EMBEDDED` flag * @param {TargetType} [options.targetType] The type of the target for this voice channel invite * @param {string} [options.reason] Reason for creating this From 58cee6d9f52ea94e50a7363ba56bf992669782cc Mon Sep 17 00:00:00 2001 From: almostSouji Date: Mon, 10 May 2021 21:55:47 +0200 Subject: [PATCH 17/17] refactor: rename to InviteTargetType for added verbosity --- src/structures/GuildChannel.js | 2 +- typings/index.d.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 3e4fd4abc3ab..167b8dbc9d3c 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -492,7 +492,7 @@ class GuildChannel extends Channel { * required if `targetType` is 1, the user must be streaming in the channel * @param {ApplicationResolvable} [options.targetApplication] The embedded application to open for this invite, * required if `targetType` is 2, the application must have the `EMBEDDED` flag - * @param {TargetType} [options.targetType] The type of the target for this voice channel invite + * @param {InviteTargetType} [options.targetType] The type of the target for this voice channel invite * @param {string} [options.reason] Reason for creating this * @returns {Promise} * @example diff --git a/typings/index.d.ts b/typings/index.d.ts index c8afafcacbc1..d21c79798e1d 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -32,6 +32,11 @@ declare enum InteractionTypes { APPLICATION_COMMAND = 2, } +declare enum InviteTargetType { + STREAM = 1, + EMBEDDED_APPLICATION = 2, +} + declare enum OverwriteTypes { role = 0, member = 1, @@ -1088,7 +1093,7 @@ declare module 'discord.js' { public presenceCount: number; public targetApplication: IntegrationApplication | null; public targetUser: User | null; - public targetType: TargetType | null; + public targetType: InviteTargetType | null; public temporary: boolean | null; public readonly url: string; public uses: number | null; @@ -3103,7 +3108,7 @@ declare module 'discord.js' { reason?: string; targetApplication?: ApplicationResolvable; targetUser?: UserResolvable; - targetType?: TargetType; + targetType?: InviteTargetType; } type InviteResolvable = string; @@ -3573,8 +3578,6 @@ declare module 'discord.js' { type SystemMessageType = Exclude; - type TargetType = number; - interface TypingData { user: User | PartialUser; since: Date;