mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
@@ -33,6 +33,7 @@ exports.Events = require('./util/Events');
|
||||
exports.Formatters = require('./util/Formatters');
|
||||
exports.GuildMemberFlagsBitField = require('./util/GuildMemberFlagsBitField').GuildMemberFlagsBitField;
|
||||
exports.IntentsBitField = require('./util/IntentsBitField');
|
||||
exports.InviteFlagsBitField = require('./util/InviteFlagsBitField.js').InviteFlagsBitField;
|
||||
exports.LimitedCollection = require('./util/LimitedCollection');
|
||||
exports.MessageFlagsBitField = require('./util/MessageFlagsBitField');
|
||||
exports.Options = require('./util/Options');
|
||||
|
||||
@@ -6,6 +6,7 @@ const { GuildScheduledEvent } = require('./GuildScheduledEvent');
|
||||
const IntegrationApplication = require('./IntegrationApplication');
|
||||
const InviteStageInstance = require('./InviteStageInstance');
|
||||
const { DiscordjsError, ErrorCodes } = require('../errors');
|
||||
const { InviteFlagsBitField } = require('../util/InviteFlagsBitField.js');
|
||||
|
||||
/**
|
||||
* Represents an invitation to a guild channel.
|
||||
@@ -222,6 +223,17 @@ class Invite extends Base {
|
||||
} else {
|
||||
this.guildScheduledEvent ??= null;
|
||||
}
|
||||
|
||||
if ('flags' in data) {
|
||||
/**
|
||||
* The flags of this invite.
|
||||
*
|
||||
* @type {Readonly<InviteFlagsBitField>}
|
||||
*/
|
||||
this.flags = new InviteFlagsBitField(data.flags).freeze();
|
||||
} else {
|
||||
this.flags ??= new InviteFlagsBitField().freeze();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -515,6 +515,11 @@
|
||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/InteractionResponseType}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @external InviteFlags
|
||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/InviteFlags}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @external InviteType
|
||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/InviteType}
|
||||
|
||||
28
packages/discord.js/src/util/InviteFlagsBitField.js
Normal file
28
packages/discord.js/src/util/InviteFlagsBitField.js
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
const { InviteFlags } = require('discord-api-types/v10');
|
||||
const { BitField } = require('./BitField.js');
|
||||
|
||||
/**
|
||||
* Data structure that makes it easy to interact with a {@link GuildInvite#flags} bit field.
|
||||
*
|
||||
* @extends {BitField}
|
||||
*/
|
||||
class InviteFlagsBitField extends BitField {
|
||||
/**
|
||||
* Numeric invite flags.
|
||||
*
|
||||
* @type {InviteFlags}
|
||||
* @memberof InviteFlagsBitField
|
||||
*/
|
||||
static Flags = InviteFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name InviteFlagsBitField
|
||||
* @kind constructor
|
||||
* @memberof InviteFlagsBitField
|
||||
* @param {BitFieldResolvable} [bits=0] Bit(s) to read from
|
||||
*/
|
||||
|
||||
exports.InviteFlagsBitField = InviteFlagsBitField;
|
||||
9
packages/discord.js/typings/index.d.ts
vendored
9
packages/discord.js/typings/index.d.ts
vendored
@@ -215,6 +215,7 @@ import {
|
||||
APIFileComponent,
|
||||
APIMessageTopLevelComponent,
|
||||
EntryPointCommandHandlerType,
|
||||
InviteFlags,
|
||||
} from 'discord-api-types/v10';
|
||||
import { ChildProcess } from 'node:child_process';
|
||||
import { EventEmitter } from 'node:events';
|
||||
@@ -2274,6 +2275,7 @@ export class Invite extends Base {
|
||||
/** @deprecated Public Stage Instances don't exist anymore */
|
||||
public stageInstance: InviteStageInstance | null;
|
||||
public guildScheduledEvent: GuildScheduledEvent | null;
|
||||
public flags: Readonly<InviteFlagsBitField>;
|
||||
}
|
||||
|
||||
/** @deprecated Public Stage Instances don't exist anymore */
|
||||
@@ -2294,6 +2296,13 @@ export class InviteGuild extends AnonymousGuild {
|
||||
public welcomeScreen: WelcomeScreen | null;
|
||||
}
|
||||
|
||||
export type InviteFlagsString = keyof typeof InviteFlags;
|
||||
|
||||
export class InviteFlagsBitField extends BitField<InviteFlagsString> {
|
||||
public static Flags: typeof InviteFlags;
|
||||
public static resolve(bit?: BitFieldResolvable<InviteFlagsString, number>): number;
|
||||
}
|
||||
|
||||
export class LimitedCollection<Key, Value> extends Collection<Key, Value> {
|
||||
public constructor(options?: LimitedCollectionOptions<Key, Value>, iterable?: Iterable<readonly [Key, Value]>);
|
||||
public maxSize: number;
|
||||
|
||||
Reference in New Issue
Block a user