From a77253eb3dce413c8d47e0bc7a2ffc90f4b4f0f0 Mon Sep 17 00:00:00 2001 From: Danial Raza Date: Thu, 24 Aug 2023 12:23:49 +0000 Subject: [PATCH 1/4] refactor(TeamMember): deprecate permissions property --- packages/discord.js/src/structures/TeamMember.js | 1 + packages/discord.js/typings/index.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/discord.js/src/structures/TeamMember.js b/packages/discord.js/src/structures/TeamMember.js index 92704187abba..862164558fcf 100644 --- a/packages/discord.js/src/structures/TeamMember.js +++ b/packages/discord.js/src/structures/TeamMember.js @@ -24,6 +24,7 @@ class TeamMember extends Base { /** * The permissions this Team Member has with regard to the team * @type {string[]} + * @deprecated */ this.permissions = data.permissions; } diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index cfb64e6b44a3..bc919b2c6273 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2991,6 +2991,7 @@ export class TeamMember extends Base { private constructor(team: Team, data: RawTeamMemberData); public team: Team; public get id(): Snowflake; + /** @deprecated */ public permissions: string[]; public membershipState: TeamMemberMembershipState; public user: User; From 6b65e0dbab8e7cd73f19a09e97ba9fb9b0112f00 Mon Sep 17 00:00:00 2001 From: Danial Raza Date: Fri, 25 Aug 2023 10:51:16 +0000 Subject: [PATCH 2/4] feat: add support for team member roles --- packages/discord.js/src/structures/TeamMember.js | 8 ++++++++ packages/discord.js/typings/index.d.ts | 2 ++ 2 files changed, 10 insertions(+) diff --git a/packages/discord.js/src/structures/TeamMember.js b/packages/discord.js/src/structures/TeamMember.js index 862164558fcf..2d2e09ba152a 100644 --- a/packages/discord.js/src/structures/TeamMember.js +++ b/packages/discord.js/src/structures/TeamMember.js @@ -44,6 +44,14 @@ class TeamMember extends Base { */ this.user = this.client.users._add(data.user); } + + if ('role' in data) { + /** + * The role of this Team Member + * @type {TeamMemberRole} + */ + this.role = data.role; + } } /** diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index bc919b2c6273..769f6fa717b5 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -168,6 +168,7 @@ import { GuildOnboardingPromptType, AttachmentFlags, RoleFlags, + TeamMemberRole, } from 'discord-api-types/v10'; import { ChildProcess } from 'node:child_process'; import { EventEmitter } from 'node:events'; @@ -2995,6 +2996,7 @@ export class TeamMember extends Base { public permissions: string[]; public membershipState: TeamMemberMembershipState; public user: User; + public role: TeamMemberRole; public toString(): UserMention; } From 2843ed95fb41d027a91ce6108c526a22ccbf5d64 Mon Sep 17 00:00:00 2001 From: Danial Raza Date: Fri, 25 Aug 2023 11:26:04 +0000 Subject: [PATCH 3/4] feat: add reference to external team member role enum --- packages/discord.js/src/util/APITypes.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/discord.js/src/util/APITypes.js b/packages/discord.js/src/util/APITypes.js index e8ab25a89d13..4020ba153b29 100644 --- a/packages/discord.js/src/util/APITypes.js +++ b/packages/discord.js/src/util/APITypes.js @@ -450,6 +450,11 @@ * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/TeamMemberMembershipState} */ +/** + * @external TeamMemberRole + * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/TeamMemberRole} + */ + /** * @external TextInputStyle * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/TextInputStyle} From d0fcadd71b1945b62c1180489cd0b1bd9ba111ea Mon Sep 17 00:00:00 2001 From: Danial Raza Date: Fri, 25 Aug 2023 22:29:24 +0200 Subject: [PATCH 4/4] docs: suggested changes Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --- packages/discord.js/src/structures/TeamMember.js | 2 +- packages/discord.js/typings/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/discord.js/src/structures/TeamMember.js b/packages/discord.js/src/structures/TeamMember.js index 2d2e09ba152a..b3c53987d943 100644 --- a/packages/discord.js/src/structures/TeamMember.js +++ b/packages/discord.js/src/structures/TeamMember.js @@ -24,7 +24,7 @@ class TeamMember extends Base { /** * The permissions this Team Member has with regard to the team * @type {string[]} - * @deprecated + * @deprecated Use {@link TeamMember#role} instead. */ this.permissions = data.permissions; } diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 769f6fa717b5..75b7ecc9763b 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2992,7 +2992,7 @@ export class TeamMember extends Base { private constructor(team: Team, data: RawTeamMemberData); public team: Team; public get id(): Snowflake; - /** @deprecated */ + /** @deprecated Use {@link role} instead. */ public permissions: string[]; public membershipState: TeamMemberMembershipState; public user: User;