Skip to content

Commit dc83e48

Browse files
committed
feat: guest invites
1 parent 498d323 commit dc83e48

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

packages/discord.js/src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ exports.Constants = require('./util/Constants.js');
2929
exports.Events = require('./util/Events.js').Events;
3030
exports.GuildMemberFlagsBitField = require('./util/GuildMemberFlagsBitField.js').GuildMemberFlagsBitField;
3131
exports.IntentsBitField = require('./util/IntentsBitField.js').IntentsBitField;
32+
exports.InviteFlagsBitField = require('./util/InviteFlagsBitField.js').InviteFlagsBitField;
3233
exports.LimitedCollection = require('./util/LimitedCollection.js').LimitedCollection;
3334
exports.MessageFlagsBitField = require('./util/MessageFlagsBitField.js').MessageFlagsBitField;
3435
exports.Options = require('./util/Options.js').Options;

packages/discord.js/src/structures/GuildInvite.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const { Routes, PermissionFlagsBits, InviteType } = require('discord-api-types/v10');
44
const { DiscordjsError, ErrorCodes } = require('../errors/index.js');
5+
const { InviteFlagsBitField } = require('../util/InviteFlagsBitField.js');
56
const { BaseInvite } = require('./BaseInvite.js');
67
const { GuildScheduledEvent } = require('./GuildScheduledEvent.js');
78
const { 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.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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 an {@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;

0 commit comments

Comments
 (0)