Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for teams update #9805

Merged
merged 6 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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