File tree Expand file tree Collapse file tree 5 files changed +56
-0
lines changed Expand file tree Collapse file tree 5 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ exports.Constants = require('./util/Constants.js');
2929exports . Events = require ( './util/Events.js' ) . Events ;
3030exports . GuildMemberFlagsBitField = require ( './util/GuildMemberFlagsBitField.js' ) . GuildMemberFlagsBitField ;
3131exports . IntentsBitField = require ( './util/IntentsBitField.js' ) . IntentsBitField ;
32+ exports . InviteFlagsBitField = require ( './util/InviteFlagsBitField.js' ) . InviteFlagsBitField ;
3233exports . LimitedCollection = require ( './util/LimitedCollection.js' ) . LimitedCollection ;
3334exports . MessageFlagsBitField = require ( './util/MessageFlagsBitField.js' ) . MessageFlagsBitField ;
3435exports . Options = require ( './util/Options.js' ) . Options ;
Original file line number Diff line number Diff line change 22
33const { Routes, PermissionFlagsBits, InviteType } = require ( 'discord-api-types/v10' ) ;
44const { DiscordjsError, ErrorCodes } = require ( '../errors/index.js' ) ;
5+ const { InviteFlagsBitField } = require ( '../util/InviteFlagsBitField.js' ) ;
56const { BaseInvite } = require ( './BaseInvite.js' ) ;
67const { GuildScheduledEvent } = require ( './GuildScheduledEvent.js' ) ;
78const { IntegrationApplication } = require ( './IntegrationApplication.js' ) ;
@@ -48,6 +49,17 @@ class GuildInvite extends BaseInvite {
4849 _patch ( data ) {
4950 super . _patch ( data ) ;
5051
52+ if ( 'flags' in data ) {
53+ /**
54+ * The flags of this invite.
55+ *
56+ * @type {Readonly<InviteFlagsBitField> }
57+ */
58+ this . flags = new InviteFlagsBitField ( data . flags ) . freeze ( ) ;
59+ } else {
60+ this . flags ??= new InviteFlagsBitField ( ) . freeze ( ) ;
61+ }
62+
5163 if ( 'guild' in data ) {
5264 /**
5365 * The guild the invite is for. May include welcome screen data.
Original file line number Diff line number Diff line change 514514 * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/InteractionResponseType }
515515 */
516516
517+ /**
518+ * @external InviteFlags
519+ * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/InviteFlags }
520+ */
521+
517522/**
518523 * @external InviteType
519524 * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/InviteType }
Original file line number Diff line number Diff line change 1+ /* eslint-disable jsdoc/check-values */
2+ 'use strict' ;
3+
4+ const { InviteFlags } = require ( 'discord-api-types/v10' ) ;
5+ const { BitField } = require ( './BitField.js' ) ;
6+
7+ /**
8+ * Data structure that makes it easy to interact with a {@link GuildInvite#flags} bit field.
9+ *
10+ * @extends {BitField }
11+ */
12+ class InviteFlagsBitField extends BitField {
13+ /**
14+ * Numeric invite flags.
15+ *
16+ * @type {InviteFlags }
17+ * @memberof InviteFlagsBitField
18+ */
19+ static Flags = InviteFlags ;
20+ }
21+
22+ /**
23+ * @name InviteFlagsBitField
24+ * @kind constructor
25+ * @memberof InviteFlagsBitField
26+ * @param {BitFieldResolvable } [bits=0] Bit(s) to read from
27+ */
28+
29+ exports . InviteFlagsBitField = InviteFlagsBitField ;
Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ import {
159159 InteractionContextType ,
160160 InteractionResponseType ,
161161 InteractionType ,
162+ InviteFlags ,
162163 InviteTargetType ,
163164 InviteType ,
164165 Locale ,
@@ -2039,6 +2040,7 @@ export class BaseInvite<WithCounts extends boolean = boolean> extends Base {
20392040
20402041export class GuildInvite < WithCounts extends boolean = boolean > extends BaseInvite < WithCounts > {
20412042 public readonly type : InviteType . Guild ;
2043+ public flags : Readonly < InviteFlagsBitField > ;
20422044 public guild : Guild | InviteGuild | null ;
20432045 public readonly guildId : Snowflake ;
20442046 public channel : NonThreadGuildBasedChannel | null ;
@@ -2054,6 +2056,13 @@ export class GuildInvite<WithCounts extends boolean = boolean> extends BaseInvit
20542056 public delete ( reason ?: string ) : Promise < void > ;
20552057}
20562058
2059+ export type InviteFlagsString = keyof typeof InviteFlags ;
2060+
2061+ export class InviteFlagsBitField extends BitField < InviteFlagsString > {
2062+ public static Flags : typeof InviteFlags ;
2063+ public static resolve ( bit ?: BitFieldResolvable < InviteFlagsString , number > ) : number ;
2064+ }
2065+
20572066export class GroupDMInvite < WithCounts extends boolean = boolean > extends BaseInvite < WithCounts > {
20582067 public readonly type : InviteType . GroupDM ;
20592068 public channel : PartialGroupDMChannel | null ;
You can’t perform that action at this time.
0 commit comments