feat: Invite type

This commit is contained in:
Elysia 2024-01-24 19:53:59 +07:00
parent 4a31c662a5
commit 3910ca2257
2 changed files with 29 additions and 1 deletions

View File

@ -155,6 +155,8 @@ class Invite extends Base {
* The type of the invite target:
* * 1: STREAM
* * 2: EMBEDDED_APPLICATION
* * 3: ROLE_SUBSCRIPTIONS
* * 4: CREATOR_PAGE
* @typedef {number} TargetType
* @see {@link https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types}
*/
@ -169,6 +171,24 @@ class Invite extends Base {
this.targetType ??= null;
}
/**
* The type of the invite:
* * 0: GUILD
* * 1: GROUP_DM
* * 2: FRIEND
* @typedef {number} InviteType
* @see {@link https://docs.discord.sex/resources/invite#invite-type}
*/
if ('type' in data) {
/**
* The type of invite
* @type {?InviteType}
*/
this.type = data.type;
} else {
this.type ??= null;
}
if ('channel_id' in data) {
/**
* The channel's id this invite is for

10
typings/enums.d.ts vendored
View File

@ -162,7 +162,15 @@ export const enum InteractionTypes {
export const enum InviteTargetType {
STREAM = 1,
EMBEDDED_APPLICATION = 2,
EMBEDDED_APPLICATION,
ROLE_SUBSCRIPTIONS,
CREATOR_PAGE,
}
export const enum InviteType {
GUILD,
GROUP_DM,
FRIEND,
}
export const enum MembershipStates {