feat: add support for teams update

#9805 backport
This commit is contained in:
Elysia
2024-09-17 17:57:51 +07:00
parent f8071f7e79
commit 8fce4c1fbf
2 changed files with 17 additions and 0 deletions

View File

@@ -3,6 +3,11 @@
const Base = require('./Base'); const Base = require('./Base');
const { MembershipStates } = require('../util/Constants'); const { MembershipStates } = require('../util/Constants');
/**
* @external TeamMemberRole
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/TeamMemberRole}
*/
/** /**
* Represents a Client OAuth2 Application Team Member. * Represents a Client OAuth2 Application Team Member.
* @extends {Base} * @extends {Base}
@@ -25,10 +30,19 @@ class TeamMember extends Base {
/** /**
* The permissions this Team Member has with regard to the team * The permissions this Team Member has with regard to the team
* @type {string[]} * @type {string[]}
* @deprecated Use {@link TeamMember#role} instead.
*/ */
this.permissions = data.permissions; this.permissions = data.permissions;
} }
if ('role' in data) {
/**
* The role of this Team Member
* @type {TeamMemberRole}
*/
this.role = data.role;
}
if ('membership_state' in data) { if ('membership_state' in data) {
/** /**
* The permissions this Team Member has with regard to the team * The permissions this Team Member has with regard to the team

3
typings/index.d.ts vendored
View File

@@ -54,6 +54,7 @@ import {
LocaleString, LocaleString,
APIGuildMember, APIGuildMember,
APIChannel, APIChannel,
TeamMemberRole
} from 'discord-api-types/v9'; } from 'discord-api-types/v9';
import { ChildProcess } from 'node:child_process'; import { ChildProcess } from 'node:child_process';
import { EventEmitter } from 'node:events'; import { EventEmitter } from 'node:events';
@@ -3164,8 +3165,10 @@ export class TeamMember extends Base {
private constructor(team: Team, data: RawTeamMemberData); private constructor(team: Team, data: RawTeamMemberData);
public team: Team; public team: Team;
public readonly id: Snowflake; public readonly id: Snowflake;
/** @deprecated Use {@link role} instead. */
public permissions: string[]; public permissions: string[];
public membershipState: MembershipState; public membershipState: MembershipState;
public role: TeamMemberRole;
public user: User; public user: User;
public toString(): UserMention; public toString(): UserMention;