Skip to content

Commit

Permalink
feat: add support for teams update (#9805)
Browse files Browse the repository at this point in the history
* refactor(TeamMember): deprecate permissions property

* feat: add support for team member roles

* feat: add reference to external team member role enum

* docs: suggested changes

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 15, 2023
1 parent 9dbc954 commit c66636d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/discord.js/src/structures/TeamMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class TeamMember extends Base {
/**
* The permissions this Team Member has with regard to the team
* @type {string[]}
* @deprecated Use {@link TeamMember#role} instead.
*/
this.permissions = data.permissions;
}
Expand All @@ -43,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;
}
}

/**
Expand Down
5 changes: 5 additions & 0 deletions packages/discord.js/src/util/APITypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
3 changes: 3 additions & 0 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ import {
GuildOnboardingPromptType,
AttachmentFlags,
RoleFlags,
TeamMemberRole,
} from 'discord-api-types/v10';
import { ChildProcess } from 'node:child_process';
import { EventEmitter } from 'node:events';
Expand Down Expand Up @@ -2991,9 +2992,11 @@ export class TeamMember extends Base {
private constructor(team: Team, data: RawTeamMemberData);
public team: Team;
public get id(): Snowflake;
/** @deprecated Use {@link role} instead. */
public permissions: string[];
public membershipState: TeamMemberMembershipState;
public user: User;
public role: TeamMemberRole;

public toString(): UserMention;
}
Expand Down

0 comments on commit c66636d

Please sign in to comment.