From 3910ca2257c3f41a66e22c40f46d5fd62b0472e6 Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Wed, 24 Jan 2024 19:53:59 +0700 Subject: [PATCH] feat: Invite type --- src/structures/Invite.js | 20 ++++++++++++++++++++ typings/enums.d.ts | 10 +++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/structures/Invite.js b/src/structures/Invite.js index 6e5b9c5..c033171 100644 --- a/src/structures/Invite.js +++ b/src/structures/Invite.js @@ -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 diff --git a/typings/enums.d.ts b/typings/enums.d.ts index 56581f5..df9ba68 100644 --- a/typings/enums.d.ts +++ b/typings/enums.d.ts @@ -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 {